Gravatar for diego.moretto@xcentium.com

Question by Diego, Aug 19, 2015 5:08 PM

Problem with "contains" not bringing results correctly

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

3 Replies
Gravatar for slangevin@coveo.com

Answer by Simon, Oct 28, 2015 6:33 PM

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.

Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Aug 19, 2015 5: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

Gravatar for diego.moretto@xcentium.com

Comment by Diego, Aug 20, 2015 10:17 AM

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

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Aug 20, 2015 12:52 PM

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".

Gravatar for diego.moretto@xcentium.com

Comment by Diego, Aug 20, 2015 1:15 PM

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

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Aug 20, 2015 1:23 PM

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?

Gravatar for diego.moretto@xcentium.com

Comment by Diego, Aug 20, 2015 2:23 PM

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.

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Aug 20, 2015 3:37 PM

Can you copy/paste me your exact <fieldType fieldName="_path" ... /> configuration element please? I would like to check for typos or problems in it. Thanks

Gravatar for diego.moretto@xcentium.com

Comment by Diego, Aug 20, 2015 4:59 PM

any other ideas?

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Aug 20, 2015 5:19 PM

Unfortunately, I don't have any other idea. I suggest you to contact Coveo Support with that issue. They will need:

  • A copy of your Coveo related Sitecore configuration files.
  • An output of the ShowConfig.aspx page.
  • Your CES System logs.
  • Your Sitecore logs.
  • A screenshot of the "@fz95xpath42373" field in your CES field set.

Thanks

Gravatar for diego.moretto@xcentium.com

Comment by Diego, Aug 21, 2015 1:12 PM

This is what I have

<fieldType fieldName="_path" isFacet="false" isMultiValue="true" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />

can you confirm it´s correct please?

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Aug 21, 2015 1:49 PM

Yes, that seems to be correct. Go ahead contacting Coveo Support.

Gravatar for chris.ruderschmidt@americaneagle.com

Answer by Chris Ruderschmidt, Aug 26, 2015 3: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!

Ask a question