2

I am using pysolr 3.1.0 to interface queries with the solr server. I am able to get the list of the search term entered. But I am not able to find an exact match.

I am using the below command

results = solr.search(packagename, rows=5000)

Any idea what changes I have to do in the query for exact match?

2 Answers2

3

The issue with the query was that I had not mentioned the field or id in which the search was to be executed.

The query should be something like this

results = solr.search(' id:"searchstring" ')

0

Use quotes

results = solr.search('package name', rows=50)

Add double quotes to query keyword to work for exact match

results = solr.search('"package name"', rows=50)

Vinod
  • 1,965
  • 1
  • 9
  • 18
  • In python console check wt it returns for len(results) `print len(results) ` and crosscheck in solr admin for q="package name" how many results you getting – Vinod Jun 29 '17 at 11:25
  • Yes, i have verified my result , it works if i run a query with normal curl command and set indent=true. But solr.search option is not working – Anuja Jakhade Jun 29 '17 at 11:30
  • does it returns any error for this statement `results = solr.search(packagename, rows=5000)` – Vinod Jun 29 '17 at 11:33
  • No, it does not return any error. But I don't get exact match in the results. – Anuja Jakhade Jun 29 '17 at 12:09