When we enter keywords, we hope to support filtering multiple fields, so that the coverage of the search content will be larger.
The MultiFieldQueryParser class is mainly used to match multiple fields.
QueryParser parser=new QueryParser("content",analyzer);
Query query =parser.parse(kw);
String[] fields={"title","content"};
MultiFieldQueryParser parser=new MultiFieldQueryParser(fields,analyzer); parser.parse(keywords,fields,analyzer);
The above is the detailed content of Lucene practice--detailed explanation of keyword matching multiple fields. For more information, please follow other related articles on the PHP Chinese website!