Class 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
    • Field Detail

      • log

        private static final org.apache.logging.log4j.Logger log
      • extraSearchName

        @NonNull
        private @NonNull Optional<String> extraSearchName
        Holds the extra search name

        For 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.
      • customData

        private final Map<String,​Object> customData
        Custom data placeholder allowing any arbitrary data to be stored by hook scripts.
    • Method Detail

      • 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
      • getExtraSearchName

        @NonNull
        public @NonNull Optional<String> getExtraSearchName()
        Holds the extra search name

        For 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 SearchQuestions 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.
      • getCustomData

        public Map<String,​Object> getCustomData()
        Custom data placeholder allowing any arbitrary data to be stored by hook scripts.