iamvijay
iamvijay

Reputation: 21

Unable to match full name with spaces in Solr

Here is the schema.xml

<field indexed="true" multiValued="false" name="name"type="StrField"/>

Here is the URL I am using to search

/solr/mycore/select?q=name:John Smith&fl=\*&wt=json&indent=true

Here's the error:

Status 400
msg:no field name specified in query and no default specified via 'df' param

However, I am able to use "name:John*" to get all the names starting with John. I understand this has something to do with tokenization but not sure what I need to change. The space between the first name and last name is causing some issue with exact match.

The StrField is a specific implementation of the "string" so that is not where the issue is as per my undestanding

Any help would be appreciated

Upvotes: 0

Views: 139

Answers (1)

Erick Ramirez
Erick Ramirez

Reputation: 16323

The issue is that you have included a space character ( ) in the URL.

You need to encode it for HTTP API access with %20 so it should look like:

/solr/mycore/select?q=name:John%20Smith&fl=\*&wt=json&indent=true

If you're new to Apache Solr, I recommend you try performing searches using the Solr Admin UI to familiarise yourself with how it works. Cheers!

Upvotes: 0

Related Questions