Determine which fields to make searchable

You can start performing queries as soon as your index is populated with items. By default, when you submit a query from a search box such as the one in the Content Browser, the index looks through its searchable fields for values matching the keywords you entered, and returns the corresponding items.

This article covers the standard searchable fields and provides guidelines for making additional fields searchable.

Index searchability

Each item in your index may have two kinds of searchable fields:

  • The body field (that is, item data).

  • Free text searchable fields (that is, searchable metadata). By default, the only free text searchable fields are title and URI.

This means that, by default, when you submit a query from a search box, the index looks through its body, title, and URI fields for values matching the keywords you entered, and returns the corresponding items.

Note

The index can also expand your original keywords by:

  • Leveraging stemming to expand each of your original keywords to all other known keywords sharing the same root.

  • Applying its automatic correction feature to detect and automatically correct misspelled original keywords.

The body field

Indexed items have a default field called body which is created by extracting the original item data. This field is meant to hold the main data of the item.

Examples
  • You index a media file such as a PDF.

    In the indexing pipeline, the media file content is converted to HTML, which is then used to populate the body field for an item in your index.

    When an end user submits a query whose keywords match content from the original media file, the item corresponding to that file therefore appears in the query results.

  • You index a book.

    In the indexing pipeline, a summary of the book is fetched and assembled into an HTML document together with the title, the author name, etc., to populate the body field for an item in your index.

    When an end user submits a query whose keywords match the book summary, or the title, or the author name, etc., the item corresponding to that file therefore appears in the query results.

Configure metadata fields to be searchable

Items indexed from databases or object-based content repositories often consist of a collection of fields, but have no body field to speak of.

In such cases, you may want to consider making relevant metadata fields free text searchable. Doing so is only possible with fields of the string type. Be careful to make only relevant fields searchable (that is, only fields containing keywords that your end users might actually enter in a search box). Otherwise, you risk slowing down the querying process and introducing noise in the overall relevance of your search solution.

Examples
  • In a commerce solution, you use a Database source to index product items.

    At indexing time, your source queries the original database to retrieve an assortment of data representing each product. This data is then used to populate various fields in your index (for example, @productname, @productdescription, @productprice, @productcategories, etc.). However, no data populates the body field.

    This means that at query time, the only ways your end users could search for items from that source would be to:

    • Refine search results using filters (such as facets).

    • Submit a query whose basic expression keywords match content from the either of the other default free text searchable fields (that is, @Title and @uri).

    You decide to make the @productname and @productdescription fields free text searchable, as the keywords your end users enter in the search box are likely to match content from those fields.

  • You have an organization in which you index support cases. The index has fields called caseNumber, caseTitle, and caseDescription which, as their names suggests, respectively hold case numbers, case titles, and case descriptions.

    You want your support agents to be able to search for support cases by typing case numbers, case titles, or case descriptions in the search box. You ensure that the caseNumber, caseTitle, and caseDescription fields have type string, and you set them to be free text searchable.

You can also use this approach in combination with the body field, that is, both the body and some metadata fields can be searchable.

Notes
  • Fields are index-wide containers. When you set a field to be searchable, it becomes searchable for all items across all sources that populate the field.

  • When you enable or disable the Free text search option on a field, don’t forget to fully rebuild all sources associated with that field.

What’s next?

The About the search process article provides a high-level overview of the search process.