Hi,
I wrote a simple code to update a lucene document with new values.
Code Snippet:
Term term = new Term("PRODUCT_CODE", productCode);
TermQuery query = new TermQuery(term);
TopDocs productDoc = this.searcher.search(query, 1);
int docNum = scoreDoc.doc;
Document doc = searcher.getIndexReader().document(docNum);
doc.removeField("PRICE");
doc.add(new LongField("PRICE", Long.valueOf(price), Field.Store.YES));
this.writer.updateDocument(term, doc);
As per docs, updateDocument would delete the existing document and
create a new document. This works as expected.
Problem is if I search by product code then I am able to find the
document in luke. But If I apply BoolanQuery with RangeQuery, product
code and few other queries then this document is not found.
I am using Lucene 4.4 version with Faceted Search.