在lucene中搜索更短索引的时间更长
我在实验室用Lucene做实验。我制作了4个索引(独立索引),其中一个索引只有在lucene中搜索更短索引的时间更长,lucene,information-retrieval,Lucene,Information Retrieval,我在实验室用Lucene做实验。我制作了4个索引(独立索引),其中一个索引只有标题,而另一个索引有摘要,另一个索引有主题。最后一个具有所有字段 现在我发现只使用标题的索引的搜索时间比其他3个索引的搜索时间要长得多。这似乎与直觉相反,因为与其他索引相比,索引的大小很小。可能的原因是什么 下面是我用于基准测试的代码 public class PrecisionRecall { public static void main(String[] args) throws Throwable { Fi
标题
,而另一个索引有摘要
,另一个索引有主题
。最后一个具有所有字段
现在我发现只使用标题的索引的搜索时间比其他3个索引的搜索时间要长得多。这似乎与直觉相反,因为与其他索引相比,索引的大小很小。可能的原因是什么
下面是我用于基准测试的代码
public class PrecisionRecall {
public static void main(String[] args) throws Throwable {
File topicsFile = new File("C:/Users/Raden/Documents/lucene/LuceneHibernate/LIA/lia2e/src/lia/benchmark/topics.txt");
File qrelsFile = new File("C:/Users/Raden/Documents/lucene/LuceneHibernate/LIA/lia2e/src/lia/benchmark/qrels.txt");
Directory dir = FSDirectory.open(new File("C:/Users/Raden/Documents/myindex"));
Searcher searcher = new IndexSearcher(dir, true);
String docNameField = "filename";
PrintWriter logger = new PrintWriter(System.out, true);
TrecTopicsReader qReader = new TrecTopicsReader(); //#1
QualityQuery qqs[] = qReader.readQueries( //#1
new BufferedReader(new FileReader(topicsFile))); //#1
Judge judge = new TrecJudge(new BufferedReader( //#2
new FileReader(qrelsFile))); //#2
judge.validateData(qqs, logger); //#3
QualityQueryParser qqParser = new SimpleQQParser("title", "contents"); //#4
QualityBenchmark qrun = new QualityBenchmark(qqs, qqParser, searcher, docNameField);
SubmissionReport submitLog = null;
QualityStats stats[] = qrun.execute(judge, //#5
submitLog, logger);
QualityStats avg = QualityStats.average(stats); //#6
avg.log("SUMMARY",2,logger, " ");
dir.close();
}
}
查询的响应时间不取决于索引大小。这取决于查询中的点击数和术语数 这是因为您不必读取所有索引数据。您只需要阅读查询条件的文档列表