Skip to content

Filtering not working at sub-queries level #304

@roosmaa

Description

@roosmaa

When working with more advanced queries (QueryCombination), it seems that the filter property is only being applied at the final results level, instead of sub-query level as the type definitions would suggest. There's no mention of this restriction on filter in the docs either.

For example, the following query wouldn't do any filtering at all:

myIndex.search({
  combineWith: 'OR',
  queries: [{
    queries: ["term1"],
    filter: (doc) => doc.type === 'foo',
  }, {
    queries: ["term2"],
    filter: (doc) => doc.type === 'bar',
  }],
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions