研究lucene几天了,今天终于在网上找打亲测可行的多域搜索方法了
//定义一个数组,内容是需要查找的域
String[] fields = {"title","content"};
//创建QueryParser
QueryParser parser = new MultiFieldQueryParser(Version.LUCENE_30, fields,analyzer);
Query query = parser.parse(searchKey);
资源来自:[url]http://www.cnblogs.com/bluepoint2009/archive/2012/10/07/lucene-QueryParser.html#QueryParser-MultiFieldQueryParser[/url]
//定义一个数组,内容是需要查找的域
String[] fields = {"title","content"};
//创建QueryParser
QueryParser parser = new MultiFieldQueryParser(Version.LUCENE_30, fields,analyzer);
Query query = parser.parse(searchKey);
资源来自:[url]http://www.cnblogs.com/bluepoint2009/archive/2012/10/07/lucene-QueryParser.html#QueryParser-MultiFieldQueryParser[/url]