2013-02-21 44 views
1

我索引了10个网站的索引数据。现在我想用下面的格式来转储每个网站的数据:[术语,术语的频率在该网站,IDF,网站]如何检索所有与他们的网站频率

e.g : [management,12,145,example.com] 
where 12 is a frequency of term in example.com, 145 is IDF of term in index. 

我能做到这一点使用Solr和如何?

+0

非常感谢大家的回复:我已经使用方面查询完成了该操作。其中q = *:*和fq = host:myhost.com,facet = true,facet.field = content,facet.limit = 5000000 – user1834873 2013-03-01 07:16:28

回答

1

如果您希望测量文档中不同术语的分布情况,那么直方图就是您想要的。检查LukeRequestHandler的例子。

0

一些低级别的API:

InderReader reader = IndexReader.open(directory); 
TermDocs termDocs = reader.termDocs(); 
// TermDocs termDocs = reader.termDocs(term); // if you need docs containing specific term 
while (termDocs.next()) { 
    System.out.println("DoC#: " + termDocs.doc()); 
    System.out.println("Full document: " + reader.document(termDocs.doc())); 
    System.out.println("Term frequency: " + termDocs.freq());   
} 

的TF * IDF看DefaultSimilaritythis question了一些意见。