Problem with "contains" not bringing results correctly
I am programatically querying the index and when I try to run the following code this is the expression I get:
queryable = queryable.Where(x => x.Paths.Contains(searchContext.Guids.First())); (@fz95xlanguage42373=="en") (@fz95xlatestversion42373=="1") ((@fz95xtemplate42373==8a5e96bbba914d70acfa4faa5904beea) OR (@fz95xtemplate42373==5dc97f87f62d47fdbae2961bb324bd65)) (@fz95xpath42373== 56b48f866b534bbaa66dc8732f9f7781)
queryable is an IQueryable
(@fz95xlanguage42373=="en") (@fz95xlatestversion42373=="1") ((@fz95xtemplate42373==8a5e96bbba914d70acfa4faa5904beea) OR (@fz95xtemplate42373==5dc97f87f62d47fdbae2961bb324bd65)) (@fz95xpath42373= 56b48f866b534bbaa66dc8732f9f7781)
This is the query I'm expecting to get but the contains method is generating with double == instead of just one which to me looks weird.
What am I missing here?
This issue was handled by Coveo Support and was due to a bug in April's 2015 build (7.0.7599). If you are using this build, please upgrade to an newer version.
In Coveo for Sitecore December 2014 release and newer, the
_path Sitecore field is indexed as a string multi-value facet field containing a semicolon list of short GUIDs to represent the item GUID and all its parent items GUIDs. e.g.: "11111111111111111111111111111111;0de95ae441ab4d019eb067441b7c2450;110d559fdea542ea9c1c8a5df7e70ef9;2ef80a8cf9c14d8b993b6fcef7b48b12".
Field queries with the "==" operator work on multi-value facet fields (e.g.:
@fz95xpath42373==110d559fdea542ea9c1c8a5df7e70ef9). However, they do not work on non multi-value facet fields without querying for the complete field value.
If you use an older Coveo for Sitecore release or you upgraded to the December 2014 or a newer release without following the manual upgrade steps, you could have the
_path field not configured as a multi-value facet field.
To configure the
_path field as a multi-value facet field, you can follow the step 3.b.ii.1 (Ensure the "_path" field is configured as a multi-value facet field) of this FAQ article: https://developers.coveo.com/display/SC201508/Slow+Queries+in+a+Coveo+Search+Page
I've also ran into this.
ContainsKeyword is what worked for me:
To use it, make sure that you include Coveo.SearchProvider.LinqBase in your project.
Hope this helps!