Fórum
What is the search scoring logic used by Liferay DXP?
Vishnu S Kumar, modificado 6 Anos atrás.
What is the search scoring logic used by Liferay DXP?
Regular Member Postagens: 131 Data de Entrada: 28/07/17 Postagens Recentes
I have a custom search portlet and need to do boosting for some fields and structures. I can do this using boost method in Query classes. Since my custom search portlet includes some OOB Liferay structures and custom structures I need to know whether Liferay has any scoring functionality over the elasticsearch scoring internally.
Jorge Díaz, modificado 6 Anos atrás.
RE: What is the search scoring logic used by Liferay DXP? (Resposta)
Liferay Master Postagens: 753 Data de Entrada: 09/01/14 Postagens Recentes
Hi Vishnu,
You can add the boost configuration in a search calling com.liferay.portal.kernel.search.Query.setBoost(float) but you can also add a default boost in a entity for all queries creating a IndexerPostProcessor and set a boost on the required field.
More info see https://dev.liferay.com/develop/reference/-/knowledge_base/7-0/indexer-post-processor
About your question:
For certain fields (description, title, assetCategoryTitles etc.), Liferay sets the boost to 2 on Liferay side at some points when we create the query, see for example:
That query builders are used for example in following classes:
You can add the boost configuration in a search calling com.liferay.portal.kernel.search.Query.setBoost(float) but you can also add a default boost in a entity for all queries creating a IndexerPostProcessor and set a boost on the required field.
More info see https://dev.liferay.com/develop/reference/-/knowledge_base/7-0/indexer-post-processor
About your question:
Vishnu S Kumar:
I have a custom search portlet and need to do boosting for some fields and structures. I can do this using boost method in Query classes. Since my custom search portlet includes some OOB Liferay structures and custom structures I need to know whether Liferay has any scoring functionality over the elasticsearch scoring internally.The default boost for all fields is 1.
For certain fields (description, title, assetCategoryTitles etc.), Liferay sets the boost to 2 on Liferay side at some points when we create the query, see for example:
- modules/apps/foundation/portal-search/portal-search/src/main/java/com/liferay/portal/search/internal/analysis/DescriptionFieldQueryBuilder.java#L52-L64
- modules/apps/foundation/portal-search/portal-search/src/main/java/com/liferay/portal/search/internal/analysis/TitleFieldQueryBuilder.java#L52-L60
That query builders are used for example in following classes:
Vishnu S Kumar, modificado 6 Anos atrás.
RE: What is the search scoring logic used by Liferay DXP?
Regular Member Postagens: 131 Data de Entrada: 28/07/17 Postagens Recentes
Thank You!