I'm new in Lucene and I would like to know if there is a way to search through all possible fields in multiple documents without knowing their names or... another approach: to get all field names (version 6.2.1)
For instance: How to get all names from 'fields' array and not to fill them like in example below
Analyzer analyzer = new StandardAnalyzer(); String querystr = "test"; String[] fields = {"title","isbn","desc", "name", "surname", "description"}; BooleanClause.Occur[] flags = new BooleanClause.Occur[fields.length]; Arrays.fill(flags, BooleanClause.Occur.SHOULD); Query query = MultiFieldQueryParser.parse(querystr, fields, flags, analyzer);
I have already checked those topics:
a) How to search across all the fields?
We have implemented this answer:
1) Index-time approach: Use a catch-all field. This is nothing but appending all the text from all the fields (total text from your input doc) and place that resulting huge text in a single field. You've to add an additional field while indexing to act as a catch-all field.
but we would like to change it if there is possibility
c) IndexReader.getFieldNames Lucene 4
but those solutions are not present in Lucene version 6.2.1
IndexReader.getFieldNames() (v. 3.3.0)
final AtomicReader reader = searcher.getAtomicReader();
final FieldInfos infos = reader.getFieldInfos(); (v. 4.2.1)
...or is there a method (not necessarily MultiFieldQueryParser) which provides search through all fields without their names (v. 6.2.1)?