Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put quotes around the query #20

Closed
wants to merge 1 commit into from

Conversation

ryanrolds
Copy link
Contributor

Was having issues with query that contained a space. Was unable to use the \ and other techniques. I may not be doing this corrcetly, please let me know.

@stevenferrer
Copy link
Owner

Was having issues with query that contained a space. Was unable to use the \ and other techniques. I may not be doing this corrcetly, please let me know.

Hmm, I can take a look, could you please open an issue with the details?

@ryanrolds
Copy link
Contributor Author

It looks like I'm hitting an issue where the standard parser is producing a JSON body with a query filed that Solr 9.6 doesn't like.

This works:

q := fmt.Sprintf("id:*%s*\ncommon_names:%s", input, input)
query := solr.NewQuery(q).Limit(MaxSearchResults)

This does not:

queryString := fmt.Sprintf("id:%s\ncommon_names:%s", input, input)
parser := solr.NewStandardQueryParser().
  Query(queryString).
  Op("OR").
  BuildParser()
query := solr.NewQuery(parser).Limit(MaxSearchResults)

@ryanrolds ryanrolds closed this May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants