Use MultiFieldQueryParserits QueryParser, which creates queries to search for multiple fields. .
Another way is to use Create BooleanQuery consisting of TermQurey (in your case, a query phrase).
The third way is to include the contents of other fields in the content field default.
Add. , , , , .
:
Query query = MultiFieldQueryParser.parse(Version.LUCENE_30, new String[] {"harry potter","harry potter","harry potter"}, new String[] {"title","author","content"},new SimpleAnalyzer());
IndexSearcher searcher = new IndexSearcher(...);
Hits hits = searcher.search(query);
MultiFieldQueryParser : (. javadoc)
, . x :
(field1: query1) (field2: query2) (Field3: query3)... (fieldx: queryx)
, .