X
Xata•2y 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•2y ago
Message Not Public
Sign In & Join Server To View
tsg
tsg•2y ago
that looks good, the highlights should come in the responses under xata.highlight
tsg
tsg•2y ago
here is an example, in case I'm not seeing the error either
No description
tsg
tsg•2y ago
they are in <em> tags, and you can change the tag if you want/need
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
tsg
tsg•2y ago
ah, one sec, I think you need getMetadata() in the SDK
tsg
tsg•2y ago
yeah, it's maybe a bit convoluted but:
No description
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
tsg
tsg•2y ago
Yes, that’s the per table search. I’ll give you an example in a bit.
tsg
tsg•2y 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
tsg•2y 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•2y 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
tsg•2y 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•2y ago
Okay that might be a bug, will check
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
tsg
tsg•2y 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•2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server