typesense / typesense

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences
https://typesense.org
GNU General Public License v3.0
20.97k stars 650 forks source link

Search does not return results for ec2 instance identifiers partial search #2017

Open mpurusottamc opened 1 week ago

mpurusottamc commented 1 week ago

Description

We use Typesense to load our AWS Resources information. As part of the resources, we have ec2 instances loaded as well. We load resource name, identifier, arn, etc.

When we search for name or the entire arn, typesense returns the entire object. But, when we search with instance id, response is null.

Example record:

{
    "asset_active": true,
    "asset_identifier": "06c7cf37-d086-47dc-920b-8279e0f097db",
    "asset_label": "server-name-123",
    "asset_upstream_key": "arn:aws:ec2:ap-south-1:012345678901:instance/i-0123456789abcdefg",
    "region_name": "us-east-1"
}

When we search with server-name-123 or arn:aws:ec2:ap-south-1:012345678901:instance/i-0123456789abcdefg, we get the following result:

{
    "asset_count": 1,
    "assets":
    [
        {
            "asset_active": true,
            "asset_identifier": "06c7cf37-d086-47dc-920b-8279e0f097db",
            "asset_label": "server-name-123",
            "asset_upstream_key": "arn:aws:ec2:ap-south-1:012345678901:instance/i-0123456789abcdefg",
            "region_name": "us-east-1"
        }
    ]
}

But, when we search with i-0123456789abcdefg, we get empty result.

{
    "asset_count": 0,
    "assets": null
}

Metadata

Typesense Version: 0.24.1

OS: Ubuntu 20.04

Any help is much appreciated.

jasonbosco commented 1 week ago

You want to set token_separators: ["/"] in the collection schema when creating the schema.

Here's a detailed guide on how that parameter works: https://typesense.org/docs/guide/tips-for-searching-common-types-of-data.html

mpurusottamc commented 1 week ago

That was super fast. Thanks for sharing the guide. I will try it out and share the results here.