EPiServer Commerce 9.23 LuceneSearchProvider BuildQuery method broken


Hello Guys,

In EPiServer Commerce 9.21 I could search with this search query and get hits:


This no longer gets any hits. After some testing it seems I cannot get ANY query to work unless I get a match on the default field(s).

This query gives no hits either:

((itemnumber:0101101* OR itemnumberus:0101101* OR itemnumberalternative:0101101*)) OR ((name:0101101* OR displaydescription:0101101*))

This is the only query that still gives hits (uses all default search field(s)):


I have tested with EPiServer Commerce 9.21 in where all of this still works. In EPiServer Commerce 9.23 it's broken.

I can see with BitDiffer that Mediachase.Search.Providers.Lucene.LuceneQueryBuilder.BuildQuery has had it's implementation changed between these versions. I'm pretty sure this is the source of the problem.

Edit: This also works in 9.22.0 and 9.22.1. 9.22.1 -> 9.23.0 is when this broke.

Edited, Sep 30, 2016 16:13

I guess you don't want decompiled code posted here but I can see that version 9.23.0 is doing QueryParser.Escape on the searchPhrase, which 9.21.0 is not. This is probably part of the problem.

This is when NOT using IsFuzzySearch. IsFuzzySearch = false when this error occurs. So one of the 5 lines of code in that branch of buildQuery is breaking my search.

Sep 30, 2016 16:20

QueryParser.Escape will escape all of the following characters:

+ - && || ! ( ) { } [ ] ^ " ~ * ? : \ /

As you can see my query contains lots of ":". These should not be escaped here. Escaping the entire query is incorrect. That's why it only works to search on the default field(s) now. Since you cannot specify fields like this "fieldName:valueToSearchFor" and values you are looking for in them anymore. If you want to run QueryParser.Escape you have to run it ONLY on valueToSearchFor. Not the full query. This is probably something your customers will have to handle themselves. Not something EPiServer should be trying to do for us.

Conclusion: In EPiServer Commerce 9.23+ you cannot search for values in specific fields. Since you are unable to build queries like that anymore.

Edited, Sep 30, 2016 16:48
<p>It seems to be caused by a fix included in 9.23. New bug COM-2925 reported. Thanks for the detailed report!</p>
Oct 01, 2016 9:20
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.