Skip to content

Commit

Permalink
fixup! fix(core): export all weighted search functions and types
Browse files Browse the repository at this point in the history
  • Loading branch information
robinpyon committed Jul 14, 2023
1 parent 4e15ca7 commit ba27885
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/@sanity/base/src/_exports/_internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type {DocumentAvailability} from '../preview/types'
export {AvailabilityReason} from '../preview/types'

export {getSearchableTypes} from '../search/common/utils'
export {createWeightedSearch} from '../search/weighted/createWeightedSearch'
export {createSearchQuery, createWeightedSearch} from '../search/weighted'
export type {WeightedHit} from '../search/weighted/types'

export {createHookFromObservableFactory} from '../util/createHookFromObservableFactory'
Expand Down
4 changes: 2 additions & 2 deletions packages/@sanity/base/src/search/weighted/applyWeights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function applyWeights(
}

/**
* Generate a sccore on the total number of matching characters.
* For phrases: score on the total number of matching characters.
* E.g. given the phrases ["the fox", "of london"] for the target value "the wily fox of london"
*
* - "the fox" isn't included in the target value (score: 0)
Expand Down Expand Up @@ -114,7 +114,7 @@ export function calculatePhraseScore(uniqueSearchPhrases: string[], value: strin
}

/**
* Generate a score on the total number of matching characters.
* For words: score on the total number of matching words.
* E.g. given the terms ["bar", "fo"] for the target value "food bar".
*
* - "fo" is included in the target value, and 2 out of 7 non-whitespace characters match (score: 2/7)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {ExperimentalSearchPath} from '@sanity/types'
import {compact, flatten, flow, toLower, trim, union, uniq, words} from 'lodash'
import {ExperimentalSearchPath} from '../../../../types'
import {joinPath} from '../../util/searchUtils'
import {tokenize} from '../common/tokenize'
import type {
Expand Down

0 comments on commit ba27885

Please sign in to comment.