Repository navigation
feat(core): add useSearch().unified - #245
Dustin-Kelley wants to merge 6 commits into
Conversation
buildUnifiedSearchCall keeps bibleId and language ranges, and it puts fields and userIntent on options only when the caller sets them. mapUnifiedSearchImages maps passage_id to passageId, turns a missing list into an empty list, and drops a hit that lacks a string id or passage_id. Co-authored-by: Dustin Kelley <Dustin-Kelley@users.noreply.github.com>
The method takes a query, a bible id, language ranges, and optional fields and user intent. requestUnifiedSearch throws until @youversion/platform-core publishes SearchClient.searchUnified, and the wrapper reports that as a transient error. Live image results wait on that client (YPE-6190). Co-authored-by: Dustin Kelley <Dustin-Kelley@users.noreply.github.com>
BrowserStack App Live
Review-fix commits are not uploaded automatically. To upload the current PR head again, comment one of:
Replace Only approved collaborators on |
@youversion/platform-core 2.13.0 does not export searchUnified. useSearch().unified calls GET /v1/search-unified and returns verses, topics, and images. Replace requestUnifiedSearch with SearchClient.searchUnified when it ships. Co-authored-by: Dustin Kelley <Dustin-Kelley@users.noreply.github.com>
The sample label was the word beta. It is now bravo. Co-authored-by: Dustin Kelley <Dustin-Kelley@users.noreply.github.com>
The stand-in matches platform-sdk-react #446, including its result type. Co-authored-by: Dustin Kelley <Dustin-Kelley@users.noreply.github.com>
The package build rejects an unused type. Export the check so the copy still compiles. Co-authored-by: Dustin Kelley <Dustin-Kelley@users.noreply.github.com>
Why
useSearch().unifiedshould call the same unified search as the React SDK.@youversion/platform-core2.13.0 does not exportsearchUnified. This package callsGET /v1/search-unifiedthrough a local copy until that function ships.No example app changes being shipped but just proves the hook/api works

What changed
searchUnifiedfrom platform-sdk-react #446, including its types.query,bible_id,language_ranges[], and optionaluser_intentandfields[]. Fields areversesortopics.didYouMean, andsearchInsteadFor.userIntentis set when the API sends one.imagesis present only when the response includes a non-empty image array, and those values are passed through unchanged.Scope
Tradeoffs
When core publishes
searchUnified, change the import inpackages/core/src/search/api.tsfrom./search-unifiedto@youversion/platform-coreand deletesearch-unified.ts,search-unified-schema.ts, andbible-version-id.ts. TheuseSearch().unifiedmethod stays.Blast Radius
useSearch()keeps theunifiedmethod. Verse search and topic search stay as they are. No screen callsunifiedyet. The result shape now matches the React type, so stubs includedidYouMeanandsearchInsteadFor.Verification
pnpm lintpassed.