X
Xata•3y ago
tsg

Search Table | Xata

@raae (queen.raae.codes) the stream was awesome! 😻 Regarding search highlighting, you were right, you need to pass something to the request: highlight: {enabled: true} and then you get the highlights in the response (from https://xata.io/docs/api-reference/db/db_branch_name/tables/table_name/search#free-text-search-in-a-table)
Xata
Search Table | Xata
This endpoint performs full text search in a particular table.
17 Replies
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
tsg
tsgOP•3y ago
that looks good, the highlights should come in the responses under xata.highlight
tsg
tsgOP•3y ago
here is an example, in case I'm not seeing the error either
No description
tsg
tsgOP•3y ago
they are in <em> tags, and you can change the tag if you want/need
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
tsg
tsgOP•3y ago
ah, one sec, I think you need getMetadata() in the SDK
tsg
tsgOP•3y ago
yeah, it's maybe a bit convoluted but:
No description
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
tsg
tsgOP•3y ago
Yes, that’s the per table search. I’ll give you an example in a bit.
tsg
tsgOP•3y ago
@SferaDev Could it be that the SDK types don't expose target in the per-table search? This seems accepted but it's highlighted in red
No description
tsg
tsgOP•3y ago
I think there's some stuff to fix in there @raae (queen.raae.codes) , thanks a lot for reporting! Using search.all should be fine in the meantime, indeed
SferaDev
SferaDev•3y ago
Shouldn't it be target: [{ column: "name" }]. Target is where to look up for results but not filter, so Keanu Reeves there won't do anything.
tsg
tsgOP•3y ago
like this, right?
const records = await xata.db.Users.search("keanu", {
target: [{ column: "name" }],
highlight: { enabled: true },
fuzziness: 1,
prefix: "phrase",
});
const records = await xata.db.Users.search("keanu", {
target: [{ column: "name" }],
highlight: { enabled: true },
fuzziness: 1,
prefix: "phrase",
});
that is how it should be, indeed, but still doesn't seem to work. i think the types don't expect target at all
SferaDev
SferaDev•3y ago
Okay that might be a bug, will check
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
tsg
tsgOP•3y ago
We don’t yet have pagination, you can increase the size to max 200, I think. Let me know if that is not enough, we ca prioritize adding pagination support
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server