I don't get results from the category.name = "T-shirts & Sweaters" whenever I try to search on "T-shirt"
This is an example query:
{
"explain": true,
"size": 3,
"query": {
"bool": {
"filter": {
"bool": {
"must": [
{
"terms": {
"visibility": [
3,
4
]
}
},
{
"terms": {
"status": [
0,
1
]
}
},
{
"terms": {
"stock.is_in_stock": [
true
]
}
}
]
}
},
"must": {
"function_score": {
"functions": [
{
"filter": {
"match": {
"attribute_code": "attribute_value"
}
},
"weight": 1
}
],
"score_mode": "multiply",
"boost_mode": "multiply",
"max_boost": 100,
"min_score": 1,
"query": {
"bool": {
"should": [
{
"multi_match": {
"fields": [
"name^2",
"sku^50",
"category.name^1"
],
"query": "T-shirt",
"operator": "or",
"fuzziness": 2,
"cutoff_frequency": 0.01,
"max_expansions": 3,
"prefix_length": 2,
"minimum_should_match": "75%",
"tie_breaker": "1"
}
},
{
"bool": {
"should": [
{
"terms": {
"configurable_children.sku": [
"T", "shirt"
]
}
},
{
"match_phrase": {
"sku": {
"query": "T-shirt",
"boost": 1
}
}
},
{
"match_phrase": {
"configurable_children.sku": {
"query": "T-shirt",
"boost": 1
}
}
}
]
}
}
]
}
}
}
}
}
}
}
I get results but only with the letter "T" in the product name. So it looks like T-shirt is split up in 2 search terms "T" and "shirt".
(Part of) response:
{
"took": 15,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 11,
"relation": "eq"
},
"max_score": 14.911253,
"hits": [
{
"_score": 14.911253,
"_source": {
...
"name": "VICTORINOX 0.6463.T",
"url_path": "victorinox-0-6463-t",
"category": [
{
"category_id": 412,
"name": "Pocket Knives",
"position": 0
}
],
...
},
"_explanation": {
"value": 14.911253,
"description": "sum of:",
"details": [
{
"value": 14.911253,
"description": "function score, product of:",
"details": [
{
"value": 14.911253,
"description": "sum of:",
"details": [
{
"value": 14.911253,
"description": "sum of:",
"details": [
{
"value": 14.911253,
"description": "weight(name:t in 1592) [PerFieldSimilarity], result of:",
"details": [
{
"value": 14.911253,
"description": "score(freq=1.0), computed as boost * idf * tf from:",
"details": [
{
"value": 4.4,
"description": "boost",
"details": []
},
{
"value": 6.521112,
"description": "idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:",
"details": [
{
"value": 19,
"description": "n, number of documents containing term",
"details": []
},
{
"value": 13246,
"description": "N, total number of documents with field",
"details": []
}
]
},
{
"value": 0.51968455,
"description": "tf, computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:",
"details": [
{
"value": 1.0,
"description": "freq, occurrences of term within document",
"details": []
},
{
"value": 1.2,
"description": "k1, term saturation parameter",
"details": []
},
{
"value": 0.75,
"description": "b, length normalization parameter",
"details": []
},
{
"value": 3.0,
"description": "dl, length of field",
"details": []
},
{
"value": 4.32523,
"description": "avgdl, average length of field",
"details": []
}
]
}
]
}
]
}
]
}
]
},
{
"value": 1.0,
"description": "min of:",
"details": [
{
"value": 1.0,
"description": "No function matched",
"details": []
},
{
"value": 100.0,
"description": "maxBoost",
"details": []
}
]
}
]
}
]
}
},
If I remove the sku and name part from the multi match terms I get no results at all, however I do have a lot of products in the category.name = "T-shirts & Sweaters".
How can I make sure these will popup first? What do I need to change in my settings?