Walkthrough: Adding an attribute as a filter

A filter is a search component that you can use to limit the type of content and attributes you want to be returned. Depending on your use case, filters can be visible to your visitors, or they might be used behind-the-scenes to only show a subset of results. An example of filters working behind the scenes is if you create a filter based on the blog_status attribute, and create a rule to show only blog_status=published blogs when site visitors in a specific context search for a term.

This walkthrough describes how to:

  • Add an attribute and enable it as a filter

  • Extract attribute values

  • Verify your configuration

Add an attribute and enable it as a filter

To add an attribute and enable it as a filter:

Note

You can also enable an existing attribute as a filter. To do this, enable it for filters in the Use For Features tab, as described in step 9, below.

  1. In the Customer Engagement Console (CEC), on the menu bar, click Administration > Domain Settings.

  2. Click Attributes > Add Attribute.

  3. In the attribute editing dialog, click Settings > Entity and then click the entity that this attribute applies to. Available entity options depend on your specific implementation.

  4. In the Display Name field, enter a display name for the attribute.

    For example, enter Version

  5. In the Attribute Name field, enter the attribute's key or property name. This value is used later in the source configuration.

    Tip

    The attribute name must be alphanumeric and lowercase with no spaces. Separate words with an underscore (_).

    For example, enter version.

  6. In the Placement drop-down menu, click Standard.

  7. In the Data Type drop-down menu, click the data type of the attribute.

    For example, click Float.

  8. Optionally, enter values in the following following input fields:

    Default Value, Description, and Icon.

  9. On the Use For Features tab, select the Filters option.

  10. Click Save.

  11. Click Publish. Confirm the action when prompted.

Note

Marking an attribute as use for filters is usually enough to create a filter. Optionally, you can select an analyzer to use for this filter or change the filtering operator from the default Or to And.

Extract attribute values

After you configure an attribute to be used as a filter, you'll need to extract values for the attribute in all sources that this attribute applies to.

The process of extracting attribute values depends on the type of source you configured and the type of original content you have. In this example, assume you have a web crawler source and want to use HTML meta tags to extract the attribute's value.

Note

If you have not yet created a source , you'll need to create a source first, and then configure how to extract attribute values.

To use HTML meta tags to extract attribute values:

  1. In the CEC, click Sources and select the source you want to edit to extract values for the new attribute.

  2. To get the latest attribute list, on the Source Settings page, click reindex.

  3. To extract attribute values, click Edit next to Attribute Extraction.

  4. On the Attribute Extraction page, click Add Attribute .

  5. In the attribute selector, click Add next to the attribute whose value you want to extract, and then click Add at the bottom.

    For example, click version.

  6. Next to the attribute you want to configure, in the Type drop-down menu, click Meta Tag

  7. In the VALUE field, enter the name of the meta tag or property tag you want to use.

    For example, if you enter author, Search first constructs this XPath expression: //meta[@name='author']/@content. If this expression gives a value, Search stops. If this expression does not give a value, Search then constructs this XPath expression: //meta[@property='author']/@content.

  8. Click Save.

  9. Click Publish.

Verify your configuration

Now that you've extracted attribute values, we recommend that you verify your source configuration.

Do you have some feedback for us?

If you have suggestions for improving this article,