Skip to main content

Standard Analyzer

The standard analyzer is the default analyzer in Zilliz Cloud, which is automatically applied to text fields if no analyzer is specified. It combines the standard tokenizer with the lowercase filter.

Notes

The standard analyzer is suitable for languages that rely on separators (such as spaces, punctuation) for word boundaries. However, languages like Chinese, Japanese, and Korean require dictionary-based tokenizations. In such cases, using a language-specific analyzer like chinese or custom analyzers with specialized tokenizers (such as lindera, icu) and filters is highly recommended to ensure accurate tokenization and better search results.

Definition​

The standard analyzer consists of:

  • Tokenizer: Uses the standard tokenizer to keep consecutive Unicode letters and numeric characters in tokens and split at other characters. For the exact character rules, refer to Standard Tokenizer.

  • Filter: Uses the lowercase filter to convert all tokens to lowercase, enabling case-insensitive searches. For more information, refer to Lowercase.

The functionality of the standard analyzer is equivalent to the following custom analyzer configuration:

python
analyzer_params = {
"tokenizer": "standard",
"filter": ["lowercase"]
}

Configuration​

To apply the standard analyzer to a field, simply set type to standard in analyzer_params, and include optional parameters as needed.

python
analyzer_params = {
"type": "standard", # Specifies the standard analyzer type
}

The standard analyzer accepts the following optional parameters:

ParameterDescription
stop_wordsAn array containing a list of stop words, which will be removed from tokenization.

Example configuration of custom stop words:

python
analyzer_params = {
"type": "standard", # Specifies the standard analyzer type
"stop_words", ["of"] # Optional: List of words to exclude from tokenization
}

After defining analyzer_params, you can apply them to a VARCHAR field when defining a collection schema. This allows Zilliz Cloud to process the text in that field using the specified analyzer for efficient tokenization and filtering. For more information, refer to Example use.

Examples​

Before applying the analyzer configuration to your collection schema, verify its behavior using the run_analyzer method.

Analyzer configuration​

python
analyzer_params = {
"type": "standard", # Standard analyzer configuration
"stop_words": ["for"] # Optional: Custom stop words parameter
}

Verification using run_analyzer​

python
from pymilvus import (
MilvusClient,
)

client = MilvusClient(
uri="YOUR_CLUSTER_ENDPOINT",
token="YOUR_CLUSTER_TOKEN"
)

# Sample text to analyze
sample_text = "The Milvus vector database is built for scale!"

# Run the standard analyzer with the defined configuration
result = client.run_analyzer(sample_text, analyzer_params)
print("Standard analyzer output:", result)

Expected output​

sql
Standard analyzer output: ['the', 'milvus', 'vector', 'database', 'is', 'built', 'scale']