Repository navigation
Let suggest ignore the words a search box names - #742
Merged
Merged
Conversation
A word the substring index serves can be as useless as a short one when it occurs in a large share of the rows: "the" is three characters, so the trigram index on PostgreSQL serves it, but it matches a third of the titles in a movie catalog. suggest takes a set of words to ignore right after the input, in Java and Kotlin. An ignored word is treated as a short word is: it takes no part in the predicate, compared ignoring case, and an input of ignored words alone matches no rows. search takes no set. Fixes #741
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Fixes #741
suggestignores a word shorter than the database's substring index serves, and matches no rows when no word is left. A word the index does serve can be as useless when it occurs in a large share of the rows:theis three characters, so the trigram index on PostgreSQL serves it, but it matches a third of the titles in a movie catalog. Typed alone it returns a page of noise, and next to another word it narrows nothing.Which words those are depends on the column's content, so the search box names them, as it names the columns.
suggesttakes the words to ignore right after the input, in both languages:An ignored word is treated as a short word is: it takes no part in the predicate, compared ignoring case as the words themselves match, and an input without a remaining word matches no rows. A quoted phrase is one word, ignored when it equals an ignored word.
the godmatches ongodalone;thealone matches no rows.searchtakes no set: on a results page a frequent word next to a longer one costs nothing and still narrows correctly.Changes
PredicateBuilderFactory.suggest(input, ignore, paths): ignored words are filtered before theSearchnode is built, so the node and its dialect-dependent resolve step are unchanged.WhereBuilder.suggest(input, ignore, path, more...)in Java; the abstractsuggestImpltakes the set. The Kotlin top-levelsuggestgains the same overload.suggest.