All Products
Search
Document Center

OpenSearch:E-commerce industry template - multi-way search

Last Updated:Oct 19, 2026

Introduction

The multi-way search feature of OpenSearch combines text search and vector search. It delivers higher accuracy than OR logic while keeping search latency and computing consumption lower, and its effectiveness has been verified in question search scenarios. The multi-way retrieval architecture can also be used in scenarios such as image vector retrieval, formula retrieval, and personalized retrieval.image

Why is multi-way retrieval needed?

  • It retrieves documents that match the search intent but would otherwise be missed because tokenization, synonyms, spelling correction, and similar features cannot cover them.

  • It reduces cases in which long-tail queries return zero or very few results.

Example:

This example uses Chinese text, which is represented here as ASCII Unicode escapes. Decode the escapes into the actual Chinese characters before you enter them in a real query. Assume that the user query is \u5229\u6839\u5ddd (the brand name "Tonegawa"). The Chinese analyzer tokenizes it into \u5229\u6839 and \u5ddd.

If the document content is \u5229\u6839\u5ddd\u5927\u81ea\u7136\u725b\u8089\u5e72 ("Tonegawa Nature Beef Jerky"), the Chinese analyzer tokenizes it into \u5229\u6839, \u5ddd\u5927, \u81ea\u7136, and \u725b\u8089\u5e72. In this case, the document cannot be retrieved based on text tokenization, because the query token \u5ddd does not match the document token \u5ddd\u5927. Vector retrieval does not strongly depend on the text tokenization results because it retrieves documents based on semantic matching. Therefore, the query \u5229\u6839\u5ddd ("Tonegawa") can retrieve the document \u5229\u6839\u5ddd\u5927\u81ea\u7136\u725b\u8089\u5e72 ("Tonegawa Nature Beef Jerky").

Configure multi-way search for the e-commerce industry template

1. Configure the e-commerce industry template. After the industry template is configured, check whether the corresponding vector index is configured. In this example, the "Vector - General E-commerce Vector" analysis method is used.

In the Index Field List, make sure that a vector index named vector exists. Its index label is Vector Index, it contains the title field, and its analysis method is Vector - General E-commerce Vector.

2. Create a query analysis rule. Add the "Text Vectorization" feature and specify the vector index that is configured in Step 1.

In the left-side navigation pane, click Query Analysis. In the query analysis configuration, click the corresponding rule to open the Edit Rule dialog box. In the Feature Selection section, select Text Vectorization. Then, on the right side, set Vector Index to vector and click OK.

3. Configure sort policies. By default, the e-commerce industry template creates two sort policies: sys_first_default (basic sort) and sys_second_default (business sort).

On the Sort Configuration > Policy Management page, you can view the two sort policies and their sort expressions.

4. Create a multi-way retrieval policy. The procedure is as follows: Specify the policy name --> Configure multi-way search (vector index and text index) --> Configure comprehensive sort (sort logic and number of documents to sort):

In the Configure Query Policy dialog box, set Query Policy Name to sys_strategy. In the Multi-way Search Configuration section, select Vector Search and Text Search, and set Retrieval Result Ratio to 50% for both. In the Comprehensive Sort Configuration section, set Merge Sort to sys_second_default and Number of Documents to Sort to 500. Then, click OK.

5. Test in the console:

Assume that the query is "search test", the multi-way search query policy is sys_strategy, and the query analysis rule is sys_default. Go to the Search Test page in the console and set the search_strategy, raw_query, and qp fields in the Parameters section accordingly. Note: All three parameters are required. (If the query analysis rule is set as the default rule, the qp parameter can be omitted.) Request format:

query=default:'search test'&search_strategy=sys_strategy&raw_query=search test&qp=sys_default

SDK parameter configuration (Java is used as an example):

...
   
//Define a Config object to specify config clause parameters, such as pagination or the format of returned data
Config config = new Config(Lists.<String>newArrayList(appName));
config.setStart(0);
config.setHits(10);
​
//Set the return format to JSON
config.setSearchFormat(SearchFormat.FULLJSON);
​
​
// Create a parameter object
SearchParams searchParams = new SearchParams(config);
​
//Set the parameters that must be passed in for the query
HashMap<String,String> paraMap=new HashMap<String,String>();
//Set raw_query
paraMap.put("raw_query","search test");
//Set multi-way search
paraMap.put("search_strategy","sys_strategy");
searchParams.setCustomParam(paraMap);
​
//Set query analysis
List<String> qpName = new ArrayList<String>();
qpName.add("sys_default");  //Set the name of the query analysis rule
searchParams.setQueryProcessorNames(qpName);
​
...

Usage notes

  • The multi-way retrieval feature is currently available only for exclusive applications.

  • The multi-way retrieval feature does not support the aggregate or distinct clause.

  • You can create up to 10 multi-way retrieval query policies for each application.

  • In the multi-way search configuration, Text Search and Vector Search are required, and the sum of their retrieval result ratios must be 100%.

  • In the multi-way search configuration, the basic sort for Text Search and Vector Search is selected from Sort Configuration - Basic Sort, and the business sort is selected from Sort Configuration - Business Sort.

  • In the comprehensive sort configuration, Merge Sort is selected from the business sort policies and is required. You can also select "None", which is the default value. Number of Documents to Sort is required. The value must be greater than 0 and cannot exceed 5000.

  • Vector indexes that are not automatically generated by the system cannot be selected in the Text Vectorization feature of query analysis.

  • If you want to use the multi-way search feature with a self-built vector index, contact us.