0
votes

I would like for my user to be able to enter into the search box something like "word1 word2" and receive only documents with word1 directly before word2. Even better would be to take advantage of Solr's other capabilities, like:

  • title:"word1 word2"
  • text:(word1 OR word2)
  • "word1 word2"~5

My current SQS is set up like this: searchqueryset = SearchQuerySet().filter(content=AltParser('edismax', Raw(query), pf="title^1.5 text^1"))

And I think that, despite using Raw, things are still being escaped (based on the results I'm getting).

Let me know if any more information would be helpful.

Thanks! Jake

1
Are you escaping the space between the two words?JHS
What do you mean by escaping? Do you mean turning spaces into "%20"?Jake
Could you show us the analyzer on the field?JHS

1 Answers

0
votes

I am guessing that you have a WhiteSpaceTokenizer in the field(s) you are looking against.

Try querying for "word1 word2" - this will not escape the whitespace and treat the phrase as different words.

Alternatively, you could not use WhiteSpaceTokenizer but that will limit your search capability to Exact Match - which is probably not enough for all the scenarios.