Index
The Offer Search Index Service creates product indices and processes the incoming product models to index them in the Offer Search Engine.
Product Index
To create a product index for each tenant, the tenant has to be configured in the application configuration.
At startup, the Offer Search Index Service tries to create a product index for all the configured tenants by calling The Create Index API of the Offer Search Engine. This creates a
product_<tenant_id>
index in the Offer Search Engine.
Index Mapping
- By default, the Offer Search Engine uses the existing incoming product model to create the corresponding domain object. To support TIBCO Offer and Price Engine based queries and dynamic product model changes, a custom index mapping file is used. This file is used as an input along with the source product model document to index.
- For full-text purposes, all the fields eligible for full-text search are copied in the
productFullTextSearch
field of the product mapping file so that the search is executed only across the field instead of inserting multiple fields in the search query. - The category from the product is mapped as follows:
"categories" : { "type": "nested", "properties" : { "name" : { "copy_to": "productFullTextSearch", "type": "keyword" }, "childCatList" : { "properties" : { "name" : { "copy_to": "productFullTextSearch", "type": "keyword" }, "childCatList" : { "properties" : { "name" : { "copy_to": "productFullTextSearch", "type": "keyword" }, "level" : { "type" : "long" } } }, "level" : { "type" : "long" } } },
- Segment mapping is as follows:
"compatibleSegments": { "type": "nested", "properties": { "segmentName": { "copy_to": "productFullTextSearch", "type": "keyword" }, "segmentType": { "copy_to": "productFullTextSearch", "type": "keyword" } } },
- Record Type/ SubTypes are nested as follows:
"classification": { "type": "nested", "properties": { "type": { "copy_to": "productFullTextSearch", "type": "keyword" }, "subType": { "copy_to": "productFullTextSearch", "type": "keyword" } } },
Classifications have types that contain subtypes as a part of the model, this enables aggregation on type and subtype elements.
- Suggestion terms are mapped as follows:
"suggestionTerms": { "type":"text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } }
- Category attributes are mapped as follows:
"filterAttributes": { "type":"nested", "properties": { "name": { "copy_to": "productFullTextSearch", "type": "keyword" }, "value": { "copy_to": "productFullTextSearch", "type": "keyword" } } },
Indexing Product Documents
After the Offer Search Index Service has started and the tenant index created, the engine can process models and index them against Offer Search Engine product index. The Offer Search indexes the product models as follows:
- Loads models for processing (from online and offline modes) and parses them.
- Sends the models to the Offer Search Engine for indexing against the tenant-based product index created earlier. The products are indexed in bulk and indexes all products present per product model xml file at the same time. For example, if the product model xml contains ten products, all ten products are indexed together in a single request instead of ten individual requests.