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

groups are getting flattened in a group_by query #178

Open
majestiq opened this issue Jul 25, 2023 · 1 comment
Open

groups are getting flattened in a group_by query #178

majestiq opened this issue Jul 25, 2023 · 1 comment

Comments

@majestiq
Copy link

Description

when using a group by query with the instantsearch adapter, the results will be flattened. ie: groupLimit = 4 means that I will have # of results per page X 4 results showing on the page.

Expected Behavior

Only show the first items from the group and allow secondary items in the group to be access via an array in the Hits object rendering. That way, from the Hits widget, we can put in custom rendering to decide how to handle additional items in a group.

@jasonbosco
Copy link
Member

@majestiq This is a great idea!

I've added the ability to turn off grouped result flattening in 2.7.1-4 of the adapter. If you upgrade to it and then add flattenGroupedHits: false you should see unflattened results:

const typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({
    server: {
      apiKey: "xyz",
      nodes: [
        {
          host: "localhost",
          port: "8108",
          path: "/",
          protocol: "http",
        },
      ],
    },
    flattenGroupedHits: false, // <=======
    additionalSearchParameters,
  });

Could you give it a shot and let me know how it goes?

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

No branches or pull requests

2 participants