0
votes

I have a fairly simple index where all 10 or so fields are searchable strings and my searchMode is "all".

For sake of simplicity let's say I issue the following search: -(x|y|z) And I get all documents that do not have x, y or z in them.

Let's say I issue the following search: (i+j) And I get all docs that contain the terms i and j.

And lets say there is a decent overlap between the docs that are returned by the two searches.

I would have thought that in "all" searchMode if I issue the following: (i+j) -(x|y|z)

I would receive the subset of i and j that do not contain x, y or z. In other words the results of the combined query would not contain any entries from the results of the individual query -(x|y|z).

But that's not the case.

Either I am misunderstanding the functionality or I am receiving wrong results.

Can someone help explain this to me?

Thanks

1
Before we explore further, let me ask a quick question: are you escaping + in requests? + is often unescaped as a space by URL handling stacks. You should have %2B instead of + in the search string (more in general, you should make sure you URL-escape search input). - Pablo Castro
Pablo - you were correct - in fact with an intermediate service you have to do it once from the ui to get the search string exactly to your wrapper web service and then do it again for the actual azure search end point. It's all working as I thought it should now. Thank you very much - t316
Great to hear it worked. I captured it as an answer below for others that might run into this in the future. - Pablo Castro

1 Answers

0
votes

Azure Search should give consistent answers for this, if not let us know.

In this case it was an issue with escaping "+" in URLs (see comments). Search text in the URL query string needs to be escaped (e.g. + should show up as %2B, but it's best to use a library function to escape all the input search text instead of special-casing any particular character; there's functions for this in most environments and they know which characters need escaping).