Class ReplaceQueryTerm

  • All Implemented Interfaces:
    Action, HasNoBeans

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

    Action to replace a specified term within the users query before running it.

    This replacement will apply to the query (including special parameters like query_and etc), and meta parameters but not to system parameters.

    • 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.String replacement
      The term to replace target with.
      private java.lang.String target
      The term to be replaced.
    • 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.String getReplacement()
      The term to replace target with.
      java.lang.String getTarget()
      The term to be replaced.
      int hashCode()  
      void performAction​(SearchTransaction searchTransaction, Action.Phase phase)
      Replace occurrences of target with replacement within the question's query and metaParameters.
      private static java.lang.String replace​(java.lang.String target, java.lang.String replacement, java.lang.String content)
      Returns a new string containing content with all occurrences of target replaced with replacement.
      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 setReplacement​(java.lang.String replacement)
      The term to replace target with.
      void setTarget​(java.lang.String target)
      The term to be replaced.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • target

        private java.lang.String target
        The term to be replaced.
      • replacement

        private java.lang.String replacement
        The term to replace target with.
    • Constructor Detail

      • ReplaceQueryTerm

        public ReplaceQueryTerm​(java.lang.String target,
                                java.lang.String replacement)
      • ReplaceQueryTerm

        public ReplaceQueryTerm()
    • 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).
      • replace

        private static java.lang.String replace​(java.lang.String target,
                                                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
      • getTarget

        public java.lang.String getTarget()
        The term to be replaced.
      • setTarget

        public void setTarget​(java.lang.String target)
        The term to be replaced.
      • getReplacement

        public java.lang.String getReplacement()
        The term to replace target with.
      • setReplacement

        public void setReplacement​(java.lang.String replacement)
        The term to replace target with.