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 classSearchTransaction.ExtraSearchesInternal use: Keys for internal extra searches.
-
Field Summary
Fields Modifier and Type Field Description private booleananyExtraSearchesIncompleteSet true when at least one extra search was unable to complete.private Map<String,Object>customDataCustom data placeholder allowing any arbitrary data to be stored by hook scripts.private SearchErrorerrorAny error if the search wasn't successful.private Map<String,SearchTransaction>extraSearchesAny additional extra search transactions performed during this transaction.private AtomicLongextraSearchesAproxTimeSpentHow much time (ms) has been spent in executing extra searches.private Map<String,SearchQuestion>extraSearchesQuestionsInternal use: AdditionalSearchQuestions to process as extra searches.private Map<String,ExtraSearchFuture>extraSearchesTasksInternal use: Holds the extra searches tasks being executed.private @NonNull Optional<String>extraSearchNameHolds the extra search nameprivate @NonNull Optional<SearchTransaction>parentTransactionHolds the parent search transaction from which this search transaction was created under.private @NonNull SearchQuestionquestionThe question containing the input parameters.private @NonNull SearchResponseresponseThe response containing result data.private SearchSessionsessionUser 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 voidaddExtraSearch(String key, SearchQuestion q)Adds anSearchQuestionto be processed as an extra search.Optional<String>getEffectiveExtraSearchName()Gets the name of the extra search this search should be considered to be under.voidsetExtraSearchNameAndParentTransaction(Optional<String> extraSearchName, Optional<SearchTransaction> parentTransaction)
-
-
-
Field Detail
-
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
SearchQuestions 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-SearchQuestionsr-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 anSearchQuestionto be processed as an extra search.- Parameters:
key- Name of the extra source (seeui.modern.extra_searches).q- TheSearchQuestion
-
-