Class TransformQuery
- java.lang.Object
-
- com.funnelback.publicui.search.model.curator.action.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.BooleanapplyToAllQueryParametersWhether 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.StringmatchThe regular expression to matchprivate java.lang.StringreplacementThe 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 voidconfigure(Configurer configurer)Configure this action (expected to autowire in any dependencies)booleanequals(java.lang.Object o)java.lang.BooleangetApplyToAllQueryParameters()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.StringgetMatch()The regular expression to matchjava.lang.StringgetReplacement()The regular expression replacementinthashCode()voidperformAction(SearchTransaction searchTransaction, Action.Phase phase)Replace occurrences of target with replacement within the question's query and metaParameters.booleanrunsInPhase(Action.Phase phase)Query term addition occurs in the INPUT phase since it must modify the query before it is run by padre.voidsetApplyToAllQueryParameters(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.voidsetMatch(java.lang.String match)The regular expression to matchvoidsetReplacement(java.lang.String replacement)The regular expression replacementjava.lang.StringtoString()private static java.lang.Stringtransform(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.
-
-
-
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.
-
-
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:
performActionin interfaceAction- Parameters:
searchTransaction- Current search transactionphase- 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:
runsInPhasein interfaceAction- 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)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.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.
-
-