Gravatar for slangevin@coveo.com

Question by Simon, Nov 4, 2014 3:45 PM

Sitecore advanced queries for filtering.

Using Sitecore 7.2 with Coveo for Sitecore 3.0 (784), the following advanced queries are used to filter search results to return pages from a specific start locations:

args.queryBuilder.advancedExpression.add("<%= ToCoveoFieldName("longid") %> *= "/{Guid of a start location}"");

and also:

args.queryBuilder.advancedExpression.addFieldExpression("<%= ToCoveoFieldName("_fullpath") %>","*=", ["/sitecore/content/home"])

But none of them return results. Any suggestions?

Gravatar for ahmedokour86@gmail.com

Comment by aokour, Nov 5, 2014 9:35 AM

@lbergeron solution worked

1 Reply
Gravatar for lbergeron@coveo.com

Answer by Luc Bergeron, Nov 4, 2014 4:05 PM

Hi Simon,

As far as I know, the "longid" field is not marked as a facet by default. So it won't work with the wildcard operator unless you mark it as facet.

Also, I guess the code sample that uses the "_fullpath" field should have a "*" at the end of the value.

args.queryBuilder.advancedExpression.addFieldExpression("<%= ToCoveoFieldName("_fullpath") %>","*=", ["/sitecore/content/home*"])

This way, it should return the "/sitecore/content/home" item and all its children.

If it still doesn't work, I would check which search query is sent to CES and validate if the query works from the Index Browser.

Hope this helps.

Gravatar for ahmedokour86@gmail.com

Comment by aokour, Nov 5, 2014 9:35 AM

This worked! Thanks

Ask a question