Closed aecio closed 2 months ago
Seems our function signatures for both in Rust and in Python (BooleanQuery and DistjunctionMaxQuery) are quite different. Would you mind reviewing my commit as well #243 so that we might come up with a more consistent function signature?
It looks like the main difference is the use of PyList vs. Vec for the subqueries parameter. I can try to change it to use Vec instead if you think it's better. I assume PyO3 checks the types automatically in that case, so it's not necessary to check the types manually in the Rust implementation? I'll rebase and try to make these changes tomorrow.
I have no preference actually, perhaps @cjrh may provide us some feedback? Whether you think PyList or Vec is better for the project. I can submit another PR for the BooleanQuery.
My preference is to use the Rust types like Vec
in general, and take advantage of PyO3's automatic conversion, like in the BooleanQuery
PR. Thanks @alex-au-922 for having a look at this PR too.
Hi all, thanks for the review!
I just pushed a new commit with the following Python signatures and using Rust's Vec<Query>
:
@staticmethod
def boolean_query(subqueries: Sequence[tuple[Occur, Query]]) -> Query:
pass
@staticmethod
def disjunction_max_query(subqueries: Sequence[Query], tie_breaker: Optional[float] = None) -> Query:
pass
#[staticmethod]
pub(crate) fn disjunction_max_query(
subqueries: Vec<Query>,
tie_breaker: Option<&PyFloat>,
) -> PyResult<Query>
Let me know if this addresses the comments.
I'm fixing the CI issue here: https://github.com/quickwit-oss/tantivy-py/pull/251
When that's merged these tests can rerun.
I approved the PR, just waiting to get a clean test run before merging.
Thank you all for the reviews and merging.
@aecio No, thank you for your contribution 👏🏼 🙇🏼
Added the
Query.disjunction_max_query
method and corresponding tests.Expected usage:
See also issue #20.