Gravatar for

Question by cpalmer, Apr 14, 2015 5:50 PM

Linq .Contains() method not working for "IEnumerable Paths;" in Sitecore

I'm attempting to filter my search results to descendants of the current page, however on my search query query.Where(s => s.Paths.Contains(rootId)); //where rootId is ID
I get back 0 results.

The coveo query generated looks like this (@fz95xpath20794==cf5a39a3fbc44cfc95ab12d1c82f1b03)

I tried writing a coveo query to return me results using (@fz95xpath20794*="*cf5a39a3fbc44cfc95ab12d1c82f1b03*") and i still got back nothing. when run a separate query (off of templateId) i get back all the results i expect.

I looked into the Path field in the field set configuration, and see that "free text search" is unchecked, (checking it and applying changes throws an "URL-encoded form data is not valid" error) even unchecked i had hope that my config value <fieldType fieldName="_path" isFacet="true" includeForFreeTextSearch="true" isMultiValue="true" ... >
would set that to be search-able, but it doesn't seem to be the case.

I'm running out of ideas and i would love some guidance. Thanks

1 Reply
Gravatar for

Answer by Jean-François L'Heureux, Apr 14, 2015 5:58 PM

The _path field should be configured like this to work : <fieldType fieldName="_path" isFacet="true" isMultiValue="true" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />

It is important that it is set as facet and multi-value. Not free-text search.

Queries with a field and an operator are not free-text queries.

After changing the configuration file, you need to rebuild your index because CES needs to rebuild its caches for the field for all the documents.

Also, never change the options on the fields directly in the Administration Tool field set because they will be overriden with the configurations set in the config file when the next item will be indexed.

Gravatar for

Comment by cpalmer, Apr 14, 2015 6:10 PM

After reverting the config, rebuilding the index and refreshing the page, i still get 0 results

Gravatar for

Comment by Jean-François L'Heureux, Apr 15, 2015 9:25 AM

Can you try the exact same query in the Administration Tool Index Browser? If it doesn't work, try removing some parts of it until you get results and investigate the query part that is filtering out all the documents.

Ask a question