问题描述
stringindexPath=Context.Server.MapPath("~/IndexData");stringfield="content";FSDirectorydirectory=FSDirectory.Open(newDirectoryInfo(indexPath),newNoLockFactory());IndexReaderreader=IndexReader.Open(directory,true);IndexSearchersearcher=newIndexSearcher(reader);//////BooleanQuerybooleanquery=newBooleanQuery();varver=Lucene.Net.Util.Version.LUCENE_29;Analyzeranalyzer=newStandardAnalyzer(ver);MultiFieldQueryParserparser=newMultiFieldQueryParser(ver,newstring[]{field},analyzer);stringkeyword="客户";Queryquery2=parser.Parse(keyword);TopScoreDocCollectorcollector=TopScoreDocCollector.Create(1000,true);searcher.Search(booleanquery,null,collector);ScoreDoc[]docs=collector.TopDocs(0,collector.TotalHits).ScoreDocs;
解决方案
解决方案二:
时间: 2024-11-05 12:16:38