Gravatar for christopher.gutmanis@aurora.org

Question by cmgutmanis, Feb 19, 2015 2:29 PM

Adding computed fields to query in SOAP api

Hello,

I have created a computed index on the 'content' data of Sitecore components so that all component content is only indexed under the containing page, and in doing so was able to exclude the actual components from the index.

The issue I'm having is that when using the SOAP api to perform searches, it does not seem to search this computed field at all (I am able to run searches without incident using this sort of LINQ syntax:

     var results = context.GetQueryable<SearchResultItem>().Where(x => x.Content.Contains(searchQuery.ToLower()))
        .GetResults();

but I would rather not join/aggregate multiple complex LINQ statements if possible, to say nothing about logic for synonyms search).

If I type something like this into the search bar, I can come closer to accomplishing things:

@fz95xcontent64386*="*automobile*" OR automobile,

but as you can see, this still does not entirely solve the issue, as I have "automobile" aliased to "car" in my thesaurus, so, while it would successfully search coveo fields for both terms, I am only doing a search for 'automobile' in the content field. Similarly, I don't know that I want to be adding the @fz95xcontent parameter in code, as I imagine that value may be different through different deployment environments, and definitely would rather not explictly call the thesaurus and perform those sorts of string joins every time I run a search. For what it's worth, if I include EVERYTHING in the index, this query will return results, but as said before, I do not wish to return individual sitecore components in my search results, only the pages on which they ultimately reside.

I do have the following line in my Coveo.SearchProvider.Config, but do not know what else may be needed.

      [ fieldType fieldName="_content" isFacet="true" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" / ]

Thanks in advance for any help !

1 Reply
Gravatar for sbelzile@coveo.com

Answer by Sébastien Belzile, Feb 19, 2015 3:09 PM

The Sitecore field "_content" is not indexed by default by Coveo, since its content is already indexed in a different way. There is a virtualFieldProcessor that translates every queries to that field to free text queries.

Gravatar for christopher.gutmanis@aurora.org

Comment by cmgutmanis, Feb 20, 2015 10:15 AM

Ok, I see that declared in the SearchProvider.config file, but I don't understand exactly what this means - do I have to do anything else to have this field included in search queries? Currently I am not getting any results for text inside of this field.

Ask a question