-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: simplify search strategy configuration
The search strategy was previously selected using the `search.enableLegacySearch` boolean, which became confusing after we reverted the default behaviour. Developers had to explicitly set `search.enableLegacySearch` to `false` in order to enable the Text Search API strategy. This change deprecates `search.enableLegacySearch` in favour of the `search.strategy` union, which is clearer and more flexible. The current options are: - `"groqLegacy"`: Legacy search strategy (the current default). - `"textSearch"`: Search using the Text Search API. In the near future, we will add a new option, allowing developers to test the new GROQ search strategy. If the project already sets `search.enableLegacySearch` to `false`, this will automatically be mapped to the `"textSearch"` strategy. If the project uses both `search.enableLegacySearch` and `search.strategy`, `search.strategy` will take precedence.
- Loading branch information
Showing
22 changed files
with
300 additions
and
67 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {searchStrategies, type SearchStrategy} from './types' | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export function isSearchStrategy( | ||
maybeSearchStrategy: unknown, | ||
): maybeSearchStrategy is SearchStrategy { | ||
return searchStrategies.includes(maybeSearchStrategy as SearchStrategy) | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './asserters' | ||
export * from './types' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* @public | ||
*/ | ||
export const searchStrategies = ['groqLegacy', 'textSearch'] as const | ||
|
||
/** | ||
* @public | ||
*/ | ||
export type SearchStrategy = (typeof searchStrategies)[number] |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.