Get all stored fields from lucene index using java

十年热恋 提交于 2021-01-28 11:37:42

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!