Hi Everyone--
So I'm not quite sure what is going on with my Lucene index, but I'm
having some issues searching. I've created a simple little index of 10
documents as follows:
id: 1
type: Article
content: <<some content>>
....
id: 10
type: Article
content: <<other content>>
So I created a simple TermQuery for starters that would pull back all of
my Article types:
BooleanQuery bq = new BooleanQuery();
bq.add(new TermQuery(new Term(FIELD_TYPE, "Article")), Occur.MUST);
I realize that I could simply do a TermQuery, but I want to be able to
add additional content constraints after I get this working. So here is
where my confusion comes in:
If I run the query against my IndexSearcher, I get 0 results; however,
if I run it as a delete on the IndexWriter, I can open it in Luke and
see the entire index deleted. So why would the writer be finding
documents and the searcher wouldn't? As a note, whenever I am adding
documents, I am calling reopen() on the reader. Here is how I'm
creating the writer/reader/searcher:
KeywordAnalyzer ka = new KeywordAnalyzer();
analyzer.addAnalyzer(FIELD_ID, ka);
analyzer.addAnalyzer(FIELD_TYPE, ka);
analyzer.addAnalyzer(FIELD_CONTENT, contentAnalyser);
indexWriter = new IndexWriter(directory, analyzer, true,
MaxFieldLength.UNLIMITED);
indexReader = IndexReader.open(directory);
indexSearcher = new IndexSearcher(indexReader);
Any thoughts? Thanks so much for all the help!
-Eric LeVin
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org