A class that translates or converts StructuredQuery to equivalent Qdrant filters.

const selfQueryRetriever = new SelfQueryRetriever({
llm: new ChatOpenAI(),
vectorStore: new QdrantVectorStore(...),
documentContents: "Brief summary of a movie",
attributeInfo: [],
structuredQueryTranslator: new QdrantTranslator(),
});

const relevantDocuments = await selfQueryRetriever.getRelevantDocuments(
"Which movies are rated higher than 8.5?",
);

Type Parameters

Hierarchy (view full)

Constructors

Properties

VisitComparisonOutput: {
    key: string;
    geo_bounding_box?: null | Record<string, unknown> | {
        bottom_right: {
            lat: number;
            lon: number;
        };
        top_left: {
            lat: number;
            lon: number;
        };
    };
    geo_polygon?: null | Record<string, unknown> | {
        exterior: {
            points: {
                lat: number;
                lon: number;
            }[];
        };
        interiors?: null | {
            points: {
                lat: number;
                lon: number;
            }[];
        }[];
    };
    geo_radius?: null | Record<string, unknown> | {
        center: {
            lat: number;
            lon: number;
        };
        radius: number;
    };
    match?:
        | null
        | Record<string, unknown>
        | {
            value: string | number | boolean;
        }
        | {
            text: string;
        }
        | {
            any: string[] | number[];
        }
        | {
            except: string[] | number[];
        };
    range?:
        | null
        | Record<string, unknown>
        | {
            gt?: null | number;
            gte?: null | number;
            lt?: null | number;
            lte?: null | number;
        }
        | {
            gt?: null | string;
            gte?: null | string;
            lt?: null | string;
            lte?: null | string;
        };
    values_count?: null | Record<string, unknown> | {
        gt?: null | number;
        gte?: null | number;
        lt?: null | number;
        lte?: null | number;
    };
}

Type declaration

  • key: string

    Payload key

  • Optionalgeo_bounding_box?: null | Record<string, unknown> | {
        bottom_right: {
            lat: number;
            lon: number;
        };
        top_left: {
            lat: number;
            lon: number;
        };
    }

    Check if points geo location lies in a given area

  • Optionalgeo_polygon?: null | Record<string, unknown> | {
        exterior: {
            points: {
                lat: number;
                lon: number;
            }[];
        };
        interiors?: null | {
            points: {
                lat: number;
                lon: number;
            }[];
        }[];
    }

    Check if geo point is within a given polygon

  • Optionalgeo_radius?: null | Record<string, unknown> | {
        center: {
            lat: number;
            lon: number;
        };
        radius: number;
    }

    Check if geo point is within a given radius

  • Optionalmatch?:
        | null
        | Record<string, unknown>
        | {
            value: string | number | boolean;
        }
        | {
            text: string;
        }
        | {
            any: string[] | number[];
        }
        | {
            except: string[] | number[];
        }

    Check if point has field with a given value

  • Optionalrange?:
        | null
        | Record<string, unknown>
        | {
            gt?: null | number;
            gte?: null | number;
            lt?: null | number;
            lte?: null | number;
        }
        | {
            gt?: null | string;
            gte?: null | string;
            lt?: null | string;
            lte?: null | string;
        }

    Check if points value lies in a given range

  • Optionalvalues_count?: null | Record<string, unknown> | {
        gt?: null | number;
        gte?: null | number;
        lt?: null | number;
        lte?: null | number;
    }

    Check number of values of the field

VisitOperationOutput: {
    min_should?: null | Record<string, unknown> | {
        conditions: (
            | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
            | {
                key: string;
                geo_bounding_box?: null | Record<string, unknown> | {
                    bottom_right: {
                        lat: number;
                        lon: number;
                    };
                    top_left: {
                        lat: number;
                        lon: number;
                    };
                };
                geo_polygon?: null | Record<string, unknown> | {
                    exterior: {
                        points: {
                            lat: ...;
                            lon: ...;
                        }[];
                    };
                    interiors?: null | {
                        points: ...;
                    }[];
                };
                geo_radius?: null | Record<string, unknown> | {
                    center: {
                        lat: number;
                        lon: number;
                    };
                    radius: number;
                };
                match?:
                    | null
                    | Record<string, unknown>
                    | {
                        value: string | number | boolean;
                    }
                    | {
                        text: string;
                    }
                    | {
                        any: string[] | number[];
                    }
                    | {
                        except: string[] | number[];
                    };
                range?:
                    | null
                    | Record<string, unknown>
                    | {
                        gt?: null | number;
                        gte?: null | number;
                        lt?: null | number;
                        lte?: null | number;
                    }
                    | {
                        gt?: null | string;
                        gte?: null | string;
                        lt?: null | string;
                        lte?: null | string;
                    };
                values_count?: null | Record<string, unknown> | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                };
            }
            | {
                is_empty: {
                    key: string;
                };
            }
            | {
                is_null: {
                    key: string;
                };
            }
            | {
                has_id: (string | number)[];
            }
            | {
                nested: {
                    filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                    key: string;
                };
            })[];
        min_count: number;
    };
    must?: null | (
        | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
        | {
            key: string;
            geo_bounding_box?: null | Record<string, unknown> | {
                bottom_right: {
                    lat: number;
                    lon: number;
                };
                top_left: {
                    lat: number;
                    lon: number;
                };
            };
            geo_polygon?: null | Record<string, unknown> | {
                exterior: {
                    points: {
                        lat: number;
                        lon: number;
                    }[];
                };
                interiors?: null | {
                    points: (...)[];
                }[];
            };
            geo_radius?: null | Record<string, unknown> | {
                center: {
                    lat: number;
                    lon: number;
                };
                radius: number;
            };
            match?:
                | null
                | Record<string, unknown>
                | {
                    value: string | number | boolean;
                }
                | {
                    text: string;
                }
                | {
                    any: string[] | number[];
                }
                | {
                    except: string[] | number[];
                };
            range?:
                | null
                | Record<string, unknown>
                | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                }
                | {
                    gt?: null | string;
                    gte?: null | string;
                    lt?: null | string;
                    lte?: null | string;
                };
            values_count?: null | Record<string, unknown> | {
                gt?: null | number;
                gte?: null | number;
                lt?: null | number;
                lte?: null | number;
            };
        }
        | {
            is_empty: {
                key: string;
            };
        }
        | {
            is_null: {
                key: string;
            };
        }
        | {
            has_id: (string | number)[];
        }
        | {
            nested: {
                filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                key: string;
            };
        })[];
    must_not?: null | (
        | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
        | {
            key: string;
            geo_bounding_box?: null | Record<string, unknown> | {
                bottom_right: {
                    lat: number;
                    lon: number;
                };
                top_left: {
                    lat: number;
                    lon: number;
                };
            };
            geo_polygon?: null | Record<string, unknown> | {
                exterior: {
                    points: {
                        lat: number;
                        lon: number;
                    }[];
                };
                interiors?: null | {
                    points: (...)[];
                }[];
            };
            geo_radius?: null | Record<string, unknown> | {
                center: {
                    lat: number;
                    lon: number;
                };
                radius: number;
            };
            match?:
                | null
                | Record<string, unknown>
                | {
                    value: string | number | boolean;
                }
                | {
                    text: string;
                }
                | {
                    any: string[] | number[];
                }
                | {
                    except: string[] | number[];
                };
            range?:
                | null
                | Record<string, unknown>
                | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                }
                | {
                    gt?: null | string;
                    gte?: null | string;
                    lt?: null | string;
                    lte?: null | string;
                };
            values_count?: null | Record<string, unknown> | {
                gt?: null | number;
                gte?: null | number;
                lt?: null | number;
                lte?: null | number;
            };
        }
        | {
            is_empty: {
                key: string;
            };
        }
        | {
            is_null: {
                key: string;
            };
        }
        | {
            has_id: (string | number)[];
        }
        | {
            nested: {
                filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                key: string;
            };
        })[];
    should?: null | (
        | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
        | {
            key: string;
            geo_bounding_box?: null | Record<string, unknown> | {
                bottom_right: {
                    lat: number;
                    lon: number;
                };
                top_left: {
                    lat: number;
                    lon: number;
                };
            };
            geo_polygon?: null | Record<string, unknown> | {
                exterior: {
                    points: {
                        lat: number;
                        lon: number;
                    }[];
                };
                interiors?: null | {
                    points: (...)[];
                }[];
            };
            geo_radius?: null | Record<string, unknown> | {
                center: {
                    lat: number;
                    lon: number;
                };
                radius: number;
            };
            match?:
                | null
                | Record<string, unknown>
                | {
                    value: string | number | boolean;
                }
                | {
                    text: string;
                }
                | {
                    any: string[] | number[];
                }
                | {
                    except: string[] | number[];
                };
            range?:
                | null
                | Record<string, unknown>
                | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                }
                | {
                    gt?: null | string;
                    gte?: null | string;
                    lt?: null | string;
                    lte?: null | string;
                };
            values_count?: null | Record<string, unknown> | {
                gt?: null | number;
                gte?: null | number;
                lt?: null | number;
                lte?: null | number;
            };
        }
        | {
            is_empty: {
                key: string;
            };
        }
        | {
            is_null: {
                key: string;
            };
        }
        | {
            has_id: (string | number)[];
        }
        | {
            nested: {
                filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                key: string;
            };
        })[];
}

Type declaration

  • Optionalmin_should?: null | Record<string, unknown> | {
        conditions: (
            | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
            | {
                key: string;
                geo_bounding_box?: null | Record<string, unknown> | {
                    bottom_right: {
                        lat: number;
                        lon: number;
                    };
                    top_left: {
                        lat: number;
                        lon: number;
                    };
                };
                geo_polygon?: null | Record<string, unknown> | {
                    exterior: {
                        points: {
                            lat: ...;
                            lon: ...;
                        }[];
                    };
                    interiors?: null | {
                        points: ...;
                    }[];
                };
                geo_radius?: null | Record<string, unknown> | {
                    center: {
                        lat: number;
                        lon: number;
                    };
                    radius: number;
                };
                match?:
                    | null
                    | Record<string, unknown>
                    | {
                        value: string | number | boolean;
                    }
                    | {
                        text: string;
                    }
                    | {
                        any: string[] | number[];
                    }
                    | {
                        except: string[] | number[];
                    };
                range?:
                    | null
                    | Record<string, unknown>
                    | {
                        gt?: null | number;
                        gte?: null | number;
                        lt?: null | number;
                        lte?: null | number;
                    }
                    | {
                        gt?: null | string;
                        gte?: null | string;
                        lt?: null | string;
                        lte?: null | string;
                    };
                values_count?: null | Record<string, unknown> | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                };
            }
            | {
                is_empty: {
                    key: string;
                };
            }
            | {
                is_null: {
                    key: string;
                };
            }
            | {
                has_id: (string | number)[];
            }
            | {
                nested: {
                    filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                    key: string;
                };
            })[];
        min_count: number;
    }

    At least minimum amount of given conditions should match

  • Optionalmust?: null | (
        | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
        | {
            key: string;
            geo_bounding_box?: null | Record<string, unknown> | {
                bottom_right: {
                    lat: number;
                    lon: number;
                };
                top_left: {
                    lat: number;
                    lon: number;
                };
            };
            geo_polygon?: null | Record<string, unknown> | {
                exterior: {
                    points: {
                        lat: number;
                        lon: number;
                    }[];
                };
                interiors?: null | {
                    points: (...)[];
                }[];
            };
            geo_radius?: null | Record<string, unknown> | {
                center: {
                    lat: number;
                    lon: number;
                };
                radius: number;
            };
            match?:
                | null
                | Record<string, unknown>
                | {
                    value: string | number | boolean;
                }
                | {
                    text: string;
                }
                | {
                    any: string[] | number[];
                }
                | {
                    except: string[] | number[];
                };
            range?:
                | null
                | Record<string, unknown>
                | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                }
                | {
                    gt?: null | string;
                    gte?: null | string;
                    lt?: null | string;
                    lte?: null | string;
                };
            values_count?: null | Record<string, unknown> | {
                gt?: null | number;
                gte?: null | number;
                lt?: null | number;
                lte?: null | number;
            };
        }
        | {
            is_empty: {
                key: string;
            };
        }
        | {
            is_null: {
                key: string;
            };
        }
        | {
            has_id: (string | number)[];
        }
        | {
            nested: {
                filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                key: string;
            };
        })[]

    All conditions must match

  • Optionalmust_not?: null | (
        | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
        | {
            key: string;
            geo_bounding_box?: null | Record<string, unknown> | {
                bottom_right: {
                    lat: number;
                    lon: number;
                };
                top_left: {
                    lat: number;
                    lon: number;
                };
            };
            geo_polygon?: null | Record<string, unknown> | {
                exterior: {
                    points: {
                        lat: number;
                        lon: number;
                    }[];
                };
                interiors?: null | {
                    points: (...)[];
                }[];
            };
            geo_radius?: null | Record<string, unknown> | {
                center: {
                    lat: number;
                    lon: number;
                };
                radius: number;
            };
            match?:
                | null
                | Record<string, unknown>
                | {
                    value: string | number | boolean;
                }
                | {
                    text: string;
                }
                | {
                    any: string[] | number[];
                }
                | {
                    except: string[] | number[];
                };
            range?:
                | null
                | Record<string, unknown>
                | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                }
                | {
                    gt?: null | string;
                    gte?: null | string;
                    lt?: null | string;
                    lte?: null | string;
                };
            values_count?: null | Record<string, unknown> | {
                gt?: null | number;
                gte?: null | number;
                lt?: null | number;
                lte?: null | number;
            };
        }
        | {
            is_empty: {
                key: string;
            };
        }
        | {
            is_null: {
                key: string;
            };
        }
        | {
            has_id: (string | number)[];
        }
        | {
            nested: {
                filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                key: string;
            };
        })[]

    All conditions must NOT match

  • Optionalshould?: null | (
        | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
        | {
            key: string;
            geo_bounding_box?: null | Record<string, unknown> | {
                bottom_right: {
                    lat: number;
                    lon: number;
                };
                top_left: {
                    lat: number;
                    lon: number;
                };
            };
            geo_polygon?: null | Record<string, unknown> | {
                exterior: {
                    points: {
                        lat: number;
                        lon: number;
                    }[];
                };
                interiors?: null | {
                    points: (...)[];
                }[];
            };
            geo_radius?: null | Record<string, unknown> | {
                center: {
                    lat: number;
                    lon: number;
                };
                radius: number;
            };
            match?:
                | null
                | Record<string, unknown>
                | {
                    value: string | number | boolean;
                }
                | {
                    text: string;
                }
                | {
                    any: string[] | number[];
                }
                | {
                    except: string[] | number[];
                };
            range?:
                | null
                | Record<string, unknown>
                | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                }
                | {
                    gt?: null | string;
                    gte?: null | string;
                    lt?: null | string;
                    lte?: null | string;
                };
            values_count?: null | Record<string, unknown> | {
                gt?: null | number;
                gte?: null | number;
                lt?: null | number;
                lte?: null | number;
            };
        }
        | {
            is_empty: {
                key: string;
            };
        }
        | {
            is_null: {
                key: string;
            };
        }
        | {
            has_id: (string | number)[];
        }
        | {
            nested: {
                filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                key: string;
            };
        })[]

    At least one of those conditions should match

allowedComparators: Comparator[] = ...
allowedOperators: Operator[] = ...

Methods

  • Merges two filters into one. If both filters are empty, returns undefined. If one filter is empty or the merge type is 'replace', returns the other filter. If the merge type is 'and' or 'or', returns a new filter with the merged results. Throws an error for unknown merge types.

    Parameters

    • defaultFilter: undefined | {
          min_should?: null | Record<string, unknown> | {
              conditions: (
                  | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
                  | {
                      key: string;
                      geo_bounding_box?: null | Record<string, unknown> | {
                          bottom_right: {
                              lat: number;
                              lon: number;
                          };
                          top_left: {
                              lat: number;
                              lon: number;
                          };
                      };
                      geo_polygon?: null | Record<string, unknown> | {
                          exterior: {
                              points: (...)[];
                          };
                          interiors?: null | (...)[];
                      };
                      geo_radius?: null | Record<string, unknown> | {
                          center: {
                              lat: number;
                              lon: number;
                          };
                          radius: number;
                      };
                      match?:
                          | null
                          | Record<string, unknown>
                          | {
                              value: string | number | boolean;
                          }
                          | {
                              text: string;
                          }
                          | {
                              any: (...)[] | (...)[];
                          }
                          | {
                              except: (...)[] | (...)[];
                          };
                      range?:
                          | null
                          | Record<string, unknown>
                          | {
                              gt?: null | number;
                              gte?: null | number;
                              lt?: null | number;
                              lte?: null | number;
                          }
                          | {
                              gt?: null | string;
                              gte?: null | string;
                              lt?: null | string;
                              lte?: null | string;
                          };
                      values_count?: null | Record<string, unknown> | {
                          gt?: null | number;
                          gte?: null | number;
                          lt?: null | number;
                          lte?: null | number;
                      };
                  }
                  | {
                      is_empty: {
                          key: string;
                      };
                  }
                  | {
                      is_null: {
                          key: string;
                      };
                  }
                  | {
                      has_id: (string | number)[];
                  }
                  | {
                      nested: {
                          filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                          key: string;
                      };
                  })[];
              min_count: number;
          };
          must?: null | (
              | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
              | {
                  key: string;
                  geo_bounding_box?: null | Record<string, unknown> | {
                      bottom_right: {
                          lat: number;
                          lon: number;
                      };
                      top_left: {
                          lat: number;
                          lon: number;
                      };
                  };
                  geo_polygon?: null | Record<string, unknown> | {
                      exterior: {
                          points: {
                              lat: ...;
                              lon: ...;
                          }[];
                      };
                      interiors?: null | {
                          points: ...;
                      }[];
                  };
                  geo_radius?: null | Record<string, unknown> | {
                      center: {
                          lat: number;
                          lon: number;
                      };
                      radius: number;
                  };
                  match?:
                      | null
                      | Record<string, unknown>
                      | {
                          value: string | number | boolean;
                      }
                      | {
                          text: string;
                      }
                      | {
                          any: string[] | number[];
                      }
                      | {
                          except: string[] | number[];
                      };
                  range?:
                      | null
                      | Record<string, unknown>
                      | {
                          gt?: null | number;
                          gte?: null | number;
                          lt?: null | number;
                          lte?: null | number;
                      }
                      | {
                          gt?: null | string;
                          gte?: null | string;
                          lt?: null | string;
                          lte?: null | string;
                      };
                  values_count?: null | Record<string, unknown> | {
                      gt?: null | number;
                      gte?: null | number;
                      lt?: null | number;
                      lte?: null | number;
                  };
              }
              | {
                  is_empty: {
                      key: string;
                  };
              }
              | {
                  is_null: {
                      key: string;
                  };
              }
              | {
                  has_id: (string | number)[];
              }
              | {
                  nested: {
                      filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                      key: string;
                  };
              })[];
          must_not?: null | (
              | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
              | {
                  key: string;
                  geo_bounding_box?: null | Record<string, unknown> | {
                      bottom_right: {
                          lat: number;
                          lon: number;
                      };
                      top_left: {
                          lat: number;
                          lon: number;
                      };
                  };
                  geo_polygon?: null | Record<string, unknown> | {
                      exterior: {
                          points: {
                              lat: ...;
                              lon: ...;
                          }[];
                      };
                      interiors?: null | {
                          points: ...;
                      }[];
                  };
                  geo_radius?: null | Record<string, unknown> | {
                      center: {
                          lat: number;
                          lon: number;
                      };
                      radius: number;
                  };
                  match?:
                      | null
                      | Record<string, unknown>
                      | {
                          value: string | number | boolean;
                      }
                      | {
                          text: string;
                      }
                      | {
                          any: string[] | number[];
                      }
                      | {
                          except: string[] | number[];
                      };
                  range?:
                      | null
                      | Record<string, unknown>
                      | {
                          gt?: null | number;
                          gte?: null | number;
                          lt?: null | number;
                          lte?: null | number;
                      }
                      | {
                          gt?: null | string;
                          gte?: null | string;
                          lt?: null | string;
                          lte?: null | string;
                      };
                  values_count?: null | Record<string, unknown> | {
                      gt?: null | number;
                      gte?: null | number;
                      lt?: null | number;
                      lte?: null | number;
                  };
              }
              | {
                  is_empty: {
                      key: string;
                  };
              }
              | {
                  is_null: {
                      key: string;
                  };
              }
              | {
                  has_id: (string | number)[];
              }
              | {
                  nested: {
                      filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                      key: string;
                  };
              })[];
          should?: null | (
              | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
              | {
                  key: string;
                  geo_bounding_box?: null | Record<string, unknown> | {
                      bottom_right: {
                          lat: number;
                          lon: number;
                      };
                      top_left: {
                          lat: number;
                          lon: number;
                      };
                  };
                  geo_polygon?: null | Record<string, unknown> | {
                      exterior: {
                          points: {
                              lat: ...;
                              lon: ...;
                          }[];
                      };
                      interiors?: null | {
                          points: ...;
                      }[];
                  };
                  geo_radius?: null | Record<string, unknown> | {
                      center: {
                          lat: number;
                          lon: number;
                      };
                      radius: number;
                  };
                  match?:
                      | null
                      | Record<string, unknown>
                      | {
                          value: string | number | boolean;
                      }
                      | {
                          text: string;
                      }
                      | {
                          any: string[] | number[];
                      }
                      | {
                          except: string[] | number[];
                      };
                  range?:
                      | null
                      | Record<string, unknown>
                      | {
                          gt?: null | number;
                          gte?: null | number;
                          lt?: null | number;
                          lte?: null | number;
                      }
                      | {
                          gt?: null | string;
                          gte?: null | string;
                          lt?: null | string;
                          lte?: null | string;
                      };
                  values_count?: null | Record<string, unknown> | {
                      gt?: null | number;
                      gte?: null | number;
                      lt?: null | number;
                      lte?: null | number;
                  };
              }
              | {
                  is_empty: {
                      key: string;
                  };
              }
              | {
                  is_null: {
                      key: string;
                  };
              }
              | {
                  has_id: (string | number)[];
              }
              | {
                  nested: {
                      filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                      key: string;
                  };
              })[];
      }

      The default filter to merge.

    • generatedFilter: undefined | {
          min_should?: null | Record<string, unknown> | {
              conditions: (
                  | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
                  | {
                      key: string;
                      geo_bounding_box?: null | Record<string, unknown> | {
                          bottom_right: {
                              lat: number;
                              lon: number;
                          };
                          top_left: {
                              lat: number;
                              lon: number;
                          };
                      };
                      geo_polygon?: null | Record<string, unknown> | {
                          exterior: {
                              points: (...)[];
                          };
                          interiors?: null | (...)[];
                      };
                      geo_radius?: null | Record<string, unknown> | {
                          center: {
                              lat: number;
                              lon: number;
                          };
                          radius: number;
                      };
                      match?:
                          | null
                          | Record<string, unknown>
                          | {
                              value: string | number | boolean;
                          }
                          | {
                              text: string;
                          }
                          | {
                              any: (...)[] | (...)[];
                          }
                          | {
                              except: (...)[] | (...)[];
                          };
                      range?:
                          | null
                          | Record<string, unknown>
                          | {
                              gt?: null | number;
                              gte?: null | number;
                              lt?: null | number;
                              lte?: null | number;
                          }
                          | {
                              gt?: null | string;
                              gte?: null | string;
                              lt?: null | string;
                              lte?: null | string;
                          };
                      values_count?: null | Record<string, unknown> | {
                          gt?: null | number;
                          gte?: null | number;
                          lt?: null | number;
                          lte?: null | number;
                      };
                  }
                  | {
                      is_empty: {
                          key: string;
                      };
                  }
                  | {
                      is_null: {
                          key: string;
                      };
                  }
                  | {
                      has_id: (string | number)[];
                  }
                  | {
                      nested: {
                          filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                          key: string;
                      };
                  })[];
              min_count: number;
          };
          must?: null | (
              | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
              | {
                  key: string;
                  geo_bounding_box?: null | Record<string, unknown> | {
                      bottom_right: {
                          lat: number;
                          lon: number;
                      };
                      top_left: {
                          lat: number;
                          lon: number;
                      };
                  };
                  geo_polygon?: null | Record<string, unknown> | {
                      exterior: {
                          points: {
                              lat: ...;
                              lon: ...;
                          }[];
                      };
                      interiors?: null | {
                          points: ...;
                      }[];
                  };
                  geo_radius?: null | Record<string, unknown> | {
                      center: {
                          lat: number;
                          lon: number;
                      };
                      radius: number;
                  };
                  match?:
                      | null
                      | Record<string, unknown>
                      | {
                          value: string | number | boolean;
                      }
                      | {
                          text: string;
                      }
                      | {
                          any: string[] | number[];
                      }
                      | {
                          except: string[] | number[];
                      };
                  range?:
                      | null
                      | Record<string, unknown>
                      | {
                          gt?: null | number;
                          gte?: null | number;
                          lt?: null | number;
                          lte?: null | number;
                      }
                      | {
                          gt?: null | string;
                          gte?: null | string;
                          lt?: null | string;
                          lte?: null | string;
                      };
                  values_count?: null | Record<string, unknown> | {
                      gt?: null | number;
                      gte?: null | number;
                      lt?: null | number;
                      lte?: null | number;
                  };
              }
              | {
                  is_empty: {
                      key: string;
                  };
              }
              | {
                  is_null: {
                      key: string;
                  };
              }
              | {
                  has_id: (string | number)[];
              }
              | {
                  nested: {
                      filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                      key: string;
                  };
              })[];
          must_not?: null | (
              | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
              | {
                  key: string;
                  geo_bounding_box?: null | Record<string, unknown> | {
                      bottom_right: {
                          lat: number;
                          lon: number;
                      };
                      top_left: {
                          lat: number;
                          lon: number;
                      };
                  };
                  geo_polygon?: null | Record<string, unknown> | {
                      exterior: {
                          points: {
                              lat: ...;
                              lon: ...;
                          }[];
                      };
                      interiors?: null | {
                          points: ...;
                      }[];
                  };
                  geo_radius?: null | Record<string, unknown> | {
                      center: {
                          lat: number;
                          lon: number;
                      };
                      radius: number;
                  };
                  match?:
                      | null
                      | Record<string, unknown>
                      | {
                          value: string | number | boolean;
                      }
                      | {
                          text: string;
                      }
                      | {
                          any: string[] | number[];
                      }
                      | {
                          except: string[] | number[];
                      };
                  range?:
                      | null
                      | Record<string, unknown>
                      | {
                          gt?: null | number;
                          gte?: null | number;
                          lt?: null | number;
                          lte?: null | number;
                      }
                      | {
                          gt?: null | string;
                          gte?: null | string;
                          lt?: null | string;
                          lte?: null | string;
                      };
                  values_count?: null | Record<string, unknown> | {
                      gt?: null | number;
                      gte?: null | number;
                      lt?: null | number;
                      lte?: null | number;
                  };
              }
              | {
                  is_empty: {
                      key: string;
                  };
              }
              | {
                  is_null: {
                      key: string;
                  };
              }
              | {
                  has_id: (string | number)[];
              }
              | {
                  nested: {
                      filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                      key: string;
                  };
              })[];
          should?: null | (
              | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
              | {
                  key: string;
                  geo_bounding_box?: null | Record<string, unknown> | {
                      bottom_right: {
                          lat: number;
                          lon: number;
                      };
                      top_left: {
                          lat: number;
                          lon: number;
                      };
                  };
                  geo_polygon?: null | Record<string, unknown> | {
                      exterior: {
                          points: {
                              lat: ...;
                              lon: ...;
                          }[];
                      };
                      interiors?: null | {
                          points: ...;
                      }[];
                  };
                  geo_radius?: null | Record<string, unknown> | {
                      center: {
                          lat: number;
                          lon: number;
                      };
                      radius: number;
                  };
                  match?:
                      | null
                      | Record<string, unknown>
                      | {
                          value: string | number | boolean;
                      }
                      | {
                          text: string;
                      }
                      | {
                          any: string[] | number[];
                      }
                      | {
                          except: string[] | number[];
                      };
                  range?:
                      | null
                      | Record<string, unknown>
                      | {
                          gt?: null | number;
                          gte?: null | number;
                          lt?: null | number;
                          lte?: null | number;
                      }
                      | {
                          gt?: null | string;
                          gte?: null | string;
                          lt?: null | string;
                          lte?: null | string;
                      };
                  values_count?: null | Record<string, unknown> | {
                      gt?: null | number;
                      gte?: null | number;
                      lt?: null | number;
                      lte?: null | number;
                  };
              }
              | {
                  is_empty: {
                      key: string;
                  };
              }
              | {
                  is_null: {
                      key: string;
                  };
              }
              | {
                  has_id: (string | number)[];
              }
              | {
                  nested: {
                      filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                      key: string;
                  };
              })[];
      }

      The generated filter to merge.

    • mergeType: string = "and"

      The type of merge to perform. Can be 'and', 'or', or 'replace'. Defaults to 'and'.

    • forceDefaultFilter: boolean = false

      If true, the default filter is always returned if the generated filter is empty. Defaults to false.

    Returns undefined | {
        min_should?: null | Record<string, unknown> | {
            conditions: (
                | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
                | {
                    key: string;
                    geo_bounding_box?: null | Record<string, unknown> | {
                        bottom_right: {
                            lat: number;
                            lon: number;
                        };
                        top_left: {
                            lat: number;
                            lon: number;
                        };
                    };
                    geo_polygon?: null | Record<string, unknown> | {
                        exterior: {
                            points: (...)[];
                        };
                        interiors?: null | (...)[];
                    };
                    geo_radius?: null | Record<string, unknown> | {
                        center: {
                            lat: number;
                            lon: number;
                        };
                        radius: number;
                    };
                    match?:
                        | null
                        | Record<string, unknown>
                        | {
                            value: string | number | boolean;
                        }
                        | {
                            text: string;
                        }
                        | {
                            any: (...)[] | (...)[];
                        }
                        | {
                            except: (...)[] | (...)[];
                        };
                    range?:
                        | null
                        | Record<string, unknown>
                        | {
                            gt?: null | number;
                            gte?: null | number;
                            lt?: null | number;
                            lte?: null | number;
                        }
                        | {
                            gt?: null | string;
                            gte?: null | string;
                            lt?: null | string;
                            lte?: null | string;
                        };
                    values_count?: null | Record<string, unknown> | {
                        gt?: null | number;
                        gte?: null | number;
                        lt?: null | number;
                        lte?: null | number;
                    };
                }
                | {
                    is_empty: {
                        key: string;
                    };
                }
                | {
                    is_null: {
                        key: string;
                    };
                }
                | {
                    has_id: (string | number)[];
                }
                | {
                    nested: {
                        filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                        key: string;
                    };
                })[];
            min_count: number;
        };
        must?: null | (
            | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
            | {
                key: string;
                geo_bounding_box?: null | Record<string, unknown> | {
                    bottom_right: {
                        lat: number;
                        lon: number;
                    };
                    top_left: {
                        lat: number;
                        lon: number;
                    };
                };
                geo_polygon?: null | Record<string, unknown> | {
                    exterior: {
                        points: {
                            lat: ...;
                            lon: ...;
                        }[];
                    };
                    interiors?: null | {
                        points: ...;
                    }[];
                };
                geo_radius?: null | Record<string, unknown> | {
                    center: {
                        lat: number;
                        lon: number;
                    };
                    radius: number;
                };
                match?:
                    | null
                    | Record<string, unknown>
                    | {
                        value: string | number | boolean;
                    }
                    | {
                        text: string;
                    }
                    | {
                        any: string[] | number[];
                    }
                    | {
                        except: string[] | number[];
                    };
                range?:
                    | null
                    | Record<string, unknown>
                    | {
                        gt?: null | number;
                        gte?: null | number;
                        lt?: null | number;
                        lte?: null | number;
                    }
                    | {
                        gt?: null | string;
                        gte?: null | string;
                        lt?: null | string;
                        lte?: null | string;
                    };
                values_count?: null | Record<string, unknown> | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                };
            }
            | {
                is_empty: {
                    key: string;
                };
            }
            | {
                is_null: {
                    key: string;
                };
            }
            | {
                has_id: (string | number)[];
            }
            | {
                nested: {
                    filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                    key: string;
                };
            })[];
        must_not?: null | (
            | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
            | {
                key: string;
                geo_bounding_box?: null | Record<string, unknown> | {
                    bottom_right: {
                        lat: number;
                        lon: number;
                    };
                    top_left: {
                        lat: number;
                        lon: number;
                    };
                };
                geo_polygon?: null | Record<string, unknown> | {
                    exterior: {
                        points: {
                            lat: ...;
                            lon: ...;
                        }[];
                    };
                    interiors?: null | {
                        points: ...;
                    }[];
                };
                geo_radius?: null | Record<string, unknown> | {
                    center: {
                        lat: number;
                        lon: number;
                    };
                    radius: number;
                };
                match?:
                    | null
                    | Record<string, unknown>
                    | {
                        value: string | number | boolean;
                    }
                    | {
                        text: string;
                    }
                    | {
                        any: string[] | number[];
                    }
                    | {
                        except: string[] | number[];
                    };
                range?:
                    | null
                    | Record<string, unknown>
                    | {
                        gt?: null | number;
                        gte?: null | number;
                        lt?: null | number;
                        lte?: null | number;
                    }
                    | {
                        gt?: null | string;
                        gte?: null | string;
                        lt?: null | string;
                        lte?: null | string;
                    };
                values_count?: null | Record<string, unknown> | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                };
            }
            | {
                is_empty: {
                    key: string;
                };
            }
            | {
                is_null: {
                    key: string;
                };
            }
            | {
                has_id: (string | number)[];
            }
            | {
                nested: {
                    filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                    key: string;
                };
            })[];
        should?: null | (
            | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
            | {
                key: string;
                geo_bounding_box?: null | Record<string, unknown> | {
                    bottom_right: {
                        lat: number;
                        lon: number;
                    };
                    top_left: {
                        lat: number;
                        lon: number;
                    };
                };
                geo_polygon?: null | Record<string, unknown> | {
                    exterior: {
                        points: {
                            lat: ...;
                            lon: ...;
                        }[];
                    };
                    interiors?: null | {
                        points: ...;
                    }[];
                };
                geo_radius?: null | Record<string, unknown> | {
                    center: {
                        lat: number;
                        lon: number;
                    };
                    radius: number;
                };
                match?:
                    | null
                    | Record<string, unknown>
                    | {
                        value: string | number | boolean;
                    }
                    | {
                        text: string;
                    }
                    | {
                        any: string[] | number[];
                    }
                    | {
                        except: string[] | number[];
                    };
                range?:
                    | null
                    | Record<string, unknown>
                    | {
                        gt?: null | number;
                        gte?: null | number;
                        lt?: null | number;
                        lte?: null | number;
                    }
                    | {
                        gt?: null | string;
                        gte?: null | string;
                        lt?: null | string;
                        lte?: null | string;
                    };
                values_count?: null | Record<string, unknown> | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                };
            }
            | {
                is_empty: {
                    key: string;
                };
            }
            | {
                is_null: {
                    key: string;
                };
            }
            | {
                has_id: (string | number)[];
            }
            | {
                nested: {
                    filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                    key: string;
                };
            })[];
    }

    A merged QdrantFilter, or undefined if both filters are empty.

  • Visits a comparison and returns a QdrantCondition. The value is casted to the correct type. The attribute is prefixed with "metadata.", since metadata is nested in the Qdrant payload.

    Parameters

    • comparison: Comparison

      The comparison to visit.

    Returns {
        key: string;
        geo_bounding_box?: null | Record<string, unknown> | {
            bottom_right: {
                lat: number;
                lon: number;
            };
            top_left: {
                lat: number;
                lon: number;
            };
        };
        geo_polygon?: null | Record<string, unknown> | {
            exterior: {
                points: {
                    lat: number;
                    lon: number;
                }[];
            };
            interiors?: null | {
                points: {
                    lat: number;
                    lon: number;
                }[];
            }[];
        };
        geo_radius?: null | Record<string, unknown> | {
            center: {
                lat: number;
                lon: number;
            };
            radius: number;
        };
        match?:
            | null
            | Record<string, unknown>
            | {
                value: string | number | boolean;
            }
            | {
                text: string;
            }
            | {
                any: string[] | number[];
            }
            | {
                except: string[] | number[];
            };
        range?:
            | null
            | Record<string, unknown>
            | {
                gt?: null | number;
                gte?: null | number;
                lt?: null | number;
                lte?: null | number;
            }
            | {
                gt?: null | string;
                gte?: null | string;
                lt?: null | string;
                lte?: null | string;
            };
        values_count?: null | Record<string, unknown> | {
            gt?: null | number;
            gte?: null | number;
            lt?: null | number;
            lte?: null | number;
        };
    }

    A QdrantCondition.

    • key: string

      Payload key

    • Optionalgeo_bounding_box?: null | Record<string, unknown> | {
          bottom_right: {
              lat: number;
              lon: number;
          };
          top_left: {
              lat: number;
              lon: number;
          };
      }

      Check if points geo location lies in a given area

    • Optionalgeo_polygon?: null | Record<string, unknown> | {
          exterior: {
              points: {
                  lat: number;
                  lon: number;
              }[];
          };
          interiors?: null | {
              points: {
                  lat: number;
                  lon: number;
              }[];
          }[];
      }

      Check if geo point is within a given polygon

    • Optionalgeo_radius?: null | Record<string, unknown> | {
          center: {
              lat: number;
              lon: number;
          };
          radius: number;
      }

      Check if geo point is within a given radius

    • Optionalmatch?:
          | null
          | Record<string, unknown>
          | {
              value: string | number | boolean;
          }
          | {
              text: string;
          }
          | {
              any: string[] | number[];
          }
          | {
              except: string[] | number[];
          }

      Check if point has field with a given value

    • Optionalrange?:
          | null
          | Record<string, unknown>
          | {
              gt?: null | number;
              gte?: null | number;
              lt?: null | number;
              lte?: null | number;
          }
          | {
              gt?: null | string;
              gte?: null | string;
              lt?: null | string;
              lte?: null | string;
          }

      Check if points value lies in a given range

    • Optionalvalues_count?: null | Record<string, unknown> | {
          gt?: null | number;
          gte?: null | number;
          lt?: null | number;
          lte?: null | number;
      }

      Check number of values of the field

  • Visits an operation and returns a QdrantFilter.

    Parameters

    • operation: Operation

      The operation to visit.

    Returns {
        min_should?: null | Record<string, unknown> | {
            conditions: (
                | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
                | {
                    key: string;
                    geo_bounding_box?: null | Record<string, unknown> | {
                        bottom_right: {
                            lat: number;
                            lon: number;
                        };
                        top_left: {
                            lat: number;
                            lon: number;
                        };
                    };
                    geo_polygon?: null | Record<string, unknown> | {
                        exterior: {
                            points: {
                                lat: ...;
                                lon: ...;
                            }[];
                        };
                        interiors?: null | {
                            points: ...;
                        }[];
                    };
                    geo_radius?: null | Record<string, unknown> | {
                        center: {
                            lat: number;
                            lon: number;
                        };
                        radius: number;
                    };
                    match?:
                        | null
                        | Record<string, unknown>
                        | {
                            value: string | number | boolean;
                        }
                        | {
                            text: string;
                        }
                        | {
                            any: string[] | number[];
                        }
                        | {
                            except: string[] | number[];
                        };
                    range?:
                        | null
                        | Record<string, unknown>
                        | {
                            gt?: null | number;
                            gte?: null | number;
                            lt?: null | number;
                            lte?: null | number;
                        }
                        | {
                            gt?: null | string;
                            gte?: null | string;
                            lt?: null | string;
                            lte?: null | string;
                        };
                    values_count?: null | Record<string, unknown> | {
                        gt?: null | number;
                        gte?: null | number;
                        lt?: null | number;
                        lte?: null | number;
                    };
                }
                | {
                    is_empty: {
                        key: string;
                    };
                }
                | {
                    is_null: {
                        key: string;
                    };
                }
                | {
                    has_id: (string | number)[];
                }
                | {
                    nested: {
                        filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                        key: string;
                    };
                })[];
            min_count: number;
        };
        must?: null | (
            | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
            | {
                key: string;
                geo_bounding_box?: null | Record<string, unknown> | {
                    bottom_right: {
                        lat: number;
                        lon: number;
                    };
                    top_left: {
                        lat: number;
                        lon: number;
                    };
                };
                geo_polygon?: null | Record<string, unknown> | {
                    exterior: {
                        points: {
                            lat: number;
                            lon: number;
                        }[];
                    };
                    interiors?: null | {
                        points: (...)[];
                    }[];
                };
                geo_radius?: null | Record<string, unknown> | {
                    center: {
                        lat: number;
                        lon: number;
                    };
                    radius: number;
                };
                match?:
                    | null
                    | Record<string, unknown>
                    | {
                        value: string | number | boolean;
                    }
                    | {
                        text: string;
                    }
                    | {
                        any: string[] | number[];
                    }
                    | {
                        except: string[] | number[];
                    };
                range?:
                    | null
                    | Record<string, unknown>
                    | {
                        gt?: null | number;
                        gte?: null | number;
                        lt?: null | number;
                        lte?: null | number;
                    }
                    | {
                        gt?: null | string;
                        gte?: null | string;
                        lt?: null | string;
                        lte?: null | string;
                    };
                values_count?: null | Record<string, unknown> | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                };
            }
            | {
                is_empty: {
                    key: string;
                };
            }
            | {
                is_null: {
                    key: string;
                };
            }
            | {
                has_id: (string | number)[];
            }
            | {
                nested: {
                    filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                    key: string;
                };
            })[];
        must_not?: null | (
            | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
            | {
                key: string;
                geo_bounding_box?: null | Record<string, unknown> | {
                    bottom_right: {
                        lat: number;
                        lon: number;
                    };
                    top_left: {
                        lat: number;
                        lon: number;
                    };
                };
                geo_polygon?: null | Record<string, unknown> | {
                    exterior: {
                        points: {
                            lat: number;
                            lon: number;
                        }[];
                    };
                    interiors?: null | {
                        points: (...)[];
                    }[];
                };
                geo_radius?: null | Record<string, unknown> | {
                    center: {
                        lat: number;
                        lon: number;
                    };
                    radius: number;
                };
                match?:
                    | null
                    | Record<string, unknown>
                    | {
                        value: string | number | boolean;
                    }
                    | {
                        text: string;
                    }
                    | {
                        any: string[] | number[];
                    }
                    | {
                        except: string[] | number[];
                    };
                range?:
                    | null
                    | Record<string, unknown>
                    | {
                        gt?: null | number;
                        gte?: null | number;
                        lt?: null | number;
                        lte?: null | number;
                    }
                    | {
                        gt?: null | string;
                        gte?: null | string;
                        lt?: null | string;
                        lte?: null | string;
                    };
                values_count?: null | Record<string, unknown> | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                };
            }
            | {
                is_empty: {
                    key: string;
                };
            }
            | {
                is_null: {
                    key: string;
                };
            }
            | {
                has_id: (string | number)[];
            }
            | {
                nested: {
                    filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                    key: string;
                };
            })[];
        should?: null | (
            | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
            | {
                key: string;
                geo_bounding_box?: null | Record<string, unknown> | {
                    bottom_right: {
                        lat: number;
                        lon: number;
                    };
                    top_left: {
                        lat: number;
                        lon: number;
                    };
                };
                geo_polygon?: null | Record<string, unknown> | {
                    exterior: {
                        points: {
                            lat: number;
                            lon: number;
                        }[];
                    };
                    interiors?: null | {
                        points: (...)[];
                    }[];
                };
                geo_radius?: null | Record<string, unknown> | {
                    center: {
                        lat: number;
                        lon: number;
                    };
                    radius: number;
                };
                match?:
                    | null
                    | Record<string, unknown>
                    | {
                        value: string | number | boolean;
                    }
                    | {
                        text: string;
                    }
                    | {
                        any: string[] | number[];
                    }
                    | {
                        except: string[] | number[];
                    };
                range?:
                    | null
                    | Record<string, unknown>
                    | {
                        gt?: null | number;
                        gte?: null | number;
                        lt?: null | number;
                        lte?: null | number;
                    }
                    | {
                        gt?: null | string;
                        gte?: null | string;
                        lt?: null | string;
                        lte?: null | string;
                    };
                values_count?: null | Record<string, unknown> | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                };
            }
            | {
                is_empty: {
                    key: string;
                };
            }
            | {
                is_null: {
                    key: string;
                };
            }
            | {
                has_id: (string | number)[];
            }
            | {
                nested: {
                    filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                    key: string;
                };
            })[];
    }

    A QdrantFilter.

    • Optionalmin_should?: null | Record<string, unknown> | {
          conditions: (
              | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
              | {
                  key: string;
                  geo_bounding_box?: null | Record<string, unknown> | {
                      bottom_right: {
                          lat: number;
                          lon: number;
                      };
                      top_left: {
                          lat: number;
                          lon: number;
                      };
                  };
                  geo_polygon?: null | Record<string, unknown> | {
                      exterior: {
                          points: {
                              lat: ...;
                              lon: ...;
                          }[];
                      };
                      interiors?: null | {
                          points: ...;
                      }[];
                  };
                  geo_radius?: null | Record<string, unknown> | {
                      center: {
                          lat: number;
                          lon: number;
                      };
                      radius: number;
                  };
                  match?:
                      | null
                      | Record<string, unknown>
                      | {
                          value: string | number | boolean;
                      }
                      | {
                          text: string;
                      }
                      | {
                          any: string[] | number[];
                      }
                      | {
                          except: string[] | number[];
                      };
                  range?:
                      | null
                      | Record<string, unknown>
                      | {
                          gt?: null | number;
                          gte?: null | number;
                          lt?: null | number;
                          lte?: null | number;
                      }
                      | {
                          gt?: null | string;
                          gte?: null | string;
                          lt?: null | string;
                          lte?: null | string;
                      };
                  values_count?: null | Record<string, unknown> | {
                      gt?: null | number;
                      gte?: null | number;
                      lt?: null | number;
                      lte?: null | number;
                  };
              }
              | {
                  is_empty: {
                      key: string;
                  };
              }
              | {
                  is_null: {
                      key: string;
                  };
              }
              | {
                  has_id: (string | number)[];
              }
              | {
                  nested: {
                      filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                      key: string;
                  };
              })[];
          min_count: number;
      }

      At least minimum amount of given conditions should match

    • Optionalmust?: null | (
          | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
          | {
              key: string;
              geo_bounding_box?: null | Record<string, unknown> | {
                  bottom_right: {
                      lat: number;
                      lon: number;
                  };
                  top_left: {
                      lat: number;
                      lon: number;
                  };
              };
              geo_polygon?: null | Record<string, unknown> | {
                  exterior: {
                      points: {
                          lat: number;
                          lon: number;
                      }[];
                  };
                  interiors?: null | {
                      points: (...)[];
                  }[];
              };
              geo_radius?: null | Record<string, unknown> | {
                  center: {
                      lat: number;
                      lon: number;
                  };
                  radius: number;
              };
              match?:
                  | null
                  | Record<string, unknown>
                  | {
                      value: string | number | boolean;
                  }
                  | {
                      text: string;
                  }
                  | {
                      any: string[] | number[];
                  }
                  | {
                      except: string[] | number[];
                  };
              range?:
                  | null
                  | Record<string, unknown>
                  | {
                      gt?: null | number;
                      gte?: null | number;
                      lt?: null | number;
                      lte?: null | number;
                  }
                  | {
                      gt?: null | string;
                      gte?: null | string;
                      lt?: null | string;
                      lte?: null | string;
                  };
              values_count?: null | Record<string, unknown> | {
                  gt?: null | number;
                  gte?: null | number;
                  lt?: null | number;
                  lte?: null | number;
              };
          }
          | {
              is_empty: {
                  key: string;
              };
          }
          | {
              is_null: {
                  key: string;
              };
          }
          | {
              has_id: (string | number)[];
          }
          | {
              nested: {
                  filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                  key: string;
              };
          })[]

      All conditions must match

    • Optionalmust_not?: null | (
          | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
          | {
              key: string;
              geo_bounding_box?: null | Record<string, unknown> | {
                  bottom_right: {
                      lat: number;
                      lon: number;
                  };
                  top_left: {
                      lat: number;
                      lon: number;
                  };
              };
              geo_polygon?: null | Record<string, unknown> | {
                  exterior: {
                      points: {
                          lat: number;
                          lon: number;
                      }[];
                  };
                  interiors?: null | {
                      points: (...)[];
                  }[];
              };
              geo_radius?: null | Record<string, unknown> | {
                  center: {
                      lat: number;
                      lon: number;
                  };
                  radius: number;
              };
              match?:
                  | null
                  | Record<string, unknown>
                  | {
                      value: string | number | boolean;
                  }
                  | {
                      text: string;
                  }
                  | {
                      any: string[] | number[];
                  }
                  | {
                      except: string[] | number[];
                  };
              range?:
                  | null
                  | Record<string, unknown>
                  | {
                      gt?: null | number;
                      gte?: null | number;
                      lt?: null | number;
                      lte?: null | number;
                  }
                  | {
                      gt?: null | string;
                      gte?: null | string;
                      lt?: null | string;
                      lte?: null | string;
                  };
              values_count?: null | Record<string, unknown> | {
                  gt?: null | number;
                  gte?: null | number;
                  lt?: null | number;
                  lte?: null | number;
              };
          }
          | {
              is_empty: {
                  key: string;
              };
          }
          | {
              is_null: {
                  key: string;
              };
          }
          | {
              has_id: (string | number)[];
          }
          | {
              nested: {
                  filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                  key: string;
              };
          })[]

      All conditions must NOT match

    • Optionalshould?: null | (
          | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
          | {
              key: string;
              geo_bounding_box?: null | Record<string, unknown> | {
                  bottom_right: {
                      lat: number;
                      lon: number;
                  };
                  top_left: {
                      lat: number;
                      lon: number;
                  };
              };
              geo_polygon?: null | Record<string, unknown> | {
                  exterior: {
                      points: {
                          lat: number;
                          lon: number;
                      }[];
                  };
                  interiors?: null | {
                      points: (...)[];
                  }[];
              };
              geo_radius?: null | Record<string, unknown> | {
                  center: {
                      lat: number;
                      lon: number;
                  };
                  radius: number;
              };
              match?:
                  | null
                  | Record<string, unknown>
                  | {
                      value: string | number | boolean;
                  }
                  | {
                      text: string;
                  }
                  | {
                      any: string[] | number[];
                  }
                  | {
                      except: string[] | number[];
                  };
              range?:
                  | null
                  | Record<string, unknown>
                  | {
                      gt?: null | number;
                      gte?: null | number;
                      lt?: null | number;
                      lte?: null | number;
                  }
                  | {
                      gt?: null | string;
                      gte?: null | string;
                      lt?: null | string;
                      lte?: null | string;
                  };
              values_count?: null | Record<string, unknown> | {
                  gt?: null | number;
                  gte?: null | number;
                  lt?: null | number;
                  lte?: null | number;
              };
          }
          | {
              is_empty: {
                  key: string;
              };
          }
          | {
              is_null: {
                  key: string;
              };
          }
          | {
              has_id: (string | number)[];
          }
          | {
              nested: {
                  filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                  key: string;
              };
          })[]

      At least one of those conditions should match

  • Visits a structured query and returns a VisitStructuredQueryOutput. If the query has a filter, it is visited.

    Parameters

    • query: StructuredQuery

      The structured query to visit.

    Returns unknown

    An instance of VisitStructuredQueryOutput.