Add or Edit a Field

Members of the Administrators and Content Managers built-in groups can add and edit fields (see Understanding Fields).

  1. If not already in the Add/Edit a Field [FieldName] panel, access the panel:

    • To add a field, in the main menu, under Content, select Fields > Add Field.

      OR

    • To edit a field, in the main menu, under Content, select Fields > field row > Edit in the Action bar.

  2. When adding a new field, in the Field name box, enter a required descriptive name for the field.

    The field Name value isn’t editable once added and can only contain lowercase letters (a-z), numbers (0-9), and underscores.

    Spaces and other special characters aren’t allowed.

  3. When adding a new field, in the Type drop-down menu, select one of the following field types: String, Integer 32, Integer 64, Decimal or Date (see Field Types).

    • For a Boolean metadata, select a String type. The value will be either true or false.

    • The field Type isn’t editable once the field has been added.

  4. (Optional) In the Description box, enter information such as the creation date of the field or the value (metadata) that you want to be populated for this field.

    The date on which the item was first added to the index.

  5. If you selected String in step 3, optionally select one or more of the following uses for your field:

    When editing a field, if you change the following parameters, you don’t need to rebuild the sources that use this field. However, you may observe a delay before your changes become effective in affected sources. The delay period depends on the size of your index.

    See String Options.

  6. Optionally, click Advanced Settings, and then choose one or more options. See Advanced Settings for option details.

    • Some settings aren’t always editable, depending on the field origin. When editing Default fields, you can’t change the following settings: Search operator, Displayable in results, Free text search, Ranking, and Stemming.

      Moreover, some settings aren’t always editable, depending on the field type (see Available Options Per Field Type).

    • When editing a field, depending on the changes made in the Advanced Settings section of the Add/Edit a Field [FieldName] panel, you may need to rebuild the affected sources for the changes to be effective.

  7. Click Add Field or Save.

String Options

Facet

When you select the Facet option for a field, you can later add a facet based on this field in your search interface, thus allowing its users to further filter their results by selecting or excluding field values (see Using Facets). A facet field can also be used to identify a group of items to promote with a featured result rule (see Adding and Managing Query Pipeline Featured Results).

In your content metadata, the values of the @author field are author names such as John Smith, Mary Davis, Christopher Todd, etc. You select the Facet option so that you can put an Author facet in your search page. With such a facet, search interface users can narrow down their search results to only those authored by one of the selected people.

Author facet

  • Numeric (Integer 32, Integer 64, and Decimal) and Date fields are facetable by default.

  • Enabling the Facet option on a String field increases the time it takes to index items that populate this field, and also requires additional index space and memory. You should thus only select this option when required.

  • When changing the value of the Facet option for a field, you don’t need to rebuild the sources that use this field. However, you may observe a delay before your change becomes effective in affected sources.

Multi-Value Facet

You can select the Multi-value facet option as an alternative to the Facet option to indicate that a field may have several values. A facet based on a multi-value field looks and works similarly to a facet based on a regular field (see Using Facets). Search results with more than one value for a facet field are kept in the search result page from the moment you select one of these values in the facet.

You index items that may have been edited by several individuals. Their names are indexed in the @author field, so you check the Multi-value facet box for this field. In your search interface, when an end user selects names in the Author facet to refine their search results, the items with multiple authors are visible as long as one of their names is selected in the facet.

If you don’t check the Multi-value facet box for a field with many values, Coveo Cloud interprets these values as a single one. It’s therefore impossible to use them as separate values in a facet, and they instead appear as a single option (e.g., value1;value2;value3). Selecting this facet option filters out any item that doesn’t have exactly this set of values.

When changing the value of the Multi-value facet option for a field, you don’t need to rebuild the sources that use this field. However, you may observe a delay before your change becomes effective in affected sources.

Sortable

  • Numeric (Integer 32, Integer 64, and Decimal) and Date fields are sortable by default.

  • Select only when you use this field to sort results with a sort component in a search interface since adding sorting fields can have an impact on index size and indexing performance.

  • When changing the value of the Sortable option for a field, you don’t need to rebuild the sources that use this field. However, you may observe a delay before your change becomes effective in affected sources.

Advanced Settings

The following table lists the available options depending on the field type and sometimes the field use.

Search Operator

If the Search operator box is cleared, the index ignores all field operations based on that field, including field queries (e.g., @date=today). This means that even components code-generated field expression produced by facets, tabs, etc. can’t leverage that field.

  • Selected by default since there’s also no meaningful cost to select this option for all fields.

  • Changing the value of the Search operator option requires a rebuild of all the sources using this field for the change to be effective.

Displayable in Results

If the Displayable in results box is cleared, the index never includes the field in query results, which implies that you can’t leverage the field in the result templates of any of your search interfaces (including the Content Browser).

  • Selecting this option for all fields takes minimal disk space.

  • Changing the value of the Displayable in results option requires a rebuild of all the sources using this field for the change to be effective.

Check the Free text search box when you want the content of the field to be queried using free text. This option isn’t selected by default and is available only if the field type is String.

Essentially, when you enable this option, the field gets “merged” with the body of each item it has a value for in the index.

This implies that the item body size increases with the size of its free text searchable fields. With fields that contain a lot of text, this could have a performance impact. You should thus only enable the Free text search option when necessary.

Let’s say you have an item whose body is A tasty, sweet, rather sticky liquid made from the sap of a tree that grows in North America." and whose free text search enabled @productname field value is maple syrup. Submitting maple, syrup, maple syrup (or any stemming or permutation of these two keywords) in the search box would match the item instead of having to search for @productname=="maple syrup".

If free text search is allowed on @author, items returned when querying @author=John are also returned when querying John; however, the query John also returns items containing the word John in their content, not only in the author field).

Changing the value of the Free text search option requires a rebuild of all the sources using this field for the change to be effective.

Ranking

Check the Ranking box when you want the field to be used in the standard ranking score calculation. This option isn’t selected by default since the option has a significant impact on query performance.

If ranking is enabled for the product field, when a customer searches for “Product A” and some search results have Product A as a value of this field, these results would be ranked higher.

Changing the value of the Ranking option requires a rebuild of all the sources using this field for the change to be effective.

Stemming

Check the Stemming box to allow stemming on field queries. This option isn’t selected by default since the option has a significant impact on query performance.

The words search, searching, and searched share the same root or stem: search-. When a user queries searching in item titles (@title=searching), the Coveo Cloud Platform returns items with a title containing the words searching, search, searches, and searched.

Changing the value of the Stemming option requires a rebuild of all the sources using this field for the change to be effective.

Use Cache for Sort

Check the Use cache for sort box when you want to keep the entire field in memory for fast sorting.

  • Fields that are configured for sorting and are often used should be kept in memory.

  • When changing the value of the Use cache for sort option for a field, you don’t need to rebuild the sources that use this field. However, you may observe a delay before your change becomes effective in affected sources.

Use Cache for Computed Fields

Check the Use cache for computed fields box when you want to keep data in memory for computed fields. The following two use cases require the option to be selected:

  • If not selected in these scenarios, queries related to these fields might take over a second to return results, depending on your number of items.

  • When changing the value of the Use cache for computed fields option for a field, you don’t need to rebuild the sources that use this field. However, you may observe a delay before your change becomes effective in affected sources.

  • Calculated facet

    You calculate the average of the size field value to populate the field author, which is used as a facet field. The size field must therefore use the cache.

  • Query function expression that references a field

    The following query function requires the filesizekb field to use the cache: function:"@syssize/1024" : fieldName:"@filesizekb".

Use Cache for Nested Queries

Check the Use cache for nested queries box when you want to keep in memory the data required to perform nested queries.

Use Cache for Numeric Queries

Check the Use cache for numeric queries box when you want to keep the proper information in memory to execute operations on numerical fields, including operations on dates.

  • This option also makes the calculations related to numerical range facets faster. Thus, using the cache significantly improves the performance to automatically generate the interval values in numerical range facets and to dynamically update those values based on the content returned by the index following a user query.

  • Using the cache for numeric queries allows to use numerical fields as facets, specify the number of ranges, and let the Coveo Cloud Platform index establishes the ranges.

  • Executing a query on a numerical field, especially a query that covers the entire range, impacts the query performance if the field doesn’t use the cache.

  • If your numerical field is stored as a String, you must change its type.

  • When changing the value of the Use cache for numeric queries option for a field, you don’t need to rebuild the sources that use this field. However, you may observe a delay before your change becomes effective in affected sources.

What’s Next?

Recommended Articles