Class LuceneCategorySearchEngineScoring


  • public class LuceneCategorySearchEngineScoring
    extends java.lang.Object
    Provides default implementation for scoring of publication result found through LuceneCategorySearchEngine.

    To override this class and provide your own implementation :

    1. Create a class extending LuceneCategorySearchEngineScoring
       public class MyLuceneCategorySearchEngineScoring extends com.jalios.jcms.search.LuceneCategorySearchEngineScoring {
       
         public float getPublicationNewScore(QueryHandler qh, QueryResultSet resultSet,
                                                    Category cat, float catScore, float maxCatScore,
                                                    Publication pub, float pubScore, float maxPubScore,
                                                    boolean isNewResult) {
           return isNewResult ? 42f : pubScore;
         }
       }
       
    2. Declare your class in the following JCMS property :
       hook.cat-search-engine.scoring.class: com.example.jcmsplugin.search.MyLuceneCategorySearchEngineScoring
       
    Since:
    jcms-10.0.1 / JCMS-6238
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      float getPublicationNewScore​(QueryHandler qh, QueryResultSet resultSet, Category cat, float catScore, float maxCatScore, Publication pub, float pubScore, float maxPubScore, boolean isNewResult)
      This method is called by the LuceneCategorySearchEngine when searching full text in category, it is used to compute the new score of the Publication (previously found or not by the LucenePublicationSearchEngine).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LuceneCategorySearchEngineScoring

        public LuceneCategorySearchEngineScoring()
    • Method Detail

      • getPublicationNewScore

        public float getPublicationNewScore​(QueryHandler qh,
                                            QueryResultSet resultSet,
                                            Category cat,
                                            float catScore,
                                            float maxCatScore,
                                            Publication pub,
                                            float pubScore,
                                            float maxPubScore,
                                            boolean isNewResult)
        This method is called by the LuceneCategorySearchEngine when searching full text in category, it is used to compute the new score of the Publication (previously found or not by the LucenePublicationSearchEngine).
        Parameters:
        qh - the QueryHandler that was used for this search.
        resultSet - the QueryResultSet currently computed.
        cat - the Category found.
        catScore - the lucene score of the Category.
        maxCatScore - the highest category score (does not change during all calls to this method in a same query).
        pub - the Publication that will be added/replaced in the resultSet with the returned score.
        pubScore - the score already available for this publication (0.0f if isNewResult is false).
        maxPubScore - the highest publication score (does not change during all calls to this method in a same query).
        isNewResult - if true, the given publication was found for the first time by searching in this category, otherwise the given publication had already been added (through text search in publications or with a previous category).
        Returns:
        the new score of the Publication