MultiField.getFields equivalent in Lucene 8?

Viewed 178

I am using Lucene 8.10.1. I have the following code :

IndexReader reader = DirectoryReader.open(FSDirectory.open(Paths.get(index)));
try
{
      Fields fields = MultiFields.getFields(reader);
      for (String termfield : fields) {
        Terms terms = fields.terms(termfield);
        TermsEnum termsEnum = terms.iterator(null);
        int count = 0;
        while (termsEnum.next() != null) {
          count++;
        }
        System.out.println(count);
      }
    }

But I am running into this error.

java: cannot find symbol
  symbol:   method getFields(org.apache.lucene.index.IndexReader)
  location: class org.apache.lucene.index.MultiFields

Couldn't find anything in the docs of 8.10.1. Please help! Thank you!

0 Answers
Related