0
|
1 '''
|
|
2 Created on 11.02.2013
|
|
3
|
|
4 @author: dwinter
|
|
5 '''
|
|
6
|
|
7 import sunburnt
|
|
8 import httplib
|
|
9
|
|
10 class TestSolr:
|
|
11
|
|
12 solr = None
|
|
13 def __init__(self):
|
|
14 self.solr=sunburnt.SolrInterface(url="http://127.0.0.1:8983/solr/mpiwgweb")
|
|
15
|
|
16 if __name__ == '__main__':
|
|
17
|
|
18 sl = TestSolr()
|
|
19
|
|
20 #params={facet=true&facet.field=description&facet.field=main_content&start=0&q=main_content:knowledge+AND+renn+AND+description:*+AND+main_content:*&rows=10} hits=113 status=0 QTime=66
|
|
21
|
|
22 x= {"qt":"tvrh","tv":"on","fl":"main_content","tv.tf":True}
|
|
23
|
|
24 fq = sl.solr.query(urlNorm="http://127.0.0.1:18080/www_neu/en/news/features/feature25",**x).facet_by("main_content")
|
|
25 x = fq.execute()
|
|
26
|
|
27 #http://localhost:8983/solr/mpiwgweb/select?q=*%3A*&wt=xml&tv=on&qt=tvrh&fl=main_content&tv.tf=true
|
|
28 #http://localhost:8983/solr/mpiwgweb/select?q=*%3A*&wt=json&tv=on&qt=tvrh&fl=main_content&tv.tf=true
|
|
29 print x.facet_counts.facet_fields['main_content']
|
|
30 |