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 <michael.wech...@wyona.com> wrote: > HI > > IIUC I can get all terms of a particular field of an index with > > IndexReader reader = DirectoryReader.open(„index_directory"); > List<LeafReaderContext> list = reader.leaves(); > for (LeafReaderContext lrc : list) { > Terms terms = lrc.reader().terms(„field_name"); > if (terms != null) { > TermsEnum termsEnum = terms.iterator(); > BytesRef term = null; > while ((term = termsEnum.next()) != null) { > System.out.println("Term: " + term.utf8ToString()); > } > } > } > reader.close(); > But how I can get all terms of a particular field of a particular document? > Thanks > Michael > > P.S.: Btw, does it make sense to update the Lucene FAQ > > https://cwiki.apache.org/confluence/display/lucene/lucenefaq#LuceneFAQ-HowdoIretrieveallthevaluesofaparticularfieldthatexistswithinanindex,acrossalldocuments > ? > with the code above? > I can do this, but want to make sure, that I don’t update it in a wrong > way. > > > > -- Sincerely yours Mikhail Khludnev