The com.aliyun.opensearch.cava namespace provides feature classes for building custom sort plug-ins in OpenSearch Industry Algorithm Edition. Each package targets a specific aspect of score calculation — from tag matching and popularity scoring to text relevance and deep learning model inference.
com.aliyun.opensearch.cava.features
The com.aliyun.opensearch.cava.features package covers general-purpose scoring signals: tag affinity, document popularity, geographic proximity, and time-based scoring. Use these classes when building the primary scoring expression for a sort plug-in.
Function classes
| Class | Description |
|---|---|
| TagMatch | Matches search queries with tags in documents and allocates weights to matched tags. |
| Util | Provides common utility functions including decay functions and normalization functions. |
| first_phase_score | Returns the score calculated by the basic expression. |
Algorithm classes
| Class | Description |
|---|---|
| CategoryScore | Obtains the score indicating the relevance of a query term to a category in a document. |
| Popularity | Obtains the popularity score of a document. |
Time-related classes
| Class | Description |
|---|---|
| Time | Provides time-related functions for obtaining the current time or the timeliness score of a document. |
Geographic location classes
| Class | Description |
|---|---|
| Distance | Calculates the spherical distance between a geographic point in a document and a point in a search request. |
com.aliyun.opensearch.cava.features.similarity
The com.aliyun.opensearch.cava.features.similarity package provides feature classes for text relevance calculation. These classes measure how closely a query term matches a document field, and feed into the score calculation of a sort plug-in.
Three child packages extend the base relevance calculation:
`distribution` — measures how a query term is distributed across a field
`fieldmatch` — calculates the proximity of a query term to a field
`querymatch` — measures how well an entire query matches a field or index
Common relevance-related classes
| Class | Description |
|---|---|
| TextRelevance | Calculates text relevance between a query term and a specified field. |
| ProximaScore | Calculates the relevance score of vector indexes in the query. |
| basicSimilarityScore | Calculates a BasicSimilarityScore score, mainly used for the IntelligenceAlgorithmScorer class. |
com.aliyun.opensearch.cava.features.similarity.distribution
Classes in this package calculate how a query term is distributed within a field — useful when term position and spread affect relevance.
| Class | Description |
|---|---|
| FieldTermProximity | Calculates the proximity of a query term to a specified field. |
| QueryMinSlideWindow | Calculates the ratio of query terms that hit a field to the minimum sliding window of the query in that field. |
com.aliyun.opensearch.cava.features.similarity.fieldmatch
Classes in this package calculate how well a search query matches the content of a specific field. Use these when field-level match quality is a key scoring signal.
| Class | Description |
|---|---|
| FieldLength | Returns the number of terms in a field after analysis. |
| FieldMatchRatio | Calculates the ratio of query terms that hit a specified field to all terms in the field. |
| FieldTermMatchCount | Counts the number of query terms that hit an index. |
| FieldMatchWeighted | Calculates the proximity of a query term to a specific field, with weighting applied. |
| BM25 | Calculates the BM25 score of a query term against a specific field. |
| BM25F | Extends BM25 to calculate text relevance of a query term across multiple specified fields. |
| KeyWordsMatched | Measures the degree to which the keywords of a search query match a specific field. |
com.aliyun.opensearch.cava.features.similarity.querymatch
Classes in this package calculate how well an entire query matches a field or the full index. Use these when query-level coverage — rather than individual term matching — is the scoring signal.
| Class | Description |
|---|---|
| QueryMatchRatio | Calculates the ratio of query terms that hit a specific field or all fields of an index to all terms in the index. |
| QueryTermCount | Calculates the number of query terms after analysis. |
| QueryTermMatchCount | Counts the number of query terms that hit an index. |
com.aliyun.opensearch.cava.features.algo
The com.aliyun.opensearch.cava.features.algo package provides a feature class for deep learning model-based scoring. Use this package when a trained model has been configured in OpenSearch and its test data has flowed back.
| Class | Description |
|---|---|
| AlgoModel | Calculates the score of a document using a deep learning model. |
Prerequisites for `AlgoModel`:
A deep learning model must be configured in OpenSearch.
Test data of the model must have flowed back.
AlgoModelcan only be used with theIntelligenceAlgorithmScorerclass.