How can I retrieve non-stored Lucene field values?
When searching, only stored fields are returned from a search. For debugging reasons, I need to see the unstored fields, too. Is there开发者_运维问答 a way via the API?
Thanks!
P.S.: I know Luke, unfortunately I can't use it in my case.
If the unstored fields were stored… they'd be called stored fields, right?
For unstored fields, all you can see are the tokenized keywords as they were indexed, and that requires un-inverting the inverted index. Using the IndexReader
API, you can enumerate all of the unique terms in a particular field. Then, for each term, you can enumerate the documents that contain the term. This tells you roughly the value of specified field of a given document.
Depending on the analysis performed on the field during indexing, this may allow you to reconstruct the original field exactly, or merely give you an rough idea of what it may have contained.
精彩评论