Re: How to get terms of a particular field of a particular document

2023-11-12 Thread Michael Wechner
Thanks again, whereas I think I have found now what I wanted (without needing the Highlighter): IndexReader reader = DirectoryReader.open(„index_directory"); log.info("Get terms of document ..."); TokenStream stream = TokenSources.getTokenStream(„field_name", null, text, analyzer, -1); stream.re

Re: How to get terms of a particular field of a particular document

2023-11-12 Thread Mikhail Khludnev
it's something over there https://github.com/apache/lucene/blob/4e2ce76b3e131ba92b7327a52460e6c4d92c5e33/lucene/highlighter/src/java/org/apache/lucene/search/highlight/Highlighter.java#L159 On Sun, Nov 12, 2023 at 11:42 PM Michael Wechner wrote: > Hi Mikhail > > Thank you very much for your fee

Re: How to get terms of a particular field of a particular document

2023-11-12 Thread Michael Wechner
Hi Mikhail Thank you very much for your feedback! I have found various examples for the first option when running a query, e.g. https://howtodoinjava.com/lucene/lucene-search-highlight-example/ but don't understand how to implement the second option, resp. how to get the extracted terms of

Re: How to get terms of a particular field of a particular document

2023-11-12 Thread Mikhail Khludnev
Hello, This is what highlighters do. There are two options: - index termVectors, obtain them in search time. - obtain the stored field value, analyse it again, get all terms. Good Luck On Sun, Nov 12, 2023 at 7:47 PM Michael Wechner wrote: > HI > > IIUC I can get all terms of a particular fie

How to get terms of a particular field of a particular document

2023-11-12 Thread Michael Wechner
HI IIUC I can get all terms of a particular field of an index with IndexReader reader = DirectoryReader.open(„index_directory"); List list = reader.leaves(); for (LeafReaderContext lrc : list) { Terms terms = lrc.reader().terms(„field_name"); if (terms != null) { TermsEnum termsEn