Skip to content

Distance threshold query silently fails when using bit quantization #308

@rolf-moz

Description

@rolf-moz

This query seemed to ignore the 'v.distance <= :distanceThreshold' condition

      FROM vec_history v
      JOIN vec_history_mapping m USING (rowid)
      WHERE v.embedding MATCH :vector
        AND k = :limit
        AND v.distance <= :distanceThreshold
      ORDER BY v.distance
    )

Table was created with

      CREATE VIRTUAL TABLE vec_history USING vec0(
        embedding FLOAT[${this.#embeddingSize}]
        distance_metric=cosine
            INDEXED BY rescore(
          quantizer=bit,
          oversample=50
        )
      );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions