Class SearchTransaction
- java.lang.Object
-
- com.funnelback.publicui.search.model.transaction.SearchTransaction
-
public class SearchTransaction extends 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 Map<String,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 Map<String,SearchTransaction>
extraSearches
Any additional extra search transactions performed during this transaction.private AtomicLong
extraSearchesAproxTimeSpent
How much time (ms) has been spent in executing extra searches.private Map<String,SearchQuestion>
extraSearchesQuestions
Internal use: AdditionalSearchQuestion
s to process as extra searches.private Map<String,ExtraSearchFuture>
extraSearchesTasks
Internal use: Holds the extra searches tasks being executed.private @NonNull Optional<String>
extraSearchName
Holds the extra search nameprivate static org.apache.logging.log4j.Logger
log
private @NonNull Optional<SearchTransaction>
parentTransaction
Holds the parent search transaction from which this search transaction was created under.private @NonNull SearchQuestion
question
The question containing the input parameters.private @NonNull 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()
Build a new transactionSearchTransaction(SearchQuestion sq, SearchResponse sr)
Build a new transaction
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addExtraSearch(String key, SearchQuestion q)
Adds anSearchQuestion
to be processed as an extra search.Map<String,Object>
getCustomData()
Custom data placeholder allowing any arbitrary data to be stored by hook scripts.Optional<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.Map<String,SearchTransaction>
getExtraSearches()
Any additional extra search transactions performed during this transaction.AtomicLong
getExtraSearchesAproxTimeSpent()
How much time (ms) has been spent in executing extra searches.Map<String,SearchQuestion>
getExtraSearchesQuestions()
Internal use: AdditionalSearchQuestion
s to process as extra searches.Map<String,ExtraSearchFuture>
getExtraSearchesTasks()
Internal use: Holds the extra searches tasks being executed.@NonNull Optional<String>
getExtraSearchName()
Holds the extra search name@NonNull Optional<SearchTransaction>
getParentTransaction()
Holds the parent search transaction from which this search transaction was created under.@NonNull SearchQuestion
getQuestion()
The question containing the input parameters.@NonNull SearchResponse
getResponse()
The response containing result data.SearchSession
getSession()
User session data, might be null if not enabled.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(Optional<String> extraSearchName, 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 @NonNull Optional<String> extraSearchName
Holds the extra search nameFor logging only
-
parentTransaction
@NonNull private @NonNull Optional<SearchTransaction> parentTransaction
Holds the parent search transaction from which this search transaction was created under.- Since:
- 15.14.0.37
-
question
@NonNull private @NonNull SearchQuestion question
The question containing the input parameters.
-
response
@NonNull private @NonNull 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 Map<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 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 Map<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 Map<String,ExtraSearchFuture> extraSearchesTasks
Internal use: Holds the extra searches tasks being executed.
-
-
Constructor Detail
-
SearchTransaction
public SearchTransaction(SearchQuestion sq, SearchResponse sr)
Build a new transaction- Parameters:
sq
-SearchQuestion
sr
-SearchResponse
-
SearchTransaction
public SearchTransaction()
Build a new transaction
-
-
Method Detail
-
setExtraSearchNameAndParentTransaction
public void setExtraSearchNameAndParentTransaction(Optional<String> extraSearchName, Optional<SearchTransaction> parentTransaction)
-
getEffectiveExtraSearchName
public Optional<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(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
-
getExtraSearchName
@NonNull public @NonNull Optional<String> getExtraSearchName()
Holds the extra search nameFor logging only
-
getParentTransaction
@NonNull public @NonNull Optional<SearchTransaction> getParentTransaction()
Holds the parent search transaction from which this search transaction was created under.- Since:
- 15.14.0.37
-
getQuestion
@NonNull public @NonNull SearchQuestion getQuestion()
The question containing the input parameters.
-
getResponse
@NonNull public @NonNull 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 Map<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 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 Map<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 Map<String,ExtraSearchFuture> getExtraSearchesTasks()
Internal use: Holds the extra searches tasks being executed.
-
-