com.aliyun.opensearch.cava

更新时间:
复制 MD 格式

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

ClassDescription
TagMatchMatches search queries with tags in documents and allocates weights to matched tags.
UtilProvides common utility functions including decay functions and normalization functions.
first_phase_scoreReturns the score calculated by the basic expression.

Algorithm classes

ClassDescription
CategoryScoreObtains the score indicating the relevance of a query term to a category in a document.
PopularityObtains the popularity score of a document.

Time-related classes

ClassDescription
TimeProvides time-related functions for obtaining the current time or the timeliness score of a document.

Geographic location classes

ClassDescription
DistanceCalculates 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

ClassDescription
TextRelevanceCalculates text relevance between a query term and a specified field.
ProximaScoreCalculates the relevance score of vector indexes in the query.
basicSimilarityScoreCalculates 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.

ClassDescription
FieldTermProximityCalculates the proximity of a query term to a specified field.
QueryMinSlideWindowCalculates 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.

ClassDescription
FieldLengthReturns the number of terms in a field after analysis.
FieldMatchRatioCalculates the ratio of query terms that hit a specified field to all terms in the field.
FieldTermMatchCountCounts the number of query terms that hit an index.
FieldMatchWeightedCalculates the proximity of a query term to a specific field, with weighting applied.
BM25Calculates the BM25 score of a query term against a specific field.
BM25FExtends BM25 to calculate text relevance of a query term across multiple specified fields.
KeyWordsMatchedMeasures 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.

ClassDescription
QueryMatchRatioCalculates the ratio of query terms that hit a specific field or all fields of an index to all terms in the index.
QueryTermCountCalculates the number of query terms after analysis.
QueryTermMatchCountCounts 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.

ClassDescription
AlgoModelCalculates 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.

  • AlgoModel can only be used with the IntelligenceAlgorithmScorer class.