标签:style blog ar java sp for 文件 on 2014
常用类简介ScoreDoc 中的score属性表示相关程度,取值范围[0,1],越大越相关。
概览:
Directory directory=FSDirectory.open(new File("filePath")); IndexReader reader=DirectoryReader.open(directory); IndexSearcher searcher=new IndexSearcher(reader); Analyzer analyzer=new StandardAnalyzer(); Term term=new Term("field","content"); Query query=new TermQuery(term); TopDocs topDocs=searcher.search(query, 10); ScoreDoc[] hits=topDocs.scoreDocs; for(ScoreDoc hit :hits){ System.out.println(hit.doc+hit.score); }
标签:style blog ar java sp for 文件 on 2014
原文地址:http://blog.csdn.net/chuchus/article/details/40923939