fix: surface search hit titles instead of dropping them - #88
Open
ayushsingh82 wants to merge 1 commit into
Open
Conversation
search()'s mapper discarded the title field even though getProfile() already returned it, and neither formatSearchResults() nor formatContext() ever rendered it - so titles were dropped everywhere, even where the API already provided them. Titles are generated from the first line of saved content and are the only thing that distinguishes similar-looking results. - search() now maps title alongside memory/chunk - formatSearchResults() and formatContext() prefix a result line with its title when present, and are unaffected when it's absent Related to supermemoryai#86.
Contributor
Author
|
@Dhravya fixes search hit titles being silently dropped. Please take a look. |
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
Another of the smaller gaps flagged in #86 that isn't covered by #83.
search()'s mapper never includedtitle, even thoughgetProfile()'s mapper already does. But it turns out neitherformatSearchResults()(used bysearch-memory.cjs) norformatContext()(used for the injected recall context) ever read.titlein the first place — so titles were being silently dropped in every path, including the one where the field was already being mapped. Titles are generated from the first line of saved content and are currently the only thing that could disambiguate two similar-looking results, per the original report.This PR:
title: r.titletosearch()'s mapper, for parity withgetProfile()formatSearchResults()andformatContext()actually prefix a result line with its title when present (Title: memory text [pct%]), and leaves output unchanged when there's no titleTest plan
npm testpasses, including new cases intest/unit.mjs:formatSearchResultslabels a hit with its title when presentformatSearchResultsoutput is unchanged when there's no titleformatContext's "Relevant Memories" section also picks up the titlenpm run lintpassesplugin/scripts/*.cjsrebuilt vianpm run buildand committed alongside thesrc/changes