WIP/BUG: fix handling of numeric queries in search_regex#363
Draft
tangkong wants to merge 2 commits intopcdshub:masterfrom
Draft
WIP/BUG: fix handling of numeric queries in search_regex#363tangkong wants to merge 2 commits intopcdshub:masterfrom
tangkong wants to merge 2 commits intopcdshub:masterfrom
Conversation
Contributor
Author
|
test failures related to click, addressed in #362 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Handle numeric queries in
search_regexin an intuitive way, rather than by forcing normal text searchesMotivation and Context
#256
There's a few edge cases I still need to iron out here, but I wanted to throw this up for visibility. The approach I took here was to check if the provided search could be converted to a number, and if so try to perform numeric comparison.
This approach works if we have the entire document, but I don't have an analog for the mongodb backend. In the mongo case, we construct a query to pass to mongo itself, not knowing a-priori what fields are numeric and which aren't. This is a result of our very flexible schema.
Even after all this, we still fail to catch:
client.search_regex(some_field="2.0")into{... "some_field": "model 2.0 something"}should probably matchWe could maybe get around this on the json database, since we can check that both the incoming document and the query are valid numbers, but there's no such strategy in mongo-land
How Has This Been Tested?
Some tests have been added, but also interactively
Where Has This Been Documented?
This PR
Pre-merge checklist
docs/pre-release-notes.shand created a pre-release documentation page