Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(types): support type and facet in search methods #1263

Merged
merged 1 commit into from Apr 9, 2021

Conversation

francoischalifour
Copy link
Member

Description

The engine recently added support for facet value search from the search and multipleQueries method.

This PR updates the MultipleQueriesQuery to reflect this change.

Usage

searchClient
  .search([
    {
      indexName: 'instant_search',
      query: 'a',
    },
    {
      type: 'facet',
      indexName: 'instant_search',
      facet: 'categories',
      query: 'a',
    },
  ])
  .then(({ results }) => {
    console.log(results);
  });

Related

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 8, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 0df02d5:

Sandbox Source
javascript-client-app Configuration

export type MultipleQueriesQuery = SharedMultipleQueriesQuery &
(
| {
readonly type?: 'default';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the problem is that it allows const once: Once = { indexName: 'test', facet: "lol" }; which is invalid

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@shortcuts shortcuts Apr 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nevermind

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but that type doesn't allow type to be omitted:

Screenshot 2021-04-09 at 13 41 47

In the end the one in this PR might be the best

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I misunderstood your intention.

Copy link
Contributor

@eunjae-lee eunjae-lee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not perfect, but I don't see an alternative

@francoischalifour francoischalifour changed the title feat(types): support type and facet in MultipleQueriesQuery feat(types): support type and facet in search methods Apr 9, 2021
@francoischalifour francoischalifour merged commit 54c1cb7 into master Apr 9, 2021
@francoischalifour francoischalifour deleted the feat/MultipleQueriesQuery-facet branch April 9, 2021 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants