|
|
|
|
|
|
|
|
solrurl = 'http://' + solr_hostname + ':' + solr_port + '/solr/' + core + '/select?q.op=OR&q=id%3A"' + id + '"&wt=json' |
|
|
solrurl = 'http://' + solr_hostname + ':' + solr_port + '/solr/' + core + '/select?q.op=OR&q=id%3A"' + id + '"&wt=json' |
|
|
else: |
|
|
else: |
|
|
if (sort == 'relevance'): |
|
|
if (sort == 'relevance'): |
|
|
solrurl = 'http://' + solr_hostname + ':' + solr_port + '/solr/' + core + '/select?q.op=OR&q=content%3A' + urllib.parse.quote_plus(search) + '&wt=json' |
|
|
|
|
|
|
|
|
solrurl = 'http://' + solr_hostname + ':' + solr_port + '/solr/' + core + '/select?q.op=OR&q=content%3A' + urllib.parse.quote_plus(search) + '&wt=json&facet.field=country&facet.field=year&facet.sort=count&facet=true' |
|
|
else: |
|
|
else: |
|
|
solrurl = 'http://' + solr_hostname + ':' + solr_port + '/solr/' + core + '/select?q.op=OR&q=content%3A' + urllib.parse.quote_plus(search) + '&wt=json&sort=' + sort |
|
|
|
|
|
|
|
|
solrurl = 'http://' + solr_hostname + ':' + solr_port + '/solr/' + core + '/select?q.op=OR&q=content%3A' + urllib.parse.quote_plus(search) + '&wt=json&sort=' + sort + '&facet.field=country&facet.field=year&facet.sort=count&facet=true' |
|
|
|
|
|
|
|
|
# get result |
|
|
# get result |
|
|
request = requests.get(solrurl) |
|
|
request = requests.get(solrurl) |
|
|
|
|
|
|
|
|
# parse result |
|
|
# parse result |
|
|
result_output = parse_result(id, content) |
|
|
result_output = parse_result(id, content) |
|
|
output.append(result_output) |
|
|
output.append(result_output) |
|
|
return output, num_found |
|
|
|
|
|
|
|
|
country_facet = json['facet_counts']['facet_fields']['country'] |
|
|
|
|
|
year_facet = json['facet_counts']['facet_fields']['year'] |
|
|
|
|
|
return output, num_found, country_facet, year_facet |
|
|
|
|
|
|
|
|
def term_search(core, sort, field, input): |
|
|
def term_search(core, sort, field, input): |
|
|
|
|
|
|