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.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 matchprivate 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 matchjava.lang.String
getReplacement()
The regular expression replacementint
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 matchvoid
setReplacement(java.lang.String replacement)
The regular expression replacementjava.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.
-
-
-
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:
performAction
in 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:
runsInPhase
in 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:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in 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.
-
-