You can make CATENTDESC.SHORTDESCRIPTION
non-searchable by
Elasticsearch by modifying the NiFi pipeline.
About this task
The text in base catalog fields can cause irrelevant search results. For example,
your catalog entries could have a short description containing text about related
products. These entries cause a search match when the product is different from the
search terms, but this field would still need to be indexed in order to display on
the product detail page.
You can prevent this behavior by setting base catalog fields as unsearchable.
Procedure
-
Modify the product mappings for the locale
en_US
, or other
applicable locales:
-
Navigate through the NiFi Flow to the
auth.reindex* connector or pipeline, then and the Populate Product index
schema processor. Alternatively, use the search bar in
the upper right corner of the NiFi canvas, and search for the
Populate Product index schema processor in the
auth.reindex pipeline.
Note: *Different steps are needed if you are using
the CAS indexing model (auth.reindex.cas).
Contact HCL Support for guidance.
-
Right-click on the Populate Product index schema
processor, click Stop, and then click
View configuration and the
Properties tab. In the
Properties tab, click in the
Values field for the Index
Schema property and copy the Index schema contents into a
text editor for editing.
-
Modify the content as follows. First, search for the
description
section in the JSON:
"description": {
"properties": {
- Remove
"default.search.text"
,
"default.search.split"
,
"default.completion"
and
"default.suggestion"
from the
"text"
section. The modified section
appears as
follows:"text": {
"type": "text",
"analyzer": "custom_analyzer",
"eager_global_ordinals": "false",
"index": "true",
"index_options": "positions",
"index_phrases": "false",
"norms": "true",
"store": "true",
"copy_to": [
"default.correction.text",
]
},
- Copy the modified
"text"
section and paste it
below the "text"
section. Rename
"text"
to "text_en_US"
and
update the "analyzer"
to
"custom_en_US_analyzer"
:
"text_en_US": {
"type": "text",
"analyzer": "custom_en_US_analyzer ",
"eager_global_ordinals": "false",
"index": "false",
"index_options": "positions",
"index_phrases": "false",
"norms": "true",
"store": "true",
"copy_to": [
"default.correction.text"
]
}
- Copy your modified product schema JSON content back into the
Values field of the Index
Schema property and save the value changes. Then
right-click on the Populate Product index
schema processor and click
Start.
-
Exclude the description field from NLP indexing. This is required because the
description field is copied to natural.nouns and
CATENTDESC.SHORTDESCRIPTION
would still be searchable if it
were present.
-
Navigate to . You can use the search bar in the upper right corner to
search for the NLP Service process group. When
NLP Service appears in the finder, select
NLP Service under Process
Groups.
-
Right click on the NLP Service process group and
click Stop.
-
Right click the NLP Service and select
Variables.
-
Locate the index.nlp.description variable and set
its value to
false
.
-
Right click on the NLP Service process group and
select Start.
-
Perform a full reindex of the
auth.reindex
connector:
-
After reindexing, verify the updated schema using the following REST
endpoint:
http://{{es_hostname_port}}/auth.{{storeId}}.product/_mappings/
-
Test the search REST API using terms that only be be found in short
descriptions and confirm the field is not searchable.
-
Ensure your local changes are persisted to the NiFi
Registry. Changes in the NiFi user interface should be saved by versioning the
process groups (versioning in the NiFi Registry is scoped to the process group
level) where you made your changes.
-
Return to the Product Schema process group (the
parent process group of the Populate Product index
schema processor that you changed), and note the
asterisk. This indicates there are local changes that are not in sync
with the version of the process group in the NiFi Registry.
-
Right click on the Product Schema process group.
Select Version and Commit local
changes to persist your local NiFi changes to the NiFi
Registry.
-
Persist the NLP Service variable changes by saving
a new version of the process group.
- Right-click on the NLP Service process
group and click .
- Right-click again on the NLP Service
process group and select .
- Name the flow NLPService_X2 and click
Save.
-
Optionally, build a new version of your NiFi Registry image for your
Kubernetes deployment.
What to do next
If you want to move your changes to other environments:
Export your changed process groups (flows) from the NiFi Registry and place them
in the /patches directory and they will be picked up by the
registry. For more information, see Applying a NiFi flow patch to NiFi Registry, Persisting Ingest changes (NiFi Registry), and CI/CD strategy to deploy customizations
https://help.hcltechsw.com/commerce/9.1.0/search/concepts/C_CICDModel.html