Class TransformQuery

  • All Implemented Interfaces:
    Action, HasNoBeans

    public final class TransformQuery
    extends java.lang.Object
    implements Action, HasNoBeans

    Action to transform the user's query based on a regular expression replacement.

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface com.funnelback.publicui.search.model.curator.config.Action

        Action.Phase
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Boolean applyToAllQueryParameters
      Whether to apply the transformation to all other query parameters (such as meta_x and query_or), in addition to the simple query one.
      private java.lang.String match
      The regular expression to match
      private java.lang.String replacement
      The regular expression replacement
    • Constructor Summary

      Constructors 
      Constructor Description
      TransformQuery()  
      TransformQuery​(java.lang.String match, java.lang.String replacement, java.lang.Boolean applyToAllQueryParameters)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void configure​(Configurer configurer)
      Configure this action (expected to autowire in any dependencies)
      boolean equals​(java.lang.Object o)  
      java.lang.Boolean getApplyToAllQueryParameters()
      Whether to apply the transformation to all other query parameters (such as meta_x and query_or), in addition to the simple query one.
      java.lang.String getMatch()
      The regular expression to match
      java.lang.String getReplacement()
      The regular expression replacement
      int hashCode()  
      void performAction​(SearchTransaction searchTransaction, Action.Phase phase)
      Replace occurrences of target with replacement within the question's query and metaParameters.
      boolean runsInPhase​(Action.Phase phase)
      Query term addition occurs in the INPUT phase since it must modify the query before it is run by padre.
      void setApplyToAllQueryParameters​(java.lang.Boolean applyToAllQueryParameters)
      Whether to apply the transformation to all other query parameters (such as meta_x and query_or), in addition to the simple query one.
      void setMatch​(java.lang.String match)
      The regular expression to match
      void setReplacement​(java.lang.String replacement)
      The regular expression replacement
      java.lang.String toString()  
      private static java.lang.String transform​(java.lang.String match, java.lang.String replacement, java.lang.String content)
      Returns a new string containing content with all occurrences of target replaced with replacement.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • match

        private java.lang.String match
        The regular expression to match
      • replacement

        private java.lang.String replacement
        The regular expression replacement
      • applyToAllQueryParameters

        private java.lang.Boolean applyToAllQueryParameters
        Whether to apply the transformation to all other query parameters (such as meta_x and query_or), in addition to the simple query one.
    • Constructor Detail

      • TransformQuery

        public TransformQuery​(java.lang.String match,
                              java.lang.String replacement,
                              java.lang.Boolean applyToAllQueryParameters)
      • TransformQuery

        public TransformQuery()
    • Method Detail

      • performAction

        public void performAction​(SearchTransaction searchTransaction,
                                  Action.Phase phase)
        Replace occurrences of target with replacement within the question's query and metaParameters.
        Specified by:
        performAction in interface Action
        Parameters:
        searchTransaction - Current search transaction
        phase - The phase being processed (Some actions may wish to behave differently depending on the current phase of processing).
      • transform

        private static java.lang.String transform​(java.lang.String match,
                                                  java.lang.String replacement,
                                                  java.lang.String content)
        Returns a new string containing content with all occurrences of target replaced with replacement.
      • runsInPhase

        public boolean runsInPhase​(Action.Phase phase)
        Query term addition occurs in the INPUT phase since it must modify the query before it is run by padre.
        Specified by:
        runsInPhase in interface Action
        Parameters:
        phase - The phase being processed (Some actions may wish to behave differently depending on the current phase of processing).
        Returns:
        true if this action should be run in the given phase, otherwise return false.
      • configure

        public void configure​(Configurer configurer)
        Configure this action (expected to autowire in any dependencies)
        Specified by:
        configure in interface Action
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • getMatch

        public java.lang.String getMatch()
        The regular expression to match
      • setMatch

        public void setMatch​(java.lang.String match)
        The regular expression to match
      • getReplacement

        public java.lang.String getReplacement()
        The regular expression replacement
      • setReplacement

        public void setReplacement​(java.lang.String replacement)
        The regular expression replacement
      • getApplyToAllQueryParameters

        public java.lang.Boolean getApplyToAllQueryParameters()
        Whether to apply the transformation to all other query parameters (such as meta_x and query_or), in addition to the simple query one.
      • setApplyToAllQueryParameters

        public void setApplyToAllQueryParameters​(java.lang.Boolean applyToAllQueryParameters)
        Whether to apply the transformation to all other query parameters (such as meta_x and query_or), in addition to the simple query one.