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
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.