Sascha Reuter
06/20/2025, 5:46 AMmon 2, and would expect matches with multiple token matches to rank higher than those with only one token match, e.g. see king of the monsters 2 before one new item 2 ...
{
"q": "mon 2",
"query_by": "name,nameVersion,nameAlternative,nameJapanese",
"query_by_weights": "4,1,3,2",
"infix": "always,fallback,always,always",
"include_fields": "id",
"num_typos": 2,
"filter_by": "(visibility:=PUBLIC || creatorId:=7) && $user_things(ownerId:=7 && status:=SOLD)",
"prioritize_exact_match": true,
"prioritize_token_position": true,
"sort_by": "_text_match:desc,name:asc",
"text_match_type": "max_weight",
"split_join_tokens": "always",
"typo_tokens_threshold": 50,
"drop_tokens_threshold": 50,
"per_page": 50,
"page": 1
}
... Here are the results (I just trimmed of some of the results after king of monsters 2)...
{
facet_counts: [],
found: 8,
hits: [
{
document: {
categoryId: "3",
creatorId: "7",
description: "Neo Geo lorem ipsum dolor sit amet, SNK adipiscing elit. Metal Slug tempor incididunt ut labore et magna Garou: Mark of the Wolves. Pulvinar King of Fighters 98 elit, samurai showdown ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex aequo Neo Turf Masters commodo consequat.\n\nMVS magna sit amet magna, aes arcanae. Cuphead nulla facilisi, cabinet retro-inspired ut blazing star. Fatal Fury duo melius quam uno: Terry Bogard ipsum est. Art of Fighting elit elit, Samurai Shodown spiritus sanctum. Nullam Neo Geo multiversus, versio AES versus MVS, haec sunt mysteria arcade.\n\nSuper Sidekicks dolem ipsum soccer sit amet, goal veniam dream match never ends. Puzzle Bobble magna pac-man in bubble wrap ut aliquip. Duis aute irure dolor in reprehenderit in voluptate Neo Drift Out. Magna Blast Away ad infinitum, but insert coin first.",
id: "55992",
name: "1 new item 2",
typeId: "1",
user_things: [
{
id: "401",
ownerId: "7",
status: "OWN",
thingId: "55992"
},
{
id: "499",
ownerId: "7",
status: "OWN",
thingId: "55992"
},
{
id: "500",
ownerId: "7",
status: "OWN",
thingId: "55992"
},
{
id: "501",
ownerId: "7",
status: "OWN",
thingId: "55992"
},
{
id: "502",
ownerId: "7",
status: "OWN",
thingId: "55992"
}
],
versionGroupId: "198",
visibility: "PUBLIC"
},
highlight: {
name: {
matched_tokens: [
"2"
],
snippet: "1 new item <mark>2</mark>"
}
},
highlights: [
{
field: "name",
matched_tokens: [
"2"
],
snippet: "1 new item <mark>2</mark>"
}
],
text_match: 578730123365701800,
text_match_info: {
best_field_score: "1108091339003",
best_field_weight: 15,
fields_matched: 1,
num_tokens_dropped: 1,
score: "578730123365701753",
tokens_matched: 1,
typo_prefix_score: 0
}
},
{
document: {
categoryId: "3",
creatorId: "7",
id: "55993",
name: "1 new thing 2",
typeId: "1",
user_things: {
id: "402",
ownerId: "7",
status: "OWN",
thingId: "55993"
},
versionGroupId: "",
visibility: "HIDDEN"
},
highlight: {
name: {
matched_tokens: [
"2"
],
snippet: "1 new thing <mark>2</mark>"
}
},
highlights: [
{
field: "name",
matched_tokens: [
"2"
],
snippet: "1 new thing <mark>2</mark>"
}
],
text_match: 578730123365701800,
text_match_info: {
best_field_score: "1108091339003",
best_field_weight: 15,
fields_matched: 1,
num_tokens_dropped: 1,
score: "578730123365701753",
tokens_matched: 1,
typo_prefix_score: 0
}
},
{
document: {
categoryId: "2",
creatorId: "1",
id: "55276",
name: "King of the Monsters 2",
typeId: "1",
user_things: {
id: "459",
ownerId: "7",
status: "OWN",
thingId: "55276"
},
versionGroupId: "67",
visibility: "PUBLIC"
},
highlight: {
name: {
matched_tokens: [
"Monsters",
"2"
],
snippet: "King of the <mark>Monsters</mark> <mark>2</mark>"
}
},
highlights: [
{
field: "name",
matched_tokens: [
"Monsters",
"2"
],
snippet: "King of the <mark>Monsters</mark> <mark>2</mark>"
}
],
text_match: 578730123365699700,
text_match_info: {
best_field_score: "1108091339002",
best_field_weight: 15,
fields_matched: 1,
num_tokens_dropped: 1,
score: "578730123365699705",
tokens_matched: 1,
typo_prefix_score: 0
}
},
],
out_of: 3613,
page: 1,
request_params: {
collection_name: "things",
first_q: "mon 2",
per_page: 50,
q: "mon 2"
},
search_cutoff: false,
search_time_ms: 4
}Alan Martini
06/20/2025, 2:42 PMJack Coy
06/22/2025, 10:52 PMtypesense/typesense:28.0
JS Client: 2.0.3Sascha Reuter
06/24/2025, 10:06 AM