Skip to content

Commit

Permalink
[feat] 0.23.7
Browse files Browse the repository at this point in the history
  • Loading branch information
ppodolsky committed May 11, 2024
1 parent f1d4dc4 commit 8b06507
Show file tree
Hide file tree
Showing 6 changed files with 280 additions and 6 deletions.
1 change: 0 additions & 1 deletion aiosumma/aiosumma/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from .proto import index_service_pb2 as index_service_pb
from .proto import query_pb2 as query_pb
from .proto import reflection_service_pb2 as reflection_service_pb
from .proto import search_service_pb2 as search_service_pb
from .proto.consumer_service_pb2_grpc import ConsumerApiStub
from .proto.index_service_pb2_grpc import IndexApiStub
from .proto.reflection_service_pb2_grpc import ReflectionApiStub
Expand Down
266 changes: 266 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ readme = "README.md"

[tool.poetry.dependencies]
python = "^3.9"
aiogrpcclient = "^1.3.5"


[build-system]
Expand Down
11 changes: 7 additions & 4 deletions summa-core/src/components/query_parser/morphology/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::collections::HashSet;
use summa_proto::proto;
use tantivy::query::{DisjunctionMaxQuery, Query, TermQuery};
use tantivy::schema::{Field, FieldType, IndexRecordOption};
Expand All @@ -20,12 +21,14 @@ pub trait Morphology: MorphologyClone + Send + Sync {
let term = cast_field_to_term(field, full_path, field_type, text, false);
return Box::new(TermQuery::new(term, IndexRecordOption::WithFreqs)) as Box<dyn Query>;
};
let mut terms = vec![text.to_string()];
let mut terms = HashSet::new();
terms.insert(text.to_string());
if let Some(other_tense_text) = self.derive_tenses(text) {
terms.push(other_tense_text);
terms.insert(other_tense_text);
}
let corrected_spellings: Vec<_> = terms.iter().filter_map(|t| self.derive_spelling(t)).collect();
terms.extend(corrected_spellings);
terms.extend(terms.iter().filter_map(|t| self.derive_spelling(t)).collect::<Vec<_>>());
terms.extend(terms.iter().filter_map(|t| self.derive_tenses(t)).collect::<Vec<_>>());
let terms = Vec::from_iter(terms.into_iter());
if terms.len() == 1 {
Box::new(TermQuery::new(
cast_field_to_term(field, full_path, field_type, &terms[0], false),
Expand Down
5 changes: 5 additions & 0 deletions summa-core/src/components/query_parser/summa_ql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,11 @@ mod tests {
assert_eq!(format!("{:?}", query), "Ok(BooleanQuery { subqueries: [(Should, TermQuery(Term(field=0, type=Str, \"red1\"))), (Should, DisjunctionMaxQuery { disjuncts: [TermQuery(Term(field=0, type=Str, \"search\")), TermQuery(Term(field=0, type=Str, \"searches\"))], tie_breaker: 0.3 }), (Should, DisjunctionMaxQuery { disjuncts: [TermQuery(Term(field=0, type=Str, \"engine\")), TermQuery(Term(field=0, type=Str, \"engines\"))], tie_breaker: 0.3 }), (Should, TermQuery(Term(field=0, type=Str, \"going\")))] })");
let query = query_parser.parse_query("iso 34-1:2022");
assert_eq!(format!("{:?}", query), "Ok(BooleanQuery { subqueries: [(Should, DisjunctionMaxQuery { disjuncts: [TermQuery(Term(field=0, type=Str, \"iso\")), TermQuery(Term(field=0, type=Str, \"isos\"))], tie_breaker: 0.3 }), (Should, TermQuery(Term(field=0, type=Str, \"34\"))), (Should, TermQuery(Term(field=0, type=Str, \"1\")))] })");
let query = query_parser.parse_query("http://www.aaa.com-inward-record-b-c\naaaa");
assert_eq!(
format!("{:?}", query),
""
);
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion summa-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "summa-server"
version = "0.23.6"
version = "0.23.7"
license-file = "LICENSE"
description = "Fast full-text search server"
homepage = "https://github.com/izihawa/summa"
Expand Down

0 comments on commit 8b06507

Please sign in to comment.