FAQ
Hi All,

I am using Lucene 3.1 in the project.

*Background for the question:*
I am working on the application which starts with 2 threads, one performs
indexing activity and other performs searching activity (I create searcher
object from reader object). Both these threads run periodically and index or
search new documents if they are available.
My searcher searches a string in the lucene index using a BooleanQuery with
SHOULD clause.


*Problem:*
My problem is as follows:

As I see there are 2 ways to create indexReader (to create searcher)
A. indexWriter.getReader() --> to get near real time searching
or
B. Using directly the index directory path like indexReader =
IndexReader.open(NIOFSDirectory.open(new File(DIR_PATH)), true)

Now when the application starts, since there is no index created yet if I
use option "B" to create indexReader, I fail with IndexNotFoundException.
If I create IndexReader using option "A", I dont fail with exception but do
not get any result for my input which is ok since I dont have searchable
index yet.

My problem is, with option "A" of creating reader object, even after
indexing say 1000 documents and I still dont match any result. (The index
does have matching results. I can say that for sure because if I stop my
application, change the code to create reader using option B and then search
the same string on the newly created index of 1000 documents, I get lot of
matches.).

I am missing something due to which I am not getting any match for option A?
What am I doing wrong?


thanks

Saurabh

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 3 | next ›
Discussion Overview
groupjava-user @
categorieslucene
postedJul 20, '11 at 9:50p
activeJul 21, '11 at 1:14p
posts3
users3
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase