Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(autocomplete): improve full text search #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tdnl
Copy link

@tdnl tdnl commented May 31, 2023

No description provided.

@tdnl tdnl force-pushed the feat-improve-search branch from fe20507 to 7374c70 Compare June 6, 2023 08:22
Comment on lines +17 to +21
'multi_match:full_text_search_fuzzy:fuzziness': 'AUTO', // (equivalent to AUTO:3,6)
'multi_match:full_text_search_fuzzy:boost': 1,
'multi_match:full_text_search_fuzzy:minimum_should_match': '2<90%',
'multi_match:full_text_search_fuzzy:prefix_length': 0,
'multi_match:full_text_search_fuzzy:max_expansions': 50,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On peut régler les paramètres dans le 2eme multimatch (avec fuzziness) ici.

La clé doit commencer par multi_match:full_text_search_fuzzy: et on y ajoute un TERM

La liste des valeurs possibles pour TERM : https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html#type-best-fields

Pour info, il y a une sorte de validation faite sur pelias/query pour n'ajouter que les TERM disponibles en fonction du type (best_fields). Donc si on met n'importe quoi, le terme ne sera pas ajouté dans la query.

return subview(vsCopy);
const vsFuzzy = new peliasQuery.Vars(vs.export());
vsFuzzy.var(`multi_match:${viewFuzzy}:input`).set(input);
vsFuzzy.var(`multi_match:${viewFuzzy}:fields`).set(fields.map((field) => `pure.${field}`));
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On fait la recherche sur le champ pure.* (pure.name.en par exemple).

pure est le template dynamique configuré sur geospike

Comment on lines +63 to +69
bool: {
should: [
multiMatchView(vsCopy),
multiMatchFuzzyView(vsFuzzy)
]
}
};
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suite aux recommendations de Damien pour une version non ngrammée, on passe par 2 multimatch (1 avec fuzzy, 1 sans) sous un bool et should

Comment on lines 12 to 15
'multi_match:full_text_search:type': 'best_fields', // (default value in ES)
'multi_match:full_text_search:fuzziness': 'AUTO', // (equivalent to AUTO:3,6)
'multi_match:full_text_search:minimum_should_match': '2<90%',
'multi_match:full_text_search:boost': 1,
'multi_match:full_text_search:field': 'name.default',
'multi_match:full_text_search:prefix_length': 0,
'multi_match:full_text_search:max_expansions': 50,
'multi_match:full_text_search:zero_terms_query': 'NONE',
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pour les paramètres du 1er multimatch (sans fuzziness), on utilise la clé multi_match:full_text_search:

@tdnl tdnl marked this pull request as ready for review June 15, 2023 13:12
Base automatically changed from feat-fulltext-search to master June 15, 2023 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants