问题
I want to show the words stored in Lucene index so that user can select the word and get corresponding documents. I am new to Lucene. Any help is appreciated.
回答1:
The issue is that there is no magic getAllStoredFields() function in Lucene. Lucene stores fields in documents which are then stored in an index, every document in the index can have different fields containing stored fields. You need to retrieve one specific document Like:
Document doc = indexReader.document(docNum); and call doc.getFields(). Then iterate over them and checking field.isStored()
来源:https://stackoverflow.com/questions/51585052/get-all-stored-fields-from-lucene-index-using-java