Repository navigation
feat(app): show matches in context and scope in search - #170
Merged
Merged
Conversation
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
Search in MAPP now shows why each item matched, says plainly when the results may be incomplete, and lets the person look in the open place or everywhere. All of it comes from the working copy through the marfa-swift SDK, so it still works offline and MAPP does no matching of its own.
Chosen: the existing list sort still orders results, as before, rather than best match first. The scope control is a native segmented picker in a top safe-area bar, and it shows only while searching.
Changes
ItemSource.searchandItemLibrary.search(_:in:)now take a scope and return excerpts, an incomplete flag and a cap flag (MAPP/Model/Items/ItemSearch.swift).items(matching:)is gone.MarfaSourcemaps a place onto the SDK'sSearchFilters(type, tier, tags, listing filter,beneath, state) orsearch(inView:)for a saved view.MarfaLibraryreruns a partial search once the copy is whole and keeps the earlier results when a search fails, as before.SearchViews.swiftholds the status bar and the empty state. The list, table, gallery, board and agenda use them, and the list rows and the palette show excerpts.NoteText.snippetand its test are removed, since the SDK's excerpts replace it.MAPP/Model/AGENTS.mdhas a new Search section.Testing
xcodebuild build-for-testingand ran the whole Unit plan once: all 1047 test cases passed.MAPPTests/SearchTests.swiftcover excerpt parsing (marks, entities, an empty excerpt, a very long excerpt), the stale-excerpt guard, the scope rules, an empty query, words that find nothing, a quoted query, an item removed while shown, partial then whole, a capped answer, and the target each place sends. The existing test for a failing search (keeps results, tells the person) still passes. These tests cover APIs that did not exist onmain, so none could be run against it first.Notes for reviewers
SDK gaps found:
WorkingCopy.fake, used by the sample library, previews and the UI tests) throwsunsupportedforsearchandsearch(inView:). The sample library therefore cannot show results, excerpts or the incomplete state, and UI tests that search the sample probably fail onmainalready.SearchFilters, so they are not a gap.Completeness.staleis treated like.partial: both say the results may be incomplete. That is a judgement call.Follow-up: results are still ordered by the chosen sort (and by recency in the palette), not by the copy's relevance score.
Review depth: a normal review is enough. The riskiest parts are the rerun when the copy becomes whole (
MarfaLibrary.search) and the place-to-filter mapping (MarfaLibrary.target(for:)).Open pull requests #127, #98 and #169 also touch
MarfaLibrary.swift,ItemLibrary.swiftor the library test files, so whichever merges second may need a small rebase.Checklist