Determining Which Fields to Make Searchable

You can start performing queries as soon as your index is populated with items (see Locating and Indexing Content). 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 lists and details 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 field:

  • The body field (i.e., item data).
  • Free text searchable fields (i.e., 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.

  • The index can also expand your original keywords by:
    • Leveraging stemming, essentially expanding each of your original keywords to all other known keywords sharing the same root (see About Stemming).
    • Applying its automatic correction feature to detect and automatically correct misspelled original keywords (see Query Correction Feature).

The body Field

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

Having a body field allows for the use of the Quickview component (see Quickview and Add or Edit a Body Mapping).

  • 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.

    You add a Quickview component to your result list so it can display the HTML document containing the summary, title, author name, etc. of result items.

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 (see Add or Edit a Field). Doing so is only possible with fields of the string type. Be careful to make only relevant fields searchable (i.e., 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.

  • 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 (e.g., @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 (e.g., tabs, facets).
    • Submit a query whose basic expression keywords match content from the either of the other default free text searchable fields (i.e., @Title and @uri).

    All things considered, 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, i.e., both the body and some metadata fields can be searchable.

  • Fields are index-wide containers. Hence, 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 next article in this section provides a high-level overview of the search process (see About the Search Process).

Recommended Articles