typesense / typesense/typesense

Ignore filter clause when value does not appear in any document

Open
#1,827 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature:filtering
Dominant language
C++
Stars
26.6k
Forks
973
Avg merge
18h 45m
Merged PRs (30d)
4

Description

Description

Currently, the "override rules" functionality allows us to define only simple string values for overriding configurations. It would be highly beneficial to enhance this functionality by supporting additional regex rules.

Dynamic Filters Question

curl "http://localhost:8108/collections/companies/overrides/brand-filter" -X PUT \
-H "Content-Type: application/json" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -d '{
  "rule": {
    "query": "{brand} phone",
    "match": "contains"
  },
  "filter_by": "brand:={brand}",
  "remove_matched_tokens": true
}'

What if I want to ignore the filter_by rule if the brand does not exist in my list of brands? Is there a way to conditionally apply the filter based on the presence of brand in the list?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the override-rules endpoint example for /collections/companies/overrides/brand-filter and its dynamic filter_by value, brand:={brand}. Trace how override rules and filters are applied, then define completion as conditionally ignoring the filter when the requested brand is absent while preserving the existing behavior when it is present.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.