Skip to content

Let suggest ignore the words a search box names - #742

Merged
zantvoort merged 1 commit into
mainfrom
feat/suggest-ignored-words
Oct 23, 2026
Merged

zantvoort merged 1 commit into
mainfrom
feat/suggest-ignored-words

Conversation

@zantvoort

Copy link
Copy Markdown
Collaborator

Fixes #741

suggest ignores 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: the is 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. suggest takes the words to ignore right after the input, in both languages:

val titleNoise = setOf("the", "a", "of")

.where(suggest(input, titleNoise, Movie_.title, Movie_.director.name))
private static final Set<String> TITLE_NOISE = Set.of("the", "a", "of");

.where(it -> it.suggest(input, TITLE_NOISE, Movie_.title, Movie_.director.name))

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 god matches on god alone; the alone matches no rows.

search takes 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 the Search node is built, so the node and its dialect-dependent resolve step are unchanged.
  • WhereBuilder.suggest(input, ignore, path, more...) in Java; the abstract suggestImpl takes the set. The Kotlin top-level suggest gains the same overload.
  • Tests in storm-core, storm-java21 and storm-kotlin: case-insensitive ignoring, ignored words alone, a quoted phrase equal to an ignored word, and the dialect that treats every word alike.
  • Docs: "Ignoring Words" under the suggest section of the Search page; the Java and Kotlin query skills; the CHANGELOG line for suggest.

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
@zantvoort zantvoort added this to the 1.16.0 milestone Oct 23, 2026
@zantvoort
zantvoort merged commit 96d6c13 into main Oct 23, 2026
9 of 10 checks passed
@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@zantvoort
zantvoort deleted the feat/suggest-ignored-words branch October 23, 2026 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

suggest: ignore the words a search box names, such as "the" in a movie catalog

1 participant