Infix search sometimes produces unexpected results...
# community-help
v
Infix search sometimes produces unexpected results (or maybe I'm cooking it wrong). I have a string field, and I have two documents with the following values of this field:
"SO007462"
and
"002746"
. Infix is on in the schema. When I do an infix search by
"00746"
,
"002746"
has an extremely high score in comparison with
"SO007462"
. This is unexpected because
"SO*00746*2"
contains a direct match of
"00746"
in the middle while
"002746"
is a fuzzy match. `"SO007462"`:
Copy code
"text_match": 100,
"text_match_info": {
	"best_field_score": "0",
	"best_field_weight": 12,
	"fields_matched": 4,
	"score": "100",
	"tokens_matched": 0
}
`"002746"`:
Copy code
"text_match": 578730054645710969,
"text_match_info": {
	"best_field_score": "1108057784320",
	"best_field_weight": 15,
	"fields_matched": 1,
	"score": "578730054645710969",
	"tokens_matched": 1
}
The second issue is about the highlighting behavior. For
"002746"
, there is no highlighting at all, which is quite confusing for the user (something is found, but it is not clear. why it is found). For
"SO007462"
, it is the opposit; the whole value is highlighted, despite the fact that the match is in the middle:
Copy code
"highlight": {
	"order_nbr": {
		"matched_tokens": [
			"SO007462"
		],
		"snippet": "<mark>SO007462</mark>",
		"value": "<mark>SO007462</mark>"
	}
},
I would expect that only the matching part is highlighted:
"SO<mark>00746</mark>2"