Search in sources :

Example 1 with MultiTerms

use of org.apache.lucene.index.MultiTerms in project neo4j by neo4j.

the class PartitionedUniquenessVerifier method termsForField.

private Terms termsForField(String fieldName) throws IOException {
    List<Terms> terms = new ArrayList<>();
    List<ReaderSlice> readerSlices = new ArrayList<>();
    List<LeafReader> leafReaders = allLeafReaders();
    for (LeafReader leafReader : leafReaders) {
        Terms leafTerms = leafReader.terms(fieldName);
        if (leafTerms != null) {
            ReaderSlice readerSlice = new ReaderSlice(0, Math.toIntExact(leafTerms.size()), 0);
            terms.add(leafTerms);
            readerSlices.add(readerSlice);
        }
    }
    Terms[] termsArray = terms.toArray(new Terms[0]);
    ReaderSlice[] readerSlicesArray = readerSlices.toArray(new ReaderSlice[0]);
    return new MultiTerms(termsArray, readerSlicesArray);
}
Also used : LeafReader(org.apache.lucene.index.LeafReader) MultiTerms(org.apache.lucene.index.MultiTerms) Terms(org.apache.lucene.index.Terms) MultiTerms(org.apache.lucene.index.MultiTerms) ArrayList(java.util.ArrayList) ReaderSlice(org.apache.lucene.index.ReaderSlice)

Aggregations

ArrayList (java.util.ArrayList)1 LeafReader (org.apache.lucene.index.LeafReader)1 MultiTerms (org.apache.lucene.index.MultiTerms)1 ReaderSlice (org.apache.lucene.index.ReaderSlice)1 Terms (org.apache.lucene.index.Terms)1