Gravatar for

Question by Greg Jankowski, Mar 17, 2018 1:28 PM

Assign a default topic to a source

I have a source and I want to assign a default topic for facet display.

Is there a way to define a default topic to a source?

Gravatar for

Comment by Jean-François L'Heureux, Mar 19, 2018 3:12 PM

Can you elaborate on the concept of "Topic"? Is it a field in your index?

Do you want the topic to be the same for all the items of that source or you just want a default value for items that do not have a topic defined?

Gravatar for

Comment by Greg Jankowski, Mar 19, 2018 3:18 PM

I want to set a Topic topic for a source so when the source is selected, the user sees a facets using @topics.

I want to force a facet value that I set to be displayed for a source.

1 Reply
Gravatar for

Answer by Jean-François L'Heureux, Mar 19, 2018 3:43 PM

This is called source mappings in Coveo Cloud.

In the Coveo Cloud Administration Console, select the source, click the more menu, and click on "Manage mappings...".

In the dialog, use the filter box to search for the "topic" field. If found, double click it. If not present, click "Add" then "Mapping" in the top right corner drop down.

In the "Edit maping" dialog, you will be able to set the value you want for the field. Rules are applied in their display order. When a rule returns a value, processing stops. You can learn more about this here:

Thus, you can set 2 rules:

  1. `%[topic]` (Will look for a metadata named "topic" on the original documents of that source, if any. You do not need this rule if you know that no original documents have this metadata.)
  2. Any text you would like the topic to be for all the documents of that source (When you set a rule to text without the `%[]` syntax, it always stops processing of the rules and set the field to that value)
Ask a question