You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by Idan Gazit <id...@fastmail.fm> on 2006/08/27 14:58:30 UTC

Bug in IndexSearcher creation?

Hi there,

[This was originally posted to lucene-net-user, however it contains a 
bug report, so I'm reposting to dev in the hopes that it reaches the 
right eyes. :)]

I'm using Lucene.Net 1.9.0.5 (1.9 Final, r005, whatever), and I think
I've identified some incorrect behavior -- I'm looking to run it by
everybody to make sure I'm not wrong, and to ask about workarounds for
the time being.

Basically the story is as follows: if I attempt to open an IndexSearcher
on a directory which has a very-freshly-created index (i.e. segments
file but nothing else), I get an apparently-fine IndexSearcher without
an exception.

The problem arises when I try to search for something using this
IndexSearcher -- it still doesn't throw any exceptions but all searches
return zero hits. This behavior persists even after segments are
eventually added and written to disk, et cetera. Basically I have a
searcher that appears valid but always returns zero hits.


Right now my application creates the index on boot, and lazily
instantiates the searcher when the first query is made. If somebody can
suggest a good way of determining via lucene whether or not segments
have been written to disk I would be very grateful. :) The plan brewing
in my head now is checking for the presence of a "deletable" file where
the index is located, and refusing to perform the query (i.e.
instantiate the IndexSearcher) without it.

Another possibility is for IndexSearcher to be smart enough to try 
"reinitializing" itself when queries are performed if the IndexSearcher 
was created on an empty index.

Thanks one and all for suggestions!

-Idan