Struct txtai::similarity::Similarity
source · pub struct Similarity { /* private fields */ }
Expand description
Similarity definition
Implementations§
source§impl Similarity
impl Similarity
Similarity implementation
sourcepub fn new() -> Similarity
pub fn new() -> Similarity
Creates a Similarity instance.
sourcepub fn with_url(url: &str) -> Similarity
pub fn with_url(url: &str) -> Similarity
sourcepub fn with_url_token(url: &str, token: &str) -> Similarity
pub fn with_url_token(url: &str, token: &str) -> Similarity
sourcepub async fn similarity(&self, query: &str, texts: &Vec<&str>) -> IndexResults
pub async fn similarity(&self, query: &str, texts: &Vec<&str>) -> IndexResults
Computes the similarity between query and list of text. Returns a list of {id: value, score: value} sorted by highest score, where id is the index in texts.
§Arguments
query
- query texttexts
- list of text
sourcepub async fn batchsimilarity(
&self,
queries: &Vec<&str>,
texts: &Vec<&str>
) -> IndexResultsBatch
pub async fn batchsimilarity( &self, queries: &Vec<&str>, texts: &Vec<&str> ) -> IndexResultsBatch
Computes the similarity between list of queries and list of text. Returns a list of {id: value, score: value} sorted by highest score per query, where id is the index in texts.
§Arguments
queries
- queries texttexts
- list of text
Auto Trait Implementations§
impl Freeze for Similarity
impl RefUnwindSafe for Similarity
impl Send for Similarity
impl Sync for Similarity
impl Unpin for Similarity
impl UnwindSafe for Similarity
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more