typesense / typesense/typesense

Feature Request: Allow Prefix Search on All Tokens

Open
#920 9 comments 23 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Feature Request

Hello! I would like to request the ability to do prefix searching on all tokens, similar to what Algolia provides with https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/prefix-searching/#querytypeprefixall

Use Case

My real world use case is similar to what Algolia mentions in the doc above:

If users are searching in a domain where many words are commonly shortened, prefixAll could be suitable - for example, “spec review” instead of “specification review.”

My use case is employee search. In the internal applications we build at my company, it is common to provide an employee search feature. When people search for employees, they tend to use their "nicknames" or common shortened versions of peoples names, some examples being:

  • Search "ben johnson" to find the employee who is legally named "benjamin johnson"
  • Search "andy jones" to find the employee who is legally named "anderson jones"

Currently, achieving something similar in Typesense is proving to be difficult without some unintuitive combination of search parameters or without returning several irrelevant results.

In the community Slack channel, I received a recommendation to reverse the order of the words before actually performing the search, which actually does provide the results I'm looking for, however that feels like a fragile solution that likely has some pitfalls to it. Even if that isn't the case, requiring that the frontend of an application take the extra step of reversing the searched words definitely makes it a little less "works out of the box".

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

The issue names no files, tests, or entry points. Start by locating the existing search-parameter and token-matching paths, then define how prefix matching should apply to every token and validate it against the employee-name examples in the request.

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
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.