Some guidelines for determining which properties to include as text properties, and which ones to omit:
Include properties whose values contain text that users are likely to search for. For product catalogs, typical properties might be
description
,longDescription
,color
, andbrand
.Don’t include multiple properties that contain the same data. For example, if a product’s
description
andlongDescription
properties always contain the same text, include only one of these properties in the index. (Similarly, if thedescription
property always contains a subset of the text in thelongDescription
property – such as the first sentence – then includelongDescription
and omitdescription
.)Don’t include properties that have values that users are unlikely to search for. These include date and Boolean values, and some types of numeric values. (Note, however, that these properties are often appropriate for metadata.)
Don’t include properties that may lead to irrelevant or undesired results. For example, suppose you have a Shoes category with two subcategories, Men’s Shoes and Women’s Shoes. If the
description
property of the Shoes category is “Men’s and women’s shoes,” and you includeancestorCategories.description
in the index, searches for “men’s shoes” will return women’s shoes as well as men’s, because theancestorCategories.description
property for each item in Men’s Shoes will contain the phrase “women’s shoes.”Be careful not to confuse the name of a property with its values. For example, you might be inclined to include a Boolean property named
onSale
, on the assumption that users may include “on sale” in search queries. But the resulting index will not includeonSale
(the name of the property), it will includetrue
andfalse
(the values of the property), so searching for “on sale” will not have the desired effect.
Keep in mind that these are just guidelines, and you may need to deviate from them depending on the requirements of your site. For example, you may want to include a Boolean property as a text property if you translate true
and false
into searchable Strings. (See Translating Property Values.) Or there may be certain numeric properties (e.g., product codes) that you may want to make available for searching.