Class SearchQuestion
- java.lang.Object
-
- com.funnelback.publicui.search.model.transaction.SearchQuestion
-
public class SearchQuestion extends Object
This class contains all the input data related to a search.
This data will be collected from the input parameters (query string parameters) and possibly transformed by some processing before PADRE is called.
- Since:
- 11.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SearchQuestion.RequestParameters
Common query string parameters names.static class
SearchQuestion.SearchQuestionType
Enum for identifying special types of search requests requiring special processing
-
Field Summary
Fields Modifier and Type Field Description private Map<String,String[]>
additionalParameters
Additional parameters to pass as-is to PADRE.private String[]
clive
Specific component of a meta-collection to queryprivate String
cnClickedCluster
Contextual Navigation: last clicked clusterprivate List<String>
cnPreviousClusters
Contextual Navigation: Previous clicked clustersprivate SearchPackageConfig
collection
SearchedCollection
.private String
currentProfile
The profile which will be used for the request.private Map<String,Object>
customData
Custom data placeholder allowing any arbitrary data to be stored by hook scripts.private List<String>
dynamicQueryProcessorOptions
Dynamic query processor options for PADRE, in addition to the one set incollection.cfg
.private Map<String,String>
environmentVariables
List of environment variables to pass to PADRE.private ExecutionContext
executionContext
Execution context of the Search UI.private @NonNull Optional<List<String>>
facetCollectionConstraints
The collections to restrict search to for faceted navigation.private String
facetsGScopeConstraints
GScope constraints to apply for faceted navigation (In addition to existing gscope constraints).private List<String>
facetsQueryConstraints
Query constraints to apply for faceted navigation (In addition to other query expressions).private @NonNull String
form
Display form (template)private FunnelbackVersionI
funnelbackVersion
Funnelback versionprivate String
hostname
Name of the host where PADRE executed the query.private boolean
impersonated
Whether the request is impersonated (Document Level Security)private com.google.common.collect.ListMultimap<String,String>
inputParameters
Raw input parametersprivate Locale
locale
Locale
to use for the search.private Location
location
Location
information detected for the remote user based on information from their request.private Optional<Boolean>
logQuery
Defines if the query should be logged or not, or if it should fall back to default.private Optional<Integer>
maxPadrePacketSize
An optional maxPadrePacketSize which may be overridden to set the max Padre packet size that will be permitted.private List<String>
metaParameters
meta_*
/query_*
input parameters, transformed in query expressions.private String
originalQuery
Original query, as entered by the user.private Optional<Long>
padreTimeout
An optional timeout which when set overrides the value of collection.cfg option ui.modern.padre_fork_timeout_ms, which controls how long the main padre forking may take.private Principal
principal
Principal representing the remote user for the current request.private PriorityQueryProcessorOptions
priorityQueryProcessorOptions
Query processor options that are guaranteed to apply.private @NonNull String
profile
The profile to search with, defaulting to "_default".private String
query
Query terms.private @NonNull com.google.common.collect.ListMultimap<String,String>
queryStringMap
Sets the query string parameter map.private SearchQuestion.SearchQuestionType
questionType
Indicates the 'type' of question, which may trigger special processing in the search lifecycle.private com.google.common.collect.ListMultimap<String,String>
requestHeaders
Headers provided with the incoming search requestprivate String
requestId
Request identifier to log for this transaction.private Map<String,List<String>>
selectedCategoryValues
List of selected facets categories.private Set<String>
selectedFacets
List of selected facets.private Function<SearchQuestion,ServiceConfig>
serviceConfigProvider
private List<String>
systemMetaParameters
smeta_*
/squery_*
input parameters, transformed in query expressions.private List<String>
userKeys
User keys for early binding Document Level Security.
-
Constructor Summary
Constructors Constructor Description SearchQuestion()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ServiceConfig
getCurrentProfileConfig()
Returns the (modern) config of the currentProfilecom.google.common.collect.ListMultimap<String,String>
getInputParametersCopy()
Returns a copy of the#getInputParameters()
mapcom.google.common.collect.ListMultimap<String,String>
getQueryStringMapCopy()
Query string parameters as a Mapboolean
isExtraSearch()
Deprecated.As of release 14.2, replaced byquestionType
void
setExtraSearch(boolean isExtraSearch)
Deprecated.As of release 14.2, replaced byquestionType
-
-
-
Field Detail
-
executionContext
private ExecutionContext executionContext
Execution context of the Search UI. Can be "admin" or "public", depending if the search is running on the admin port or public port.- Since:
- 15.12
-
requestHeaders
private com.google.common.collect.ListMultimap<String,String> requestHeaders
Headers provided with the incoming search request- Since:
- 15.16
-
query
private String query
Query terms.
This may be transformed before being passed to PADRE, depending on the configuration.
-
originalQuery
private String originalQuery
Original query, as entered by the user.
-
collection
private SearchPackageConfig collection
SearchedCollection
.
-
profile
@NonNull private @NonNull String profile
The profile to search with, defaulting to "_default".
-
currentProfile
private String currentProfile
The profile which will be used for the request. This one will always correspond to the name of a profile which exists within the selected collection. Note that this may differ from profile if the requested profile does not actually exist on disk (in which case it will be set to DefaultValues.DEFAULT_PROFILE, as that is what's used).- Since:
- 15.12
-
serviceConfigProvider
private Function<SearchQuestion,ServiceConfig> serviceConfigProvider
-
clive
private String[] clive
Specific component of a meta-collection to query
-
form
@NonNull private @NonNull String form
Display form (template)
-
cnClickedCluster
private String cnClickedCluster
Contextual Navigation: last clicked cluster
-
cnPreviousClusters
private final List<String> cnPreviousClusters
Contextual Navigation: Previous clicked clusters
-
metaParameters
private final List<String> metaParameters
meta_*
/query_*
input parameters, transformed in query expressions.Those parameters are supposed to be specified by the user, usually in an advanced search form. If you need to inject parameters for technical / behind-the-scene reasons, consider using
systemMetaParameters
.- See Also:
systemMetaParameters
-
systemMetaParameters
private final List<String> systemMetaParameters
smeta_*
/squery_*
input parameters, transformed in query expressions.Those parameters are supposed to be "technical" parameters, usually injected through a hook script. If you want the user to specify parameters, consider using
metaParameters
.- Since:
- 12.2
- See Also:
metaParameters
-
additionalParameters
private final Map<String,String[]> additionalParameters
Additional parameters to pass as-is to PADRE.
The values of this map will be passed through to PADRE and won't be processed at all by the Modern UI. Only parameters relevant to PADRE should be injected here.
Depending on the parameters you want to inject or manipulate, consider using
inputParameters
. Those parameters will be processed by the Modern UI (For example to inject faceted navigation constraints).Note that this map is populated before the first hook script is run: Any additional parameter injected in
inputParameters
in a hook script won't be copied to this map.
-
environmentVariables
private final Map<String,String> environmentVariables
List of environment variables to pass to PADRE.
-
dynamicQueryProcessorOptions
private final List<String> dynamicQueryProcessorOptions
Dynamic query processor options for PADRE, in addition to the one set in
collection.cfg
.Will be updated by the input processing.
-
priorityQueryProcessorOptions
private final PriorityQueryProcessorOptions priorityQueryProcessorOptions
Query processor options that are guaranteed to apply.Internal use only
- Since:
- 15.12
-
selectedFacets
private final Set<String> selectedFacets
List of selected facets.
Contains the name of the facets that were selected, such as "Location" or "Brand", but not the actual value.
-
selectedCategoryValues
private final Map<String,List<String>> selectedCategoryValues
List of selected facets categories.
Contains the actual values that were selected, indexed by facet. For example: "Location" => ("Sydney", "Melbourne").
-
facetsQueryConstraints
private List<String> facetsQueryConstraints
Query constraints to apply for faceted navigation (In addition to other query expressions).
-
facetCollectionConstraints
@NonNull private @NonNull Optional<List<String>> facetCollectionConstraints
The collections to restrict search to for faceted navigation. (In addition to other clive constraints).- Since:
- 15.12
-
facetsGScopeConstraints
private String facetsGScopeConstraints
GScope constraints to apply for faceted navigation (In addition to existing gscope constraints).
-
impersonated
private boolean impersonated
Whether the request is impersonated (Document Level Security)
-
requestId
private String requestId
Request identifier to log for this transaction. Depending on the collection configuration it can be an IP address, a md5 hash of the address, nothing ("-") or null.- Since:
- 12.4 - Renamed from
userId
, 12.5 - Renamed fromuserIdToLog
-
logQuery
private Optional<Boolean> logQuery
Defines if the query should be logged or not, or if it should fall back to default. If false this will prevent the query from being recorded in query logs as well as session history. If not set this will result in the defaults being used. For padre the default is to follow what is in collection.cfg, profile.cfg or padre_opts.cfg, otherwise if the log option is not set in any of those files padre will log the query. This will typically be set false for system generated searches or for extra searches. This may be set from groovy scripts. This can be set to false with cgi parameters on the admin side if the request is authenticated. To do this set &log=false in the URL.- Since:
- 15.14
-
inputParameters
private final com.google.common.collect.ListMultimap<String,String> inputParameters
Raw input parameters
Contains all the input parameters (query string / request parameters).
Be aware that the value type is
ListMultimap
, thus a single key can have multiple values alsoListMultimap.get(Object)
will never return null.In freemarker to get the first value for a key or empty:
question.inputParameters["query"]?first!
In freemarker to test if the key exists and therefore has values:
question.inputParameters?keys?seq_contains("query")
In Java to replace all values for a key:
A clone of this map can be made withinputParameters.replaceValues("query", List.of("my new query"))
getInputParametersCopy()
.To convert such a map into a query string suitable for URLs, see
Object.toString()
- Since:
- 16.0
-
queryStringMap
@NonNull private @NonNull com.google.common.collect.ListMultimap<String,String> queryStringMap
Sets the query string parameter map.
This is for internal use only and shouldn't be called outside initializing the search question. Changing the query string map will affect all the URLs that are constructed in the data model
- Since:
- 15.26
-
questionType
private SearchQuestion.SearchQuestionType questionType
Indicates the 'type' of question, which may trigger special processing in the search lifecycle.
e.g. Extra searches or Content Auditor requests.
-
locale
private Locale locale
Locale
to use for the search.This will affect the UI only, to configure the locale for the query processor please refer to the corresponding option
-lang
.- Since:
- 12.0
-
location
private Location location
Location
information detected for the remote user based on information from their request.- Since:
- 13.0 (12.4 included a MaxMind location class directly here)
-
principal
private Principal principal
Principal representing the remote user for the current request.
Will be NULL if the user isn't authenticated.
Note: This is not included in the JSON / XML output for security reasons
- Since:
- 12.2
-
hostname
private String hostname
Name of the host where PADRE executed the query.
- Since:
- 14.0
-
funnelbackVersion
private FunnelbackVersionI funnelbackVersion
Funnelback version
- Since:
- 15.12
-
maxPadrePacketSize
private Optional<Integer> maxPadrePacketSize
An optional maxPadrePacketSize which may be overridden to set the max Padre packet size that will be permitted. Generally the Config option ui.modern.padre_response_size_limit_bytes should be set in preference to setting this.
- Since:
- 15.12
-
padreTimeout
private Optional<Long> padreTimeout
An optional timeout which when set overrides the value of collection.cfg option ui.modern.padre_fork_timeout_ms, which controls how long the main padre forking may take.
- Since:
- 15.12
-
-
Method Detail
-
getCurrentProfileConfig
public ServiceConfig getCurrentProfileConfig()
Returns the (modern) config of the currentProfile
-
getInputParametersCopy
public com.google.common.collect.ListMultimap<String,String> getInputParametersCopy()
Returns a copy of the
#getInputParameters()
mapBe aware that the value type is
ListMultimap
, thus a single key can have multiple values alsoListMultimap.get(Object)
will never return null.
-
getQueryStringMapCopy
public com.google.common.collect.ListMultimap<String,String> getQueryStringMapCopy()
Query string parameters as a Map
Return a copy of the internal map representing the query string, for easy manipulation of individual parameters rather than having to decode the query string.
The map is a copy intended to be modifiable to add/remove/update query string parameters.
To convert such a map into a query string suitable for URLs, see
Object.toString()
- Returns:
- Query string parameters
- Since:
- 15.10
-
isExtraSearch
@Deprecated public boolean isExtraSearch()
Deprecated.As of release 14.2, replaced byquestionType
Indicates if this question is part of the "main" search, or part of an "extra" search.
This is needed to perform some actions only on the main search but not for every extra search.
-
setExtraSearch
@Deprecated public void setExtraSearch(boolean isExtraSearch)
Deprecated.As of release 14.2, replaced byquestionType
Sets whether this question is part of the "main" search, or part of an "extra" search.
-
-