Hello <@U01PL2YSG8L> <@U01NZ4D0LDD>, Good morning...
# community-help
r
Hello @Kishore Nallan @Jason Bosco, Good morning/evening. I'm trying to do a search with a defined expected search result order; *I'm finding difficulties in getting the results in the expected sort order*; I might have missed something. Your advise on this would be greatly appreciated; Here is the usecase details; Please let me know if you need any further info from my side; Usecase: List all the Organizations matching the entered keyword. Example Keyword used for the search: Sc Thrive Child Twenty Seven Expected Organization Result Sort Order (from highest to lowest): Exact match in Organization Name Exact match in Organization Description Full match within Organization Name Full match within Organization Description Most words match in Organization Name Most words match in Organization Description Least words match in Organization Name Least words match in Organization Description Most words with correction match in Organization Name Most words with correction match in Organization Description Schema Definition:
{
"name": "organizations",
"fields": [
{"name": "id", "type": "string", "index": true },
{"name": "organization_id", "type": "int64", "index": true, "sort":true, "range_index":true },
{"name": "organization_name", "type": "string", "index": true, "sort":true, "infix":true, "stem":true },
{"name": "organization_desc", "type": "string", "index": true, "optional":true, "stem":true, "infix":true },
{"name": "organization_type", "type": "string", "index": true, "facet":true, "optional":true }
]
}
Search Query (that I've tried with different options) :
{
"collection": "organizations",
"q": "Sc Thrive Child Twenty Seven",
"query_by": "organization_name, organization_desc",
"query_by_weights": "3, 1",
"text_match_type": "max_weight",
"prefix": "false, false",
"infix":"always, always",
"filter_by": "",
"sort_by":"_text_match:desc",
"prioritize_exact_match":true,
"prioritize_num_matching_fields":true,
"prioritize_token_position":true,
"max_candidates":4,
"typo_tokens_threshold": 0,
"num_typos":0,
"include_fields": "organization_name, organization_desc",
"highlight_full_fields":"organization_name, organization_desc",
"page": 1,
"per_page": 100,
"exhaustive_search": true
}
Thank You ! Regards, K. Raja
k
Copy code
Exact match in Organization Name
Exact match in Organization Description
Full match within Organization Name
Full match within Organization Description
Most words match in Organization Name
Most words match in Organization Description
Least words match in Organization Name
Least words match in Organization Description
Most words with correction match in Organization Name
Most words with correction match in Organization Description
It's not possible to define such fine-grain custom matching conditions with Typesense.
r
Thank you for your reply @Kishore Nallan; Could you please let me know at what extend we can achieve this ? Thank you ! Regards, K. Raja
k
The only thing you can do is give weights to fields to indicate relative importance. The text match score is computed with a fixed formula described here: https://typesense.org/docs/guide/ranking-and-relevance.html#ranking-and-relevance