Skip to content

Commit

Permalink
Add support for wildcard field type
Browse files Browse the repository at this point in the history
This adds support for the "wildcard" field type that supports efficient
execution of wildcard and prefix queries by matching first against
trigrams (or bigrams or individual characters), then post-filtering by
evaluating the original field value against the pattern.

It also supports post-filtering by regexp queries, but doesn't yet have
an efficient first-phase approximation. (For general regex queries,
we'll probably never have a "good" first-phase approximation.)

Signed-off-by: Michael Froh <froh@amazon.com>
  • Loading branch information
msfroh committed Apr 30, 2024
1 parent f84d28d commit 3bd8f40
Show file tree
Hide file tree
Showing 5 changed files with 914 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ protected void parseCreateField(ParseContext context) throws IOException {
}
}

private static String normalizeValue(NamedAnalyzer normalizer, String field, String value) throws IOException {
static String normalizeValue(NamedAnalyzer normalizer, String field, String value) throws IOException {
try (TokenStream ts = normalizer.tokenStream(field, value)) {
final CharTermAttribute termAtt = ts.addAttribute(CharTermAttribute.class);
ts.reset();
Expand Down
Loading

0 comments on commit 3bd8f40

Please sign in to comment.