Thursday, November 10, 2016

Don’t be afraid of spaces in your query templates

image

I was talking to Andrew Clark and he was pretty frustrated after debugging a search issue. Turned out the query template was written like this:

{searchTerms}path:http://intranet.contoso.com/sales

Notice the lack of a space between {searchTerms} and path. So when adding query variables, throw in some spaces and you can cut a lot of frustration when debugging. If not the the last query term will have path appended to it as part of the term like: foopath:http://intranet.contoso.com/sales instead of foo path:http://intranet.contoso.com/sales 

The right syntax is:

{searchTerms} path:http://intranet.contoso.com/sales