Interface PostFilter

  • All Known Implementing Classes:
    Decorate, Scope, SimpleDecorate, SiteFilter

    public interface PostFilter
    PostFilters are designed to complement PostProcesses. While PostProcesses operate on the entire resultset at once, with PostFilters, each PostFilter is called for each result in the resultset. According to the return of filter() the result can then be included, discarded, or (un)boosted in the resultset. Possible return values for filter are FILTER_OK, FILTER_REMOVE, FILTER_ADJUSTED Which PostFilters are run, and when is controlled by two properties, as mentioned below.
    Properties
    • querying.postfilters : A comma separated list of control to PostFilter class mappings, in the order postfilters should be run in. Mappings are separated by ":". eg querying.postfilters=scope:Scope
    '''NB:''' Initialisation and running of post filters is carried out by a subclass of the Manager.
    Author:
    Craig Macdonald
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static byte FILTER_ADJUSTED
      The score for this result has been adjusted, please ensure the resultset is re-sorted
      static byte FILTER_OK
      This result should be included in the resultset
      static byte FILTER_REMOVE
      This result should not be included in the resultset
    • Field Detail

      • FILTER_OK

        static final byte FILTER_OK
        This result should be included in the resultset
        See Also:
        Constant Field Values
      • FILTER_REMOVE

        static final byte FILTER_REMOVE
        This result should not be included in the resultset
        See Also:
        Constant Field Values
      • FILTER_ADJUSTED

        static final byte FILTER_ADJUSTED
        The score for this result has been adjusted, please ensure the resultset is re-sorted
        See Also:
        Constant Field Values
    • Method Detail

      • new_query

        void new_query​(Manager m,
                       SearchRequest srq,
                       ResultSet rs)
        Called before the processing of a resultset using this PostFilter is applied. Can be used to save information for the duration of the query.
        Parameters:
        m - The manager controlling this query
        srq - The search request being processed
        rs - the resultset that is being iterated through
      • filter

        byte filter​(Manager m,
                    SearchRequest srq,
                    ResultSet results,
                    int DocAtNumber,
                    int docid)
        Called for each result in the resultset, used to filter out unwanted results.
        Parameters:
        m - The manager controlling this query
        srq - The search request being processed
        DocAtNumber - which array index (rank) in the resultset have we reached
        docid - The docid of the currently being procesed result.