Solr AnalyticsQuery API returns analytics by documents that don't match query -
solr analyticsquery api returns analytics documents don't match query.
i have core named 'documents' in solr. there fields 'id', 'url', 'text', 'domain'. have resourceanalyticscollector counts how many documents belongs each resource. example of result of resource analytics is:
resources:{
- example.com: 456
- example2.com: 123
- ...
}
first time found problem when query 1 domain analytics returned result few domains.
example:
solr query: domain:example.com
number of documents returned query: 1000(all documents belongs example.com)
analytics result:
resources:{
- example.com: 700
- example2.com: 100
- example3.com: 100
- example4.com: 100
}
i looked documents /select
search handler , of documents belonged example.com
domain.
but when looked in analytics documents, have found there many documents don't match query. number of documents same.
here analytics module:
public class resourceanalyticscollector extends delegatingcollector{ public resourceanalyticscollector(responsebuilder rb, indexsearcher searcher) { this.rb = rb; this.searcher = searcher; } @override public void collect(int docnum){ document doc; doc = searcher.doc(docnum); //output document id logs string docid = doc.get(analyticsconstants.id_solr_field); system.out.println("doc id = " + docid); documentlist.add(doc); delegate.collect(docnum); } @override public void finish(){ rb.rsp.add(total_result_field, this.getanalyticscontext(documentlist)); }
i think bug of solr. if me problem, great!
i have create mini version of analytics, core. name of file "analytics_api_problem.rar". can download these link
i guess need use query &fq={!myanalytic param1=a param2=b cost=101}
Comments
Post a Comment