-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more explicit interface to differentiate substring and full-string wildcard queries. #62
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve add_wildcard_query
clp_ffi_py/ir/query_builder.py
Outdated
@no_type_check | ||
def add_wildcard_query(self, *args: Tuple[Any, ...], **kwargs: Dict[str, Any]) -> QueryBuilder: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed lets drop no_type_check
and lets try a different approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets change the title + commit message to something more direct like:
Add more explicit interface to differentiate substring and full-string wildcard queries. (#62).
The commit msg lgtm, thx! |
…oduced in #62. (#63) Co-authored-by: Kirk Rodrigues <[email protected]>
References
Description
As discussed in PR #27, users usually want the query to be automatically surrounded with wildcard
*
to match a substring. This PR implements such a query in a way we discussed and agreed on in PR #27. Essentially, this PR contains the following changes:WildcardQuery
classes.WildcardQuery
is now marked as deprecated. Instead, users should use its derived classSubstringWildcardQuery
andFullStringWildcardQuery
to define a wildcard query. When usingSubstringWildcardQuery
,*
prefix and postfix will be automatically added to match a substring.QueryBuilder
to change the method's signature ofadd_wildcard_query
. It's taking aWildcardQuery
class instead of a string and a boolean argument. The old signature can still be called but it is marked as deprecated.We can support substring matches without breaking existing user code with the above implementations. In the future, we should also do the following cleanup:
add_wildcard_query
WildcardQuery
as an abstract base classValidation performed