Gravatar for christopher.gutmanis@aurora.org

Question by cmgutmanis, Mar 17, 2015 4:41 PM

Getting Name from Metadata Name

Hi,

I'm trying to query against the Coveo Search Service and have been unable to figure out how to add facet refinements in queries, as at indexing time, Coveo parses the field name and inserts a number of extra characters at the beginning and end of the field name. I can perform my refined search just as a test by hardcoding the Coveo field name, but this is not really sustainable as these extra characters seem to vary wildly between different development machines and environments.

Here is what I have that works locally:

queryParams.Expression = string.Format("{0} && @fz64xmyfield64332 == \"{1}\"", searchTerm, refinement);

what I am looking for is some sort of method to translate between the "Metadata Name" and whatever the indexed string is - something like

string refinementField = GetCoveoFieldByMetadataName("myfield");

so that I can then add that variable into the string.Format instead of hardcoding that field name (as it's unsustainable anyway)

Any help here would be greatly appreciated. Thanks!

1 Reply
Gravatar for christopher.gutmanis@aurora.org

Answer by cmgutmanis, Mar 17, 2015 5:21 PM

never mind, I just found the Coveo.UI.SitecoreUtilities.ToCoveoFieldName method.

Ask a question