SearchRequestParams.ts 669 B

12345678910111213141516171819202122232425262728
  1. export type SearchBoolean = 1 | 0;
  2. export enum SearchMode {
  3. Advanced = 'advanced',
  4. Quick = 'quick',
  5. }
  6. interface AdvancedSearchRequestParams {
  7. exactMatchesOnly?: SearchBoolean;
  8. }
  9. interface QuickSearchRequestParams {
  10. indexes?: string;
  11. disableHighlighting?: SearchBoolean;
  12. }
  13. export type SearchRequestParams<Mode extends SearchMode> = {
  14. mode: SearchMode;
  15. query: string;
  16. size?: number;
  17. page?: number;
  18. getText?: SearchBoolean;
  19. filterTranslations?: string;
  20. filterLanguages?: string;
  21. fields?: string;
  22. translationFields?: string;
  23. words?: boolean;
  24. } & (Mode extends SearchMode.Advanced ? AdvancedSearchRequestParams : QuickSearchRequestParams);