Skip to content

Commit

Permalink
David leifker/elasticsearch optimization ext (#6922)
Browse files Browse the repository at this point in the history
  • Loading branch information
david-leifker authored Jan 2, 2023
1 parent 656ceb6 commit 8faf542
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.linkedin.metadata.search.ranker.SearchRanker;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ private static Map<String, Object> buildAnalyzers(String mainTokenizer) {
// Analyzer for case-insensitive exact matching - Only used when building queries
analyzers.put(KEYWORD_LOWERCASE_ANALYZER, ImmutableMap.<String, Object>builder()
.put(TOKENIZER, KEYWORD_TOKENIZER)
.put(FILTER, ImmutableList.of("trim", LOWERCASE, ASCII_FOLDING))
.put(FILTER, ImmutableList.of("trim", LOWERCASE, ASCII_FOLDING, SNOWBALL))
.build());

// Analyzer for getting urn components
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,17 @@ public void testSmokeTestQueries() {
String.format("Search term `%s` has %s fulltext results, expected %s results.", key,
actualCount, expectedCount));
});

results = expectedMinimums.entrySet().stream()
.collect(Collectors.toMap(Map.Entry::getKey, entry -> searchStructured(searchService, entry.getKey())));

results.forEach((key, value) -> {
Integer actualCount = value.getEntities().size();
Integer expectedCount = expectedMinimums.get(key);
assertTrue(actualCount >= expectedCount,
String.format("Search term `%s` has %s structured results, expected %s results.", key,
actualCount, expectedCount));
});
}

@Test
Expand Down

0 comments on commit 8faf542

Please sign in to comment.