With Lucene 4, you can now create IntField, LongField, FloatField or DoubleField like this:
document.add(new IntField("id", 6, Field.Store.NO)); To write the document once you modified it, it's still:
indexWriter.updateDocument(new Term("pk", "<pk value>"), document); EDIT: And here is a way to make a query including this numeric field:
Read full article from java - Lucene 4.0 IndexWriter updateDocument for Numeric Term - Stack Overflow
No comments:
Post a Comment