Merge branch 'main' into settings-customizing-tokenization

This commit is contained in:
ManyTheFish
2023-08-08 16:08:16 +02:00
166 changed files with 2252 additions and 1072 deletions

View File

@ -100,7 +100,7 @@ fn facet_number_values<'a>(
}
/// Return an iterator over each string value in the given field of the given document.
fn facet_string_values<'a>(
pub fn facet_string_values<'a>(
docid: u32,
field_id: u16,
index: &Index,

View File

@ -6,6 +6,7 @@ use heed::{RoPrefix, RoTxn};
use roaring::RoaringBitmap;
use rstar::RTree;
use super::facet_string_values;
use super::ranking_rules::{RankingRule, RankingRuleOutput, RankingRuleQueryTrait};
use crate::heed_codec::facet::{FieldDocIdFacetCodec, OrderedF64Codec};
use crate::score_details::{self, ScoreDetails};
@ -157,23 +158,7 @@ impl<Q: RankingRuleQueryTrait> GeoSort<Q> {
let mut documents = self
.geo_candidates
.iter()
.map(|id| -> Result<_> {
Ok((
id,
[
facet_number_values(id, lat, ctx.index, ctx.txn)?
.next()
.expect("A geo faceted document doesn't contain any lat")?
.0
.2,
facet_number_values(id, lng, ctx.index, ctx.txn)?
.next()
.expect("A geo faceted document doesn't contain any lng")?
.0
.2,
],
))
})
.map(|id| -> Result<_> { Ok((id, geo_value(id, lat, lng, ctx.index, ctx.txn)?)) })
.collect::<Result<Vec<(u32, [f64; 2])>>>()?;
// computing the distance between two points is expensive thus we cache the result
documents
@ -185,6 +170,37 @@ impl<Q: RankingRuleQueryTrait> GeoSort<Q> {
}
}
/// Extracts the lat and long values from a single document.
///
/// If it is not able to find it in the facet number index it will extract it
/// from the facet string index and parse it as f64 (as the geo extraction behaves).
fn geo_value(
docid: u32,
field_lat: u16,
field_lng: u16,
index: &Index,
rtxn: &RoTxn,
) -> Result<[f64; 2]> {
let extract_geo = |geo_field: u16| -> Result<f64> {
match facet_number_values(docid, geo_field, index, rtxn)?.next() {
Some(Ok(((_, _, geo), ()))) => Ok(geo),
Some(Err(e)) => Err(e.into()),
None => match facet_string_values(docid, geo_field, index, rtxn)?.next() {
Some(Ok((_, geo))) => {
Ok(geo.parse::<f64>().expect("cannot parse geo field as f64"))
}
Some(Err(e)) => Err(e.into()),
None => panic!("A geo faceted document doesn't contain any lat or lng"),
},
}
};
let lat = extract_geo(field_lat)?;
let lng = extract_geo(field_lng)?;
Ok([lat, lng])
}
impl<'ctx, Q: RankingRuleQueryTrait> RankingRule<'ctx, Q> for GeoSort<Q> {
fn id(&self) -> String {
"geo_sort".to_owned()

View File

@ -28,7 +28,7 @@ use db_cache::DatabaseCache;
use exact_attribute::ExactAttribute;
use graph_based_ranking_rule::{Exactness, Fid, Position, Proximity, Typo};
use heed::RoTxn;
use hnsw::Searcher;
use instant_distance::Search;
use interner::{DedupInterner, Interner};
pub use logger::visual::VisualSearchLogger;
pub use logger::{DefaultSearchLogger, SearchLogger};
@ -40,18 +40,18 @@ use ranking_rules::{
use resolve_query_graph::{compute_query_graph_docids, PhraseDocIdsCache};
use roaring::RoaringBitmap;
use sort::Sort;
use space::Neighbor;
use self::distinct::facet_string_values;
use self::geo_sort::GeoSort;
pub use self::geo_sort::Strategy as GeoSortStrategy;
use self::graph_based_ranking_rule::Words;
use self::interner::Interned;
use crate::distance::NDotProductPoint;
use crate::error::FieldIdMapMissingEntry;
use crate::score_details::{ScoreDetails, ScoringStrategy};
use crate::search::new::distinct::apply_distinct_rule;
use crate::{
normalize_vector, AscDesc, DocumentId, Filter, Index, Member, Result, TermsMatchingStrategy,
UserError, BEU32,
AscDesc, DocumentId, Filter, Index, Member, Result, TermsMatchingStrategy, UserError, BEU32,
};
/// A structure used throughout the execution of a search query.
@ -85,7 +85,12 @@ impl<'ctx> SearchContext<'ctx> {
let searchable_names = self.index.searchable_fields(self.txn)?;
let mut restricted_fids = Vec::new();
let mut contains_wildcard = false;
for field_name in searchable_attributes {
if field_name == "*" {
contains_wildcard = true;
continue;
}
let searchable_contains_name =
searchable_names.as_ref().map(|sn| sn.iter().any(|name| name == field_name));
let fid = match (fids_map.id(field_name), searchable_contains_name) {
@ -99,8 +104,10 @@ impl<'ctx> SearchContext<'ctx> {
}
.into())
}
// The field is not searchable, but the searchableAttributes are set to * => ignore field
(None, None) => continue,
// The field is not searchable => User error
_otherwise => {
(_fid, Some(false)) => {
let mut valid_fields: BTreeSet<_> =
fids_map.names().map(String::from).collect();
@ -132,7 +139,7 @@ impl<'ctx> SearchContext<'ctx> {
restricted_fids.push(fid);
}
self.restricted_fids = Some(restricted_fids);
self.restricted_fids = (!contains_wildcard).then_some(restricted_fids);
Ok(())
}
@ -437,29 +444,31 @@ pub fn execute_search(
check_sort_criteria(ctx, sort_criteria.as_ref())?;
if let Some(vector) = vector {
let mut searcher = Searcher::new();
let hnsw = ctx.index.vector_hnsw(ctx.txn)?.unwrap_or_default();
let ef = hnsw.len().min(100);
let mut dest = vec![Neighbor { index: 0, distance: 0 }; ef];
let vector = normalize_vector(vector.clone());
let neighbors = hnsw.nearest(&vector, ef, &mut searcher, &mut dest[..]);
let mut search = Search::default();
let docids = match ctx.index.vector_hnsw(ctx.txn)? {
Some(hnsw) => {
let vector = NDotProductPoint::new(vector.clone());
let neighbors = hnsw.search(&vector, &mut search);
let mut docids = Vec::new();
let mut uniq_docids = RoaringBitmap::new();
for Neighbor { index, distance: _ } in neighbors.iter() {
let index = BEU32::new(*index as u32);
let docid = ctx.index.vector_id_docid.get(ctx.txn, &index)?.unwrap().get();
if universe.contains(docid) && uniq_docids.insert(docid) {
docids.push(docid);
if docids.len() == (from + length) {
break;
let mut docids = Vec::new();
let mut uniq_docids = RoaringBitmap::new();
for instant_distance::Item { distance: _, pid, point: _ } in neighbors {
let index = BEU32::new(pid.into_inner());
let docid = ctx.index.vector_id_docid.get(ctx.txn, &index)?.unwrap().get();
if universe.contains(docid) && uniq_docids.insert(docid) {
docids.push(docid);
if docids.len() == (from + length) {
break;
}
}
}
}
}
// return the nearest documents that are also part of the candidates
// along with a dummy list of scores that are useless in this context.
let docids: Vec<_> = docids.into_iter().skip(from).take(length).collect();
// return the nearest documents that are also part of the candidates
// along with a dummy list of scores that are useless in this context.
docids.into_iter().skip(from).take(length).collect()
}
None => Vec::new(),
};
return Ok(PartialSearchResult {
candidates: universe,

View File

@ -1,7 +1,7 @@
use roaring::RoaringBitmap;
use super::{ComputedCondition, RankingRuleGraphTrait};
use crate::score_details::{Rank, ScoreDetails};
use crate::score_details::{self, Rank, ScoreDetails};
use crate::search::new::interner::{DedupInterner, Interned};
use crate::search::new::query_term::{ExactTerm, LocatedQueryTermSubset};
use crate::search::new::resolve_query_graph::compute_query_term_subset_docids;
@ -87,6 +87,6 @@ impl RankingRuleGraphTrait for ExactnessGraph {
}
fn rank_to_score(rank: Rank) -> ScoreDetails {
ScoreDetails::Exactness(rank)
ScoreDetails::ExactWords(score_details::ExactWords::from_rank(rank))
}
}

View File

@ -15,10 +15,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 10,
max_rank: 10,
ExactWords(
ExactWords {
matching_words: 9,
max_matching_words: 9,
},
),
],
@ -35,10 +35,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 7,
max_rank: 10,
ExactWords(
ExactWords {
matching_words: 6,
max_matching_words: 9,
},
),
],
@ -55,10 +55,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 9,
max_rank: 9,
ExactWords(
ExactWords {
matching_words: 8,
max_matching_words: 8,
},
),
],
@ -75,10 +75,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 6,
max_rank: 9,
ExactWords(
ExactWords {
matching_words: 5,
max_matching_words: 8,
},
),
],
@ -95,10 +95,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 8,
max_rank: 8,
ExactWords(
ExactWords {
matching_words: 7,
max_matching_words: 7,
},
),
],
@ -115,10 +115,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 8,
max_rank: 8,
ExactWords(
ExactWords {
matching_words: 7,
max_matching_words: 7,
},
),
],
@ -135,10 +135,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 5,
max_rank: 8,
ExactWords(
ExactWords {
matching_words: 4,
max_matching_words: 7,
},
),
],
@ -155,10 +155,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 5,
max_rank: 8,
ExactWords(
ExactWords {
matching_words: 4,
max_matching_words: 7,
},
),
],
@ -175,10 +175,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 6,
max_rank: 6,
ExactWords(
ExactWords {
matching_words: 5,
max_matching_words: 5,
},
),
],
@ -195,10 +195,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 3,
max_rank: 6,
ExactWords(
ExactWords {
matching_words: 2,
max_matching_words: 5,
},
),
],
@ -215,10 +215,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 5,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 4,
max_matching_words: 4,
},
),
],
@ -235,10 +235,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 3,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 2,
max_matching_words: 4,
},
),
],
@ -255,10 +255,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 4,
max_rank: 4,
ExactWords(
ExactWords {
matching_words: 3,
max_matching_words: 3,
},
),
],
@ -275,10 +275,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 4,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 3,
},
),
],
@ -295,10 +295,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 3,
max_rank: 3,
ExactWords(
ExactWords {
matching_words: 2,
max_matching_words: 2,
},
),
],
@ -315,10 +315,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 3,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 2,
},
),
],
@ -335,10 +335,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],
@ -355,10 +355,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],

View File

@ -15,10 +15,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 7,
max_rank: 8,
ExactWords(
ExactWords {
matching_words: 6,
max_matching_words: 7,
},
),
],
@ -35,10 +35,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 7,
max_rank: 8,
ExactWords(
ExactWords {
matching_words: 6,
max_matching_words: 7,
},
),
],
@ -55,10 +55,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 7,
max_rank: 8,
ExactWords(
ExactWords {
matching_words: 6,
max_matching_words: 7,
},
),
],
@ -75,10 +75,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 4,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 3,
max_matching_words: 4,
},
),
],
@ -95,10 +95,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 1,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 0,
max_matching_words: 1,
},
),
],

View File

@ -15,10 +15,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 8,
max_rank: 8,
ExactWords(
ExactWords {
matching_words: 7,
max_matching_words: 7,
},
),
],
@ -35,10 +35,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
MatchesStart,
),
Exactness(
Rank {
rank: 8,
max_rank: 8,
ExactWords(
ExactWords {
matching_words: 7,
max_matching_words: 7,
},
),
],
@ -55,10 +55,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 8,
max_rank: 8,
ExactWords(
ExactWords {
matching_words: 7,
max_matching_words: 7,
},
),
],
@ -75,10 +75,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 7,
max_rank: 8,
ExactWords(
ExactWords {
matching_words: 6,
max_matching_words: 7,
},
),
],
@ -95,10 +95,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 5,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 4,
max_matching_words: 4,
},
),
],
@ -115,10 +115,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],

View File

@ -15,10 +15,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 6,
max_rank: 6,
ExactWords(
ExactWords {
matching_words: 5,
max_matching_words: 5,
},
),
],
@ -35,10 +35,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
MatchesStart,
),
Exactness(
Rank {
rank: 6,
max_rank: 6,
ExactWords(
ExactWords {
matching_words: 5,
max_matching_words: 5,
},
),
],
@ -55,10 +55,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 6,
max_rank: 6,
ExactWords(
ExactWords {
matching_words: 5,
max_matching_words: 5,
},
),
],
@ -75,10 +75,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 3,
max_rank: 3,
ExactWords(
ExactWords {
matching_words: 2,
max_matching_words: 2,
},
),
],

View File

@ -15,10 +15,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 3,
max_rank: 3,
ExactWords(
ExactWords {
matching_words: 2,
max_matching_words: 2,
},
),
],
@ -35,10 +35,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
MatchesStart,
),
Exactness(
Rank {
rank: 3,
max_rank: 3,
ExactWords(
ExactWords {
matching_words: 2,
max_matching_words: 2,
},
),
],
@ -55,10 +55,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 3,
max_rank: 3,
ExactWords(
ExactWords {
matching_words: 2,
max_matching_words: 2,
},
),
],

View File

@ -15,10 +15,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 5,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 4,
max_matching_words: 4,
},
),
Typo(
@ -41,10 +41,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 4,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 3,
max_matching_words: 4,
},
),
Typo(
@ -67,10 +67,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 4,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 3,
max_matching_words: 4,
},
),
Typo(
@ -93,10 +93,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 4,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 3,
max_matching_words: 4,
},
),
Typo(
@ -119,10 +119,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 3,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 2,
max_matching_words: 4,
},
),
Typo(

View File

@ -15,10 +15,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 10,
max_rank: 10,
ExactWords(
ExactWords {
matching_words: 9,
max_matching_words: 9,
},
),
],
@ -35,10 +35,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 9,
max_rank: 9,
ExactWords(
ExactWords {
matching_words: 8,
max_matching_words: 8,
},
),
],
@ -55,10 +55,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 8,
max_rank: 8,
ExactWords(
ExactWords {
matching_words: 7,
max_matching_words: 7,
},
),
],
@ -75,10 +75,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 8,
max_rank: 8,
ExactWords(
ExactWords {
matching_words: 7,
max_matching_words: 7,
},
),
],
@ -95,10 +95,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 6,
max_rank: 6,
ExactWords(
ExactWords {
matching_words: 5,
max_matching_words: 5,
},
),
],
@ -115,10 +115,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 5,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 4,
max_matching_words: 4,
},
),
],
@ -135,10 +135,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 4,
max_rank: 4,
ExactWords(
ExactWords {
matching_words: 3,
max_matching_words: 3,
},
),
],
@ -155,10 +155,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 3,
max_rank: 3,
ExactWords(
ExactWords {
matching_words: 2,
max_matching_words: 2,
},
),
],
@ -175,10 +175,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],

View File

@ -15,10 +15,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 10,
max_rank: 10,
ExactWords(
ExactWords {
matching_words: 9,
max_matching_words: 9,
},
),
],
@ -35,10 +35,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 4,
max_rank: 4,
ExactWords(
ExactWords {
matching_words: 3,
max_matching_words: 3,
},
),
],
@ -55,10 +55,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 3,
max_rank: 3,
ExactWords(
ExactWords {
matching_words: 2,
max_matching_words: 2,
},
),
],
@ -75,10 +75,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 3,
max_rank: 3,
ExactWords(
ExactWords {
matching_words: 2,
max_matching_words: 2,
},
),
],
@ -95,10 +95,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],
@ -115,10 +115,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],

View File

@ -15,10 +15,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 10,
max_rank: 10,
ExactWords(
ExactWords {
matching_words: 9,
max_matching_words: 9,
},
),
],
@ -35,10 +35,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 10,
max_rank: 10,
ExactWords(
ExactWords {
matching_words: 9,
max_matching_words: 9,
},
),
],
@ -55,10 +55,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
MatchesStart,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],
@ -75,10 +75,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],
@ -95,10 +95,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],
@ -115,10 +115,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],
@ -135,10 +135,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],

View File

@ -15,10 +15,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 10,
max_rank: 10,
ExactWords(
ExactWords {
matching_words: 9,
max_matching_words: 9,
},
),
],
@ -35,10 +35,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 10,
max_rank: 10,
ExactWords(
ExactWords {
matching_words: 9,
max_matching_words: 9,
},
),
],
@ -55,10 +55,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
MatchesStart,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],
@ -75,10 +75,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],
@ -95,10 +95,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],
@ -115,10 +115,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],
@ -135,10 +135,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],

View File

@ -15,10 +15,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 10,
max_rank: 10,
ExactWords(
ExactWords {
matching_words: 9,
max_matching_words: 9,
},
),
Proximity(
@ -41,10 +41,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 10,
max_rank: 10,
ExactWords(
ExactWords {
matching_words: 9,
max_matching_words: 9,
},
),
Proximity(
@ -67,10 +67,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 10,
max_rank: 10,
ExactWords(
ExactWords {
matching_words: 9,
max_matching_words: 9,
},
),
Proximity(

View File

@ -15,10 +15,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 10,
max_rank: 10,
ExactWords(
ExactWords {
matching_words: 9,
max_matching_words: 9,
},
),
Proximity(
@ -41,10 +41,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 10,
max_rank: 10,
ExactWords(
ExactWords {
matching_words: 9,
max_matching_words: 9,
},
),
Proximity(
@ -67,10 +67,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 10,
max_rank: 10,
ExactWords(
ExactWords {
matching_words: 9,
max_matching_words: 9,
},
),
Proximity(
@ -93,10 +93,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
MatchesStart,
),
Exactness(
Rank {
rank: 5,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 4,
max_matching_words: 4,
},
),
Proximity(
@ -119,10 +119,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
MatchesStart,
),
Exactness(
Rank {
rank: 5,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 4,
max_matching_words: 4,
},
),
Proximity(
@ -145,10 +145,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
MatchesStart,
),
Exactness(
Rank {
rank: 5,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 4,
max_matching_words: 4,
},
),
Proximity(
@ -171,10 +171,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 5,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 4,
max_matching_words: 4,
},
),
Proximity(
@ -197,10 +197,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 5,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 4,
max_matching_words: 4,
},
),
Proximity(
@ -223,10 +223,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 5,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 4,
max_matching_words: 4,
},
),
Proximity(

View File

@ -21,10 +21,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 5,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 4,
max_matching_words: 4,
},
),
],
@ -47,10 +47,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 4,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 3,
max_matching_words: 4,
},
),
],
@ -73,10 +73,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 4,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 3,
max_matching_words: 4,
},
),
],
@ -99,10 +99,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 3,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 2,
max_matching_words: 4,
},
),
],

View File

@ -15,10 +15,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 10,
max_rank: 10,
ExactWords(
ExactWords {
matching_words: 9,
max_matching_words: 9,
},
),
],
@ -35,10 +35,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 7,
max_rank: 10,
ExactWords(
ExactWords {
matching_words: 6,
max_matching_words: 9,
},
),
],
@ -55,10 +55,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 9,
max_rank: 9,
ExactWords(
ExactWords {
matching_words: 8,
max_matching_words: 8,
},
),
],
@ -75,10 +75,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 6,
max_rank: 9,
ExactWords(
ExactWords {
matching_words: 5,
max_matching_words: 8,
},
),
],
@ -95,10 +95,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 8,
max_rank: 8,
ExactWords(
ExactWords {
matching_words: 7,
max_matching_words: 7,
},
),
],
@ -115,10 +115,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 8,
max_rank: 8,
ExactWords(
ExactWords {
matching_words: 7,
max_matching_words: 7,
},
),
],
@ -135,10 +135,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 5,
max_rank: 8,
ExactWords(
ExactWords {
matching_words: 4,
max_matching_words: 7,
},
),
],
@ -155,10 +155,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 5,
max_rank: 8,
ExactWords(
ExactWords {
matching_words: 4,
max_matching_words: 7,
},
),
],
@ -175,10 +175,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 6,
max_rank: 6,
ExactWords(
ExactWords {
matching_words: 5,
max_matching_words: 5,
},
),
],
@ -195,10 +195,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 3,
max_rank: 6,
ExactWords(
ExactWords {
matching_words: 2,
max_matching_words: 5,
},
),
],
@ -215,10 +215,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 5,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 4,
max_matching_words: 4,
},
),
],
@ -235,10 +235,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 3,
max_rank: 5,
ExactWords(
ExactWords {
matching_words: 2,
max_matching_words: 4,
},
),
],
@ -255,10 +255,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 4,
max_rank: 4,
ExactWords(
ExactWords {
matching_words: 3,
max_matching_words: 3,
},
),
],
@ -275,10 +275,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 4,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 3,
},
),
],
@ -295,10 +295,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 3,
max_rank: 3,
ExactWords(
ExactWords {
matching_words: 2,
max_matching_words: 2,
},
),
],
@ -315,10 +315,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 3,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 2,
},
),
],
@ -335,10 +335,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],
@ -355,10 +355,10 @@ expression: "format!(\"{document_ids_scores:#?}\")"
ExactAttribute(
ExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],

View File

@ -37,10 +37,10 @@ expression: "format!(\"{document_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 4,
max_rank: 4,
ExactWords(
ExactWords {
matching_words: 3,
max_matching_words: 3,
},
),
],
@ -78,10 +78,10 @@ expression: "format!(\"{document_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 4,
max_rank: 4,
ExactWords(
ExactWords {
matching_words: 3,
max_matching_words: 3,
},
),
],
@ -119,10 +119,10 @@ expression: "format!(\"{document_scores:#?}\")"
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 4,
max_rank: 4,
ExactWords(
ExactWords {
matching_words: 3,
max_matching_words: 3,
},
),
],

View File

@ -120,10 +120,10 @@ fn test_ignore_stop_words() {
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],
@ -173,10 +173,10 @@ fn test_ignore_stop_words() {
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],
@ -226,10 +226,10 @@ fn test_ignore_stop_words() {
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],
@ -278,10 +278,10 @@ fn test_ignore_stop_words() {
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 3,
max_rank: 3,
ExactWords(
ExactWords {
matching_words: 2,
max_matching_words: 2,
},
),
],
@ -337,10 +337,10 @@ fn test_stop_words_in_phrase() {
ExactAttribute(
MatchesStart,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],
@ -378,10 +378,10 @@ fn test_stop_words_in_phrase() {
ExactAttribute(
MatchesStart,
),
Exactness(
Rank {
rank: 2,
max_rank: 2,
ExactWords(
ExactWords {
matching_words: 1,
max_matching_words: 1,
},
),
],
@ -430,10 +430,10 @@ fn test_stop_words_in_phrase() {
ExactAttribute(
NoExactMatch,
),
Exactness(
Rank {
rank: 4,
max_rank: 4,
ExactWords(
ExactWords {
matching_words: 3,
max_matching_words: 3,
},
),
],