-
Notifications
You must be signed in to change notification settings - Fork 1
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
Ensuring we always have a known boolean operator #143
Conversation
|
||
class DefaultBooleanAndSuite extends munit.FunSuite { | ||
|
||
val parser = new QueryParser(defaultBooleanOR = false) |
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.
I do find this defaultBooleanOR = false
a bit awkward to work with implying that we have a parser with defaultBooleanAnd-like behaviour
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.
I added a convenience method to the companion object so this now looks like:
val parser = QueryParser.withDefaultOperatorAND
Which is a bit more explicit.
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.
Nice changes, thank you! Left an optional comment/question.
The default `QueryParser` automatically inserts an `OR` operation inbetween consecutive terms. | ||
|
||
```scala mdoc | ||
QueryParser.withDefaultOperatorOR.parse("cats dogs") |
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.
Perhaps worth noting that QueryParser.parse("cats OR dogs")
also is OR by default?
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.
maybe..... I don't know yet if we should keep the QueryParser.parse
convenience forever...
So maybe, for now we encourage folks to be explicit with QueryParser.withDefaultOperatorOR.parse
or QueryParser.default.parse
and then eventually require it?
For now I think I prefer recommending the explicit thing.
This PR tackles a handful of issues:
(but hopefully the commits are still pretty isolated and clean 😬 )
QueryParser
a class with adefaultBooleanOR
paramGroup
to take only a singleQuery
instead of a listQuery
hierarchy #142MinimumMatch
query is an exception to this, it contains a list of queries that truly are not linked by either anAND
orOR
MultiQuery
Query
hierarchy #142There remain a handful of TODO comments in the tests.
This are mostly around needlessly nested queries. But I think resolving these might make this PR even larger...