-
Notifications
You must be signed in to change notification settings - Fork 4
Description
filter_by is causing a type error when checking for equality on a field with type string[], despite providing valid results when run.
Example setup:
import { collection, setDefaultConfiguration } from "typesense-ts";
setDefaultConfiguration({
apiKey: "xyz",
nodes: [{ url: "http://localhost:8108" }],
});
const booksSchema = collection({
name: "books",
fields: [
{ name: "title", type: "string" },
{ name: "authors", type: "string[]" },
],
});First example filter_by:
await booksSchema.search({
q: "*",
query_by: [],
filter_by: "authors:=William",
});Type error: Argument of type '{ q: string; query_by: never[]; filter_by: string; }' is not assignable to parameter of type '"[Error on filter_by]: Invalid token sequence: identifier with name `authors` followed by `:=`"'.ts(2345)
Second example filter_by:
await booksSchema.search({
q: "*",
query_by: [],
filter_by: "authors:=[William]",
});Type error: Argument of type '{ q: string; query_by: never[]; filter_by: string; }' is not assignable to parameter of type '"[Error on filter_by]: Unknown token: ["'.ts(2345)
Third example filter_by:
await booksSchema.search({
q: "*",
query_by: [],
filter_by: "authors:=William Shakespeare",
});Type error: Argument of type '{ q: string; query_by: never[]; filter_by: string; }' is not assignable to parameter of type '"[Error on filter_by]: Invalid token sequence: Literal Token `William` followed by literal token"'.ts(2345)