test: cover search_with_snippets/5 and search_prefix/4#30
Merged
Conversation
These two public Searcher functions had no direct tests — only their fuzzy variants (search_fuzzy_with_snippets, search_fuzzy_prefix) were covered. Add dedicated test files following the existing per-feature convention: - snippets_test.exs: snippet map shape, <b> highlighting, multiple snippet fields, max_snippet_chars truncation, limit (total_hits reflects the returned/capped count) - prefix_test.exs: prefix matching, typeahead narrowing, limit, no-match Full suite: 245 passed.
total_hits equals length(hits) and is capped by :limit across all search functions (every collector is TopDocs::with_limit). Add a note to search_query/4, search_with_snippets/5, and search_prefix/4 pointing to count/3 for the full match count regardless of limit.
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.
Summary
Closes the test gap found during the 0.5.5 smoke test:
Searcher.search_with_snippets/5(plain highlighting) and
Searcher.search_prefix/4(typeahead) were public APIwith no direct coverage — only their fuzzy variants (
search_fuzzy_with_snippets,search_fuzzy_prefix) were tested. Both work; they just weren't guarded againstregressions.
What's added
Two dedicated test files, following the existing per-feature convention
(
count_test.exs,regex_query_test.exs, …),async: true,test_pathsetupwith
TestHelpers.safe_rm_rf:test/muninn/snippets_test.exs—search_with_snippets/5<b>tagsmax_snippet_charstruncates long contentlimit(documents thattotal_hitsreflects the returned/capped count)test/muninn/prefix_test.exs—search_prefix/4limitoptionVerification
MUNINN_BUILD=true mix test→ 245 passed (1 doctest, 244 tests), +9 new.