简体   繁体   中英

Lucene 4.0 getFieldInfos

I am pretty much trying to do this on lucene4.0 (java): How to incorporate multiple fields in QueryParser?

Though I'd like to search on all fields (all are not present on all documents) and I don't know their names. So here I found:

QueryParser queryParser = new MultiFieldQueryParser(Version.LUCENE_29, ir.GetFieldNames(IndexReader.FieldOption.ALL).toArray(), analyzer)

Though getfieldNames() has been replace in 4.0 by " LUCENE-3679 Replace IndexReader.getFieldNames with IndexReader.getFieldInfos ".

However, the problem is that getFieldNames or any getField* is defined in IndexReader .

I have been looking online for ages for a solution. What am I missing and how can I do this?

FieldInfos are only available on AtomicReader . You can get a FieldInfos view on a composite reader by calling MultiFields.getMergedFieldInfos .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM