Class SearchTransaction
- java.lang.Object
-
- com.funnelback.publicui.search.model.transaction.SearchTransaction
-
public class SearchTransaction extends java.lang.Object
Represents a full search transaction consisting of a question, a response and possible error.
This is the root of the data model.
- Since:
- 11.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SearchTransaction.ExtraSearches
Internal use: Keys for internal extra searches.
-
Field Summary
Fields Modifier and Type Field Description private boolean
anyExtraSearchesIncomplete
Set true when at least one extra search was unable to complete.private java.util.Map<java.lang.String,java.lang.Object>
customData
Custom data placeholder allowing any arbitrary data to be stored by hook scripts.private SearchError
error
Any error if the search wasn't successful.private java.util.Map<java.lang.String,SearchTransaction>
extraSearches
Any additional extra search transactions performed during this transaction.private java.util.concurrent.atomic.AtomicLong
extraSearchesAproxTimeSpent
How much time (ms) has been spent in executing extra searches.private java.util.Map<java.lang.String,SearchQuestion>
extraSearchesQuestions
Internal use: AdditionalSearchQuestion
s to process as extra searches.private java.util.Map<java.lang.String,ExtraSearchFuture>
extraSearchesTasks
Internal use: Holds the extra searches tasks being executed.private java.util.Optional<java.lang.String>
extraSearchName
Holds the extra search nameprivate static org.apache.logging.log4j.Logger
log
private java.util.Optional<SearchTransaction>
parentTransaction
Holds the parent search transaction from which this search transaction was created under.private SearchQuestion
question
The question containing the input parameters.private SearchResponse
response
The response containing result data.private SearchSession
session
User session data, might be null if not enabled.
-
Constructor Summary
Constructors Constructor Description SearchTransaction()
SearchTransaction(SearchQuestion sq, SearchResponse sr)
Build a new transaction
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addExtraSearch(java.lang.String key, SearchQuestion q)
Adds anSearchQuestion
to be processed as an extra search.java.util.Map<java.lang.String,java.lang.Object>
getCustomData()
Custom data placeholder allowing any arbitrary data to be stored by hook scripts.java.util.Optional<java.lang.String>
getEffectiveExtraSearchName()
Gets the name of the extra search this search should be considered to be under.SearchError
getError()
Any error if the search wasn't successful.java.util.Map<java.lang.String,SearchTransaction>
getExtraSearches()
Any additional extra search transactions performed during this transaction.java.util.concurrent.atomic.AtomicLong
getExtraSearchesAproxTimeSpent()
How much time (ms) has been spent in executing extra searches.java.util.Map<java.lang.String,SearchQuestion>
getExtraSearchesQuestions()
Internal use: AdditionalSearchQuestion
s to process as extra searches.java.util.Map<java.lang.String,ExtraSearchFuture>
getExtraSearchesTasks()
Internal use: Holds the extra searches tasks being executed.java.util.Optional<java.lang.String>
getExtraSearchName()
Holds the extra search namejava.util.Optional<SearchTransaction>
getParentTransaction()
Holds the parent search transaction from which this search transaction was created under.SearchQuestion
getQuestion()
The question containing the input parameters.SearchResponse
getResponse()
The response containing result data.SearchSession
getSession()
User session data, might be null if not enabled.boolean
hasQuestion()
boolean
hasResponse()
boolean
isAnyExtraSearchesIncomplete()
Set true when at least one extra search was unable to complete.void
setAnyExtraSearchesIncomplete(boolean anyExtraSearchesIncomplete)
Set true when at least one extra search was unable to complete.void
setError(SearchError error)
Any error if the search wasn't successful.void
setExtraSearchNameAndParentTransaction(java.util.Optional<java.lang.String> extraSearchName, java.util.Optional<SearchTransaction> parentTransaction)
void
setSession(SearchSession session)
User session data, might be null if not enabled.
-
-
-
Field Detail
-
log
private static final org.apache.logging.log4j.Logger log
-
extraSearchName
@NonNull private java.util.Optional<java.lang.String> extraSearchName
Holds the extra search nameFor logging only
-
parentTransaction
@NonNull private java.util.Optional<SearchTransaction> parentTransaction
Holds the parent search transaction from which this search transaction was created under.- Since:
- 15.14.0.37
-
question
private SearchQuestion question
The question containing the input parameters.
-
response
private SearchResponse response
The response containing result data.
-
error
private SearchError error
Any error if the search wasn't successful.
-
session
private SearchSession session
User session data, might be null if not enabled.- Since:
- v12.5
-
extraSearches
private final java.util.Map<java.lang.String,SearchTransaction> extraSearches
Any additional extra search transactions performed during this transaction.
To access result data from an extra search source, use the name of this source as a key on this Map.
- See Also:
ui.modern.extra_searches
-
extraSearchesAproxTimeSpent
private final java.util.concurrent.atomic.AtomicLong extraSearchesAproxTimeSpent
How much time (ms) has been spent in executing extra searches.
-
anyExtraSearchesIncomplete
private boolean anyExtraSearchesIncomplete
Set true when at least one extra search was unable to complete.This can happen if extra searches take too long to run or if an error occurred within the extra search.
-
extraSearchesQuestions
private final java.util.Map<java.lang.String,SearchQuestion> extraSearchesQuestions
Internal use: Additional
SearchQuestion
s to process as extra searches.These questions will be submitted in parallel to the main search.
-
extraSearchesTasks
private final java.util.Map<java.lang.String,ExtraSearchFuture> extraSearchesTasks
Internal use: Holds the extra searches tasks being executed.
-
customData
private final java.util.Map<java.lang.String,java.lang.Object> customData
Custom data placeholder allowing any arbitrary data to be stored by hook scripts.
-
-
Constructor Detail
-
SearchTransaction
public SearchTransaction(SearchQuestion sq, SearchResponse sr)
Build a new transaction- Parameters:
sq
-SearchQuestion
sr
-SearchResponse
-
SearchTransaction
public SearchTransaction()
-
-
Method Detail
-
setExtraSearchNameAndParentTransaction
public void setExtraSearchNameAndParentTransaction(java.util.Optional<java.lang.String> extraSearchName, java.util.Optional<SearchTransaction> parentTransaction)
-
getEffectiveExtraSearchName
public java.util.Optional<java.lang.String> getEffectiveExtraSearchName()
Gets the name of the extra search this search should be considered to be under. The result of this should be used when modifying a particular extra search. As Funnelback may create extra searches under an existing search, for example for faceted navigation, this could be used to work out if the search transaction should be modified.- Returns:
- The name of the extra search that is running or the name of the EXTRA_SEARCH from which this search was created from. If this search is not or does not belong to an extra search empty will be returned.
- Since:
- 15.14.0.37
-
addExtraSearch
public void addExtraSearch(java.lang.String key, SearchQuestion q)
Adds anSearchQuestion
to be processed as an extra search.- Parameters:
key
- Name of the extra source (seeui.modern.extra_searches
).q
- TheSearchQuestion
-
hasResponse
public boolean hasResponse()
- Returns:
- true if the
question
is not null.
-
hasQuestion
public boolean hasQuestion()
- Returns:
- true if the
response
is not null.
-
getExtraSearchName
@NonNull public java.util.Optional<java.lang.String> getExtraSearchName()
Holds the extra search nameFor logging only
-
getParentTransaction
@NonNull public java.util.Optional<SearchTransaction> getParentTransaction()
Holds the parent search transaction from which this search transaction was created under.- Since:
- 15.14.0.37
-
getQuestion
public SearchQuestion getQuestion()
The question containing the input parameters.
-
getResponse
public SearchResponse getResponse()
The response containing result data.
-
getError
public SearchError getError()
Any error if the search wasn't successful.
-
setError
public void setError(SearchError error)
Any error if the search wasn't successful.
-
getSession
public SearchSession getSession()
User session data, might be null if not enabled.- Since:
- v12.5
-
setSession
public void setSession(SearchSession session)
User session data, might be null if not enabled.- Since:
- v12.5
-
getExtraSearches
public java.util.Map<java.lang.String,SearchTransaction> getExtraSearches()
Any additional extra search transactions performed during this transaction.
To access result data from an extra search source, use the name of this source as a key on this Map.
- See Also:
ui.modern.extra_searches
-
getExtraSearchesAproxTimeSpent
public java.util.concurrent.atomic.AtomicLong getExtraSearchesAproxTimeSpent()
How much time (ms) has been spent in executing extra searches.
-
isAnyExtraSearchesIncomplete
public boolean isAnyExtraSearchesIncomplete()
Set true when at least one extra search was unable to complete.This can happen if extra searches take too long to run or if an error occurred within the extra search.
-
setAnyExtraSearchesIncomplete
public void setAnyExtraSearchesIncomplete(boolean anyExtraSearchesIncomplete)
Set true when at least one extra search was unable to complete.This can happen if extra searches take too long to run or if an error occurred within the extra search.
-
getExtraSearchesQuestions
public java.util.Map<java.lang.String,SearchQuestion> getExtraSearchesQuestions()
Internal use: Additional
SearchQuestion
s to process as extra searches.These questions will be submitted in parallel to the main search.
-
getExtraSearchesTasks
public java.util.Map<java.lang.String,ExtraSearchFuture> getExtraSearchesTasks()
Internal use: Holds the extra searches tasks being executed.
-
getCustomData
public java.util.Map<java.lang.String,java.lang.Object> getCustomData()
Custom data placeholder allowing any arbitrary data to be stored by hook scripts.
-
-