RunAnalyzer()
Runs an analyzer on the supplied texts and returns the resulting tokens.
pub async fn run_analyzer(&self, request: RunAnalyzerRequest) -> Result<RunAnalyzerResponse>
Request Syntax
let request = RunAnalyzerRequest::builder()
.collection_name("books")
.field_name("title")
.texts(["The quick brown fox"])
.with_detail(true)
.build()?;
REQUEST FIELDS:
analyzer_params: Option<serde_json::Value>Inline analyzer configuration as a JSON object. When provided,
collection_nameandfield_nameare not required; otherwise the collection’s field analyzer is used.texts: Vec<String>The texts to analyze. At least one text is required.
with_detail: boolWhether the response includes token detail such as offsets and positions.
with_hash: boolWhether the response includes the token hashes.
database_name: Option<String>Name of the target database; uses the default database when empty.
collection_name: StringName of the collection that owns the field analyzer. Required when
analyzer_paramsis not provided.field_name: StringName of the field whose analyzer is used. Required when
analyzer_paramsis not provided.analyzer_names: Vec<String>Names of the analyzers to run.
RETURNS:
Result
RunAnalyzerResponse exposes results() returning one AnalyzerResult per input text; each result contains the analyzed AnalyzerToken list. Returns Error on failure.
Example
let request = RunAnalyzerRequest::builder()
.collection_name("books")
.field_name("title")
.texts(["The quick brown fox"])
.with_detail(true)
.build()?;
let resp = client.run_analyzer(request).await?;