This is a small gotcha in multilist with search field type introduced in Sitecore 7.0.
There are two ways to pass a pre-filter (i.e. the datasource) in the field definition:
- Regular querystring parameters
- Lucene query
There are certain rules that apply for the querystring passed as datasource:
- the querystring parameter StartSearchLocation must be present, and its value must be a valid ID, e.g.
- The lucene query part must go into a querystring parameter called "Filter"
- The lucene query part cannot contain spaces. Instead a pipe character ("|") is used to split the various parts, e.g.
- As per this blog post, the _templatename lucene query parameter must NOT be preceded by a "+" sign.
What I've found out, is that you should not have duplication between the "querystring" part and the Lucene query part, as of 7.2. That is, the following would function "normally" in 7.0:
Notice that the querystring parameters correspond 1-1 to the lucene query parts. The actual query has 3 parameters:
- _path (StartSearchLocation)
- _template (TemplateFilter)
- _parsedlanguage (Language)
However, in Sitecore 7.2, the above datasource string does not work properly. When the field first loads, it shows up properly, with all the relevant items displayed on the left ("All") pane. However, if you try a search, the ajax requests that run to fetch the filtered data return an empty result without reporting any error.
To amend this, I chose to keep only the "querystring" part, discarding the "Filter" part altogether, since I could, based on the actual query. If the query was more involved, I might have to have kept the "Filter" parameter and made sure that the two parts don't overlap at all. So, the actual working query is:
It is rather strange though, I'd expect that if you have a list, and you filter it, and then you re-apply the filter on the same list, you'd get the same filtered list again, not an empty set.