Can we disable fuzziness ? #1268
-
Hi there ,
Sample payload: const payload = {
"aggs": {
"is_deleted": {
"terms": {
"field": "is_deleted",
"size": 10
}
},
"status": {
"terms": {
"field": "status.keyword",
"size": 10
}
},
"type": {
"terms": {
"field": "type.keyword",
"size": 10
}
},
"lob": {
"terms": {
"field": "lob.keyword",
"size": 10
}
},
"visibility": {
"terms": {
"field": "visibility.keyword",
"size": 10
}
}
},
"query": {
"bool": {
"filter": [
{
"bool": {
"should": [
{
"term": {
"is_deleted": "false"
}
}
]
}
}
],
"must": {
"bool": {
"should": [
{
"bool": {
"should": [
{
"multi_match": {
"query": "ABCDEFGH", //sample uid
"fields": [
"enterprise.organization.name",
"vendor.organization.name",
"uid",
"enterprise_uid",
"vendor_uid",
"additional_info.obligationOnCompanyName",
"additional_info.recourseOnCompanyName"
],
"fuzziness": "AUTO:4,8"
}
},
{
"multi_match": {
"query": "ABCDEFGH", //sample uid
"fields": [
"enterprise.organization.name",
"vendor.organization.name",
"uid",
"enterprise_uid",
"vendor_uid",
"additional_info.obligationOnCompanyName",
"additional_info.recourseOnCompanyName"
],
"type": "bool_prefix"
}
}
]
}
},
{
"multi_match": {
"query": "ABCDEFGH", //sample uid
"type": "phrase",
"fields": [
"enterprise.organization.name",
"vendor.organization.name",
"uid",
"enterprise_uid",
"vendor_uid",
"additional_info.obligationOnCompanyName",
"additional_info.recourseOnCompanyName"
]
}
}
]
}
}
}
},
"size": 50,
"from": 0,
"_source": {
"includes": []
},
"highlight": {
"pre_tags": [
"<em>"
],
"post_tags": [
"</em>"
],
"fields": {}
},
"sort": [
{
"created_at": "desc"
}
],
"track_total_hits": true
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey there, You cant disable fuzziness but you can override the default query thats used via In the future, I would like to expose it so that you can do the following: import { RelevanceMatch } from "searchkit"
import Client from "@searchkit/api";
const client = Client({ ... })
export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
const results = await client.handleRequest(req.body, {
getQuery: RelevanceMatch({ fuzziness: false })
});
res.send(results);
}
happy to accept PRs for this change too! |
Beta Was this translation helpful? Give feedback.
Hey there,
You cant disable fuzziness but you can override the default query thats used via
getQuery
. This is what the default query function does.In the future, I would like to expose it so that you can do the following: