Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hidden Hits Parameter Not Working in Multi-Search Vector Query #1738

Open
CharafLachachi opened this issue May 18, 2024 · 1 comment
Open

Comments

@CharafLachachi
Copy link

Description

When running a multi-search vector query on a collection in Typesense Cloud, the items specified in the hidden_hits parameter are still being retrieved in the results.

Steps to reproduce

  1. Create a collection with the following schema:
var collectionName = "people";
var collectionSchema = new Schema
(
    name: collectionName,
    fields:
    [
        new Field("id", FieldType.String, false),
        new Field("firstname", FieldType.String, false),
        new Field("lastname", FieldType.String, false),
        new Field("biography", FieldType.String, false),
        new Field("country", FieldType.String, false),
        new("embedding", FieldType.FloatArray, embed: new AutoEmbeddingConfig(
                        new Collection<string> { "biography", "country" },
                        new ModelConfig(llmModel)))
   ]
);
  1. Run the following multi-search vector query:
{
    "searches": [
        {
            "collection": "people",
            "vector_query": "embedding:([],id:8A0E3E51-D0C2-4F2C-8201-32EF9DFD065F,k:6)",
            "q": "*",
            "sort_by": "_vector_distance:desc",
            "hidden_hits": "31E87C56-61BC-461B-B3A8-5D30516A3354",
            "exclude_fields": "embedding"
        }
    ]
}

Expected Behavior

The items specified in the hidden_hits parameter should not be included in the search results.

Actual Behavior

The items specified in the hidden_hits parameter are still being retrieved in the search results.

Metadata

Typesense Version: 0.26.0

OS: Typesense Cloud

Additional Information
I have attached a C# console project that reproduces the issue. You can find the project
TypeSenseVectorQueryIssue.zip

@Nushio
Copy link

Nushio commented May 31, 2024

We stumbled upon the same issue when doing vector searches.

Our workaround is to use the new filter_by id for Typese v26, and include the hidden hits as a list of id:!=

Not sure if there's any performance hits for doing this, but it solved our issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants