typesense / typesense/typesense

Should synonyms work with filtering?

Open
#268 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

We were looking at synonyms (specifically one-way synonyms) as a way to improve a client's search. The search uses filter_by in order to only return exact matches. But there's a special case of search where synonyms would be convenient.

Testing from the cli, I find that a one-way synonym works exactly as expected when using an ordinary search, but not at all when using filter_by for the search.

Am I seeing:

  • the correct behaviour?
  • a planned behaviour?
  • a bug?

Steps to reproduce

Returns synonyms in results
http://typesense/collections/vehicles/documents/search
  ?q=volkswagen golf
  &query_by=vehicle
  &include_fields=make,model,year,price
Doesn't return any synonyms in results
http://typesense/collections/vehicles/documents/search
  ?q=*
  &query_by=vehicle
  &filter_by=vehicle:=[volkswagen golf]
  &include_fields=make,model,year,price

Expected Behavior

I don't know. I can't tell from the docs if what I'm trying is expected/unexpected/desired/undesired 😀

Actual Behavior

No synonyms in results when using a filter_by query.

Metadata

Typsense Version: 0.20.0

OS: any

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

Reproduce both documented search requests from the CLI, comparing the ordinary synonym search with the filter_by request against the reported Typesense version. Read the synonym and filter_by search paths to determine whether their interaction is supported; done should include a decided behavior, matching implementation or documentation, and coverage for the reproduced case.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.