Hi folks
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. The problem here is I'm trying to filter a few items in sitecore based on Guids. The problem is that this query does not any result while if I change the last clause to "=" instead of "==" it brings the results I expect.
(@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?
thanks
Answer by Chris Ruderschmidt · Aug 26, 2015 at 03:50 PM
I've also ran into this.
ContainsKeyword is what worked for me:
x["_path"].ContainsKeyword(searchContext.Guids.First())
To use it, make sure that you include Coveo.SearchProvider.LinqBase in your project.
Hope this helps!
Answer by Jean-François L'Heureux · Aug 19, 2015 at 05:49 PM
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
So I have running Coveo for Sitecore April 2015 release here and when I opened coveo.searchprovider I found:
<fieldType fieldName="_path" isFacet="true" isMultiValue="true" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />
which is pretty much what is requested to do if that is not the case right?
I have already rebuilt the whole indexes but that still happens. Any other ideas I could try?
thanks
This is weird. Can you validate the @fz95xpath42373
field is really configured as a multi-value facet field in the appropriate CES field set (CES Admin Tool > Configuration > Fields > Your field set > Ctrl+F: "fz95xpath42373").
The first (Field Queries), fourth (Multi-Value Facet) and sixth (Display Field) checkboxes should be checked. The Type should be "String" and the "Metadata Name" should be "_path".
hey
so the checkbox for I multi-value facet is grayed out and unchecked. I tried rebuilding the indexes doing a full rebuild but it still remains the same. But as I said the configs on coveo.searchprovider do have isFacet="true" isMultiValue="true" set
Can you check the Sitecore logs AND the CES System logs during the period where you did your last rebuild of the indexes? It can contains errors that could explain why the field wasn't updated in the field sets.
Also, since the "Multi-Value Field" is grayed out and unchecked, is the "Facet" checkbox checked for that field? If that's the case, could you please put isFacet="false" and keep isMultiValue="true" in the config for that field?
hi yes the facet is checked. I rebuilt after settin the isfacet to false but it still shows it as checked on the admin tool. Sitecore logs don´t show any errors. I don´t see anything on the ces logs that could explain why this is happening.