FAQ
hi list,

i'm trying to use Lucene (1.4.3) to replace an existing MySQL search system.
so far, this is working great, but i have a couple of questions.

firstly, when my index updater is (re)indexing a lot of documents at once, i
often get errors like
"FileNotFoundException: /usr/local/searchindex/index/index/_107ei.fnm (No
such file or directory)" from clients trying to search the index. i'm
assuming this is because the reader is trying to read files while the
writer is changing them; but i was under the impression Lucene created
read/write locks to prevent this happening. do i need to do something
special to make the locks work for reading as well? or should i handle
this some other way? (the index is accessed as single writer/multiple
reader).

secondly, the existing MySQL-based search returns documents in alphabetical
order by title, instead of by relevance. i'd like to replicate this
behaviour for the (few) people who prefer the existing system; however, i'm
not sure how to do it efficiently. i see i can pass my own HitCollector to
search(), and then retrieve the document's title and sort by title myself.
however, HitCollector.collect() says "For good search performance,
implementations of this method should not call Searchable.doc(int) or
IndexReader.document(int) on every document number encountered."

so - is there another way to affect the order? it certainly does seem
inefficient to retrieve the entire document, when i only need the title
field from it.

thanks,
k.

Search Discussions

  • Chris Hostetter at Jan 28, 2006 at 8:02 am
    : secondly, the existing MySQL-based search returns documents in alphabetical
    : order by title, instead of by relevance. i'd like to replicate this
    : behaviour for the (few) people who prefer the existing system; however, i'm
    : not sure how to do it efficiently. i see i can pass my own HitCollector to

    You don't need to use a HitCollector just to sort by a field, take a look
    at the Search.search(Query,Sort) method instead.

    Pay special attention to the javadocs for the Sort class. You can only
    sort of fields which are indexed in a specific way...

    http://lucene.apache.org/java/docs/api/org/apache/lucene/search/Searcher.html#search(org.apache.lucene.search.Query,
    org.apache.lucene.search.Sort)

    http://lucene.apache.org/java/docs/api/org/apache/lucene/search/Sort.html



    -Hoss


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Kate at Jan 28, 2006 at 10:19 am

    Chris Hostetter:
    You don't need to use a HitCollector just to sort by a field, take a
    look at the Search.search(Query,Sort) method instead.
    thanks - this is exactly what i needed.

    k.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedJan 28, '06 at 7:46a
activeJan 28, '06 at 10:19a
posts3
users2
websitelucene.apache.org

2 users in discussion

Kate: 2 posts Chris Hostetter: 1 post

People

Translate

site design / logo © 2022 Grokbase