In this lesson, more fields
are added to the search schema that can be searched. To make relational
data extensions searchable, they must be extracted and stored in the
search index. That is, the field definitions must be added to the
search schema file.
Typically, WebSphere Commerce data
is stored in a relational database. In WebSphere Commerce search,
another repository also stores WebSphere Commerce data. That is, the
product information is stored in a search index for searching purposes.
Most of the data that are stored in the search index is extracted
from the relational database. Similar to the database schema, the
search index also contains a schema. The fields that are defined in
this schema are used by WebSphere Commerce search. This tutorial demonstrates
how additional data that is added to the WebSphere Commerce relational
schema as part of extension can be extracted and stored in the search
schema so that it can be searched. To do so, assuming the additional
relational table and the data exist in the database, the first step
is to define fields in the search schema that store the data to be
searched. Once the new fields are defined, the mappings must be configured
for the fields to the database schema.
Procedure
- Add more fields to the search schema that can be searched.
- Navigate to the following directory:
- Open the schema.xml file.
- Under the
<fields>
section, add the
following new fields to be indexed by search:
<!--customization fields -->
<field name="warterm" type="wc_text" indexed="true" stored="true" multiValued="false" />
<field name="wartype" type="wc_text" indexed="true" stored="true" multiValued="false" />
<field name="careinstruction" type="wc_text" indexed="true" stored="true" multiValued="false" />
When
stored is set to true, the
original information is stored in the index, making whether the field
is tokenized or non-tokenized irrelevant. If you want to retrieve
the field to display it, you must set
stored to
true, otherwise, you can search on the field only. For more information,
see
Structured content.
Note: To
make the new searchable customization fields work properly within
workspaces, copy your customized
schema.xml file
to the workspace core directories.
WC_installdir\instances\instance_name\search\solr\home\MC_10001\en_US\CatalogEntry_WCR10x\conf\
where
x represents all cores.
- Save your changes and close the file.
Results
This lesson extends the search schema for the English locale, en_US,
only. For other languages, complete this lesson by updating the schema.xml files
in the appropriate locale folders.