Class QueryRequest

  • All Implemented Interfaces:
    PlatformMessage, LocaleAware, java.io.Serializable, java.lang.Cloneable

    public class QueryRequest
    extends AbstractPlatformMessage
    implements LocaleAware, java.lang.Cloneable, java.io.Serializable
    Represents a search query and all associated meta data about the query such as sorting, faceting, linguistic options, etc.

    When a QueryRequest is sent to AIE, a QueryResponse will be returned as the result. Use a SearchClient for sending QueryRequests to an AIE instance.

    Paging

    The setOffset(long) and setRows(long) methods can be used in order to page through results. Offset indicates the index into the overall result set for the first returned row. Rows indicates the number of rows that will be returned.

     QueryRequest request;
    
     // Request the first "page" of 10 results
     request = new QueryRequest("*:*");
     request.setOffset(0);
     request.setRows(10);
     // ... (Submit the search and handle response)
    
     // Request the second "page" of 10 results
     request = new QueryRequest("*:*");
     request.setOffset(10);
     request.setRows(10);
     // ... (Submit the search and handle response)
     

    Query Resubmission

    The setMaxResubmits(int) method can be used to control automatic query resubmission. A QueryRequest may be automatically resubmitted to the search engine in case of recoverable error, 0 result response, or other reasons. The configuration for AIE's query workflows will indicate what resubmission may occur. NOTE: resubmission is disabled by default.

     // Allow 1 resubmission
     QueryRequest request = new QueryRequest("*:*");
     request.setMaxResubmits(1);
     // ... (submit the search and handle response)
     

    Field Expressions

    The addField(String) and addField(FieldRequest) methods can be used to request specified fields to returned for the matching documents. By default, all stored fields will be returned. NOTE: if you add a field expression and still want all fields returned in addition to the FieldExpression, you should add the "*" field as well (see below example). FieldExpressions allow returning custom fields derived from stored fields (or generated based on query executed).

     QueryRequest request;
    
     // Request just the "text" field
     request = new QueryRequest("*:*");
     request.addField("text");
     // ... (submit the search and handle response)
    
     // Request the "Geo Distance" Field expression (include all stored fields as well)
     request = new QueryRequest("*:*");
     request.addField("*"); // Request all stored fields
     request.addField(new GeoDistance("position", centerLatitude, centerLongitude));
     // ... (submit the search and handle response)
     

    Boost Queries

    The addBoostQuery(Query) method allows adding a query to use for boosting purposes. The documents that match this query will get an additional boost however this boost query will not affect the documents that match this QueryRequest.

     // Match all documents, boosting documents with "foo" in the title higher
     QueryRequest request = new QueryRequest("*:*");
     request.addBoostQuery(new QueryString("title:foo"));
     // ... (submit the search and handle response)
     

    Score Functions

    The addScoreFunction(FieldExpression) method allows adding function based boosts to documents matching the QueryRequest.

     // Give a static boost to documents based on the indexed value for the "staticboost" field
     QueryRequest request = new QueryRequest("*:*");
     request.addScoreFunction("staticboost");
     // ... (submit the search and handle response)
     

    Sorting

    The addSort(Sort) method allows specifying the sort criteria for the QueryRequest. If no sort criteria is added, then the QueryRequest will be sorted by score descending. Multiple levels of sorting can be added to perform tie-breaking in the event that multiple documents have the same value for a sort.

     // Sort by "size" ascending
     QueryRequest request = new QueryRequest("*:*");
     request.addSort(new Sort("size", Sort.SortOrder.DESCENDING));
     // ... (submit the search and handle response)
     

    Faceting

    The addFacet(FacetRequest[]) and addFacetField(String[]) methods allow requesting facets to be returned along with the results. There are different types of facets that can be requested for a query. The simplest will return counts for all discrete values for a facet field (FacetRequest). RangeFacetRequest can be used to return buckets for specified ranges of values. FilterBasedFacetRequest can be used to get a bucket count for any arbitrary Query over the result set.

     QueryRequest request = new QueryRequest("*:*");
     // request a facet for the author field
     request.addFacetField("author");
     // request a "range" facet with 10 buckets for values between 0 and 1000
     request.addFacet(new RangeFacetRequest("size", 0, 1000, 10));
     // ... (submit the search and handle response)
     

    Filtering

    The addFilter(Query) method allows adding filters to the QueryRequest to restrict the matching documents to those that also match the filter. NOTE: applied filters do not modify the score of the document.

     // Filter result set to the "documents" table
     QueryRequest request = new QueryRequest("*:*");
     request.addFilter(new PhraseQuery("table", "documents"));
     // ... (submit the search and handle response)
     

    WARNING: QueryRequests should not be reused. Reusing a QueryRequest for multiple searches can have adverse effects especially if run inside a single JVM.

    See Also:
    Serialized Form
    • Constructor Detail

      • QueryRequest

        public QueryRequest()
        The default constructor. No query is set.
      • QueryRequest

        public QueryRequest​(Query query)
        Constructor with a Query.
      • QueryRequest

        public QueryRequest​(java.lang.String query)
        Constructor with a string query.
        See Also:
        QueryString
      • QueryRequest

        public QueryRequest​(java.lang.String query,
                            java.lang.String language)
        Constructor with a query string and query language.
        See Also:
        QueryString
    • Method Detail

      • isDebug

        public boolean isDebug()
        Get if debugging information is desired for this request.
      • setDebug

        public void setDebug​(boolean value)
        Set if debugging information is desired for this request.
      • getRows

        public long getRows()
        Get the requested number of documents to return for this request.
      • setRows

        public void setRows​(long value)
        Set the requested number of documents to return in the QueryResponse for this request.

        Only values < Integer.MAX_VALUE are supported.

      • getOffset

        public long getOffset()
        Get the offset into the result set for the first returned document.
      • setOffset

        public void setOffset​(long value)
        Set the offset into the result set for the first returned document.

        Currently only values < Integer.MAX_VALUE are supported.

      • isIncludeMetadataInResponse

        public boolean isIncludeMetadataInResponse()
        True if the response should be removed of all non data elements such as message history and the query request.
      • setIncludeMetadataInResponse

        public void setIncludeMetadataInResponse​(boolean includeMetadataInResponse)
      • isPreview

        public boolean isPreview()
        Get if preview mode is enabled for this query.

        Preview mode will use unpublished resources (if possible) when processing/evaluating the query.

      • setPreview

        public void setPreview​(boolean value)
        Set if preview mode is enabled for this query.

        Preview mode will use unpublished resources (if possible) when processing/evaluating the query.

      • getSearchProfile

        public java.lang.String getSearchProfile()
        Get the name of the search profile to apply to the query request.
      • setSearchProfile

        public void setSearchProfile​(java.lang.String name)
        Set the name of the search profile to apply to the query request.
      • getQuery

        public Query getQuery()
        Get the search query for this QueryRequest.
      • setQuery

        public void setQuery​(Query query)
        Set the search query for this QueryRequest.
      • setQuery

        public void setQuery​(java.lang.String query)
        Set the search query for this QueryRequest.
        See Also:
        QueryString
      • setQueryString

        public void setQueryString​(java.lang.String query)
        Set the search query for this QueryRequest.
        See Also:
        QueryString
      • setQuery

        public void setQuery​(java.lang.String queryString,
                             java.lang.String language)
        Set the search query for this QueryRequest.
        See Also:
        QueryString
      • getQueryString

        public java.lang.String getQueryString()
        Get the original query string for the search query for this QueryRequest.
        See Also:
        Query.getQueryString()
      • getSearchDepth

        public int getSearchDepth()
        Get the number of rows deep the search should go. When using Field Collapsing, increasing this setting increases the accuracy of Field Collapsing across multiple partitions by giving the collapsing algorithm more rows to collapse. There are no other scenarios where this parameter has any effect.

        By default, the search depth will be getOffset() + getRows().

        NOTE: this does not affect the number of documents returned.

      • setSearchDepth

        public void setSearchDepth​(int value)
        Set the number of rows deep the search should go. When using Field Collapsing, increasing this setting increases the accuracy of Field Collapsing across multiple partitions by giving the collapsing algorithm more rows to collapse. There are no other scenarios where this parameter has any effect.

        By default, the search depth will be getOffset() + getRows().

        NOTE: this does not affect the number of documents returned.

      • addBoostQuery

        public void addBoostQuery​(Query boost)
        Add a boost query.

        NOTE: Boost queries are only used for ranking, not matching records.

      • setBoostQueries

        public void setBoostQueries​(java.util.List<Query> value)
        Set the boost queries.
      • getBoostQueries

        public java.util.List<Query> getBoostQueries()
        Get all boost queries applied to this QueryRequest.
      • getFilters

        public java.util.List<Query> getFilters()
        Get all filters for this query.
      • setFilters

        public void setFilters​(java.util.List<Query> filters)
        Set the filter Querys to apply to this QueryRequest.
      • addFilter

        public void addFilter​(Query f)
        Add a filter Query to this QueryRequest.
      • addFilter

        public void addFilter​(java.lang.String exp)
        Add a filter query to this QueryRequest.
      • addFilter

        public void addFilter​(java.lang.String exp,
                              java.lang.String langSpec)
        Add a filter query to this QueryRequest.
        Parameters:
        exp - the query to filter on
        langSpec - the query language for exp
      • getFacetFilters

        public java.util.List<FacetFilter> getFacetFilters()
        Get the FacetFilters that will be used to filter the result set.
      • setFacetFilters

        public void setFacetFilters​(java.util.List<FacetFilter> facetFilters)
        Set the FacetFilters to "drill down" on.
      • addFacetFilter

        public void addFacetFilter​(FacetFilter bucket)
        Adds a filter to this QueryRequest that will "drill down" on bucket.
      • getZones

        public java.util.Set<java.lang.String> getZones()
        Get the names of the zones to apply this query to.
      • setZones

        public void setZones​(java.util.Set<java.lang.String> value)
        Set the names of the zones to apply this query to.
      • setZones

        public void setZones​(java.lang.String... value)
        Set the names of the zones to apply this query to.
      • isCacheable

        public boolean isCacheable()
        Get if the results for this QueryRequest are cacheable.
      • setCacheable

        public void setCacheable​(boolean value)
        Set if the results for this QueryRequest are cacheable.
      • getSeed

        public long getSeed()
        Get the seed used for any random functions over this query request.

        This seed will be used when a "random" sort is applied to this QueryRequest.

      • setSeed

        public void setSeed​(long value)
        Set the seed used for any random functions over this query request.

        This seed will be used when a "random" sort is applied to this QueryRequest.

      • getJoinRollupMode

        public JoinRollupMode getJoinRollupMode()
        Gets the rollup mode for joined documents.

        This setting is only relevant if the search query is a JOIN query.

      • setJoinRollupMode

        public void setJoinRollupMode​(JoinRollupMode value)
        Sets the rollup mode for joined documents.

        This setting is only relevant if the search query is a JOIN query.

      • getJoinFacetMode

        public JoinFacetMode getJoinFacetMode()
        Gets the facet mode for joined documents.

        This setting is only relevant if the search query contains JOIN queries.

      • setJoinFacetMode

        public void setJoinFacetMode​(JoinFacetMode value)
        Sets the facet mode for joined documents.

        This setting is only relevant if the search query contains JOIN queries.

      • getRelevancyModel

        public RelevancyModel getRelevancyModel()
        Gets the relevancy model to use for this query.
      • setRelevancyModel

        public void setRelevancyModel​(RelevancyModel model)
        Sets the relevancy model to use for this query.
      • getRelevancyModelNames

        public java.lang.String[] getRelevancyModelNames()
        Get the names of the requested relevancy models.

        The first relevancy model that exists will be applied during query processing.

      • setRelevancyModelNames

        public void setRelevancyModelNames​(java.util.List<java.lang.String> value)
        Set the names of the requested relevancy models.

        The first relevancy model that exists will be applied during query processing.

      • setRelevancyModelNames

        public void setRelevancyModelNames​(java.lang.String... value)
        Set the names of the requested relevancy models.

        The first relevancy model that exists will be applied during query processing.

      • getRelevancyModelName

        @Deprecated
        public java.lang.String getRelevancyModelName()
        Deprecated.
        Gets the name of the relevancy model to use for this query.
      • setRelevancyModelName

        @Deprecated
        public void setRelevancyModelName​(java.lang.String name)
        Deprecated.
        Sets the name of the relevancy model to use for this query.

        With default configurations, this can be set to "noop" in order to apply an empty relevancy model.

      • isPartialResults

        public boolean isPartialResults()
        Gets if partial result is allowed for this request.
      • setPartialResults

        public void setPartialResults​(boolean value)
        Gets if partial result is allowed for this request.
      • getRelevancyFeatures

        public java.util.List<RelevancyFeature> getRelevancyFeatures()
        Get the features to use for relevancy.
      • setRelevancyFeatures

        public void setRelevancyFeatures​(java.util.List<RelevancyFeature> value)
        Set the features to use for relevancy.
      • setRelevancyFeatures

        public void setRelevancyFeatures​(RelevancyFeature... value)
        Set the features to use for relevancy.
      • getScoreFunctions

        public java.util.List<FieldExpression> getScoreFunctions()
        Gets the scoring functions to use for this QueryRequest.
      • setScoreFunctions

        public void setScoreFunctions​(java.util.List<FieldExpression> value)
        Sets the scoring functions to use for this QueryRequest.
      • addScoreFunction

        public void addScoreFunction​(java.lang.String value)
        Add a scoring function to this QueryRequest.
      • addScoreFunction

        public void addScoreFunction​(java.lang.String... value)
        Add a scoring function to this QueryRequest.
      • addScoreFunction

        public void addScoreFunction​(FieldExpression value)
        Add a scoring function to this QueryRequest.
      • addScoreFunction

        public void addScoreFunction​(FieldExpression... value)
        Add a scoring function to this QueryRequest.
      • getMaxResubmits

        public int getMaxResubmits()
        Gets the maximum number of resubmits allowed for this QueryRequest.
      • setMaxResubmits

        public void setMaxResubmits​(int value)
        Sets the maximum number of resubmits allowed for this QueryRequest.
      • getResubmits

        public int getResubmits()
        Get the number of times this QueryRequest has been resubmitted.
      • setResubmits

        public void setResubmits​(int rs)
        Set the number of times this QueryRequest has been resubmitted.

        NOTE: this method should only be used by QueryResponse Transformers that will perform resubmit logic.

      • incrementResubmits

        public void incrementResubmits()
        Increment the number of times this QueryRequest has been resubmitted.

        NOTE: this method should only be used by QueryResponse Transformers that will perform resubmit logic.

      • getSort

        public java.util.List<Sort> getSort()
        Get the sorting specification for this QueryRequest.

        If null or "empty", then sorting will be done by score descending.

      • setSort

        public void setSort​(Sort... value)
      • setSort

        public void setSort​(java.util.List<Sort> value)
        Set the sorting specification for this QueryRequest.

        If null or "empty", then sorting will be done by score descending.

      • addSort

        public void addSort​(Sort value)
        Add a Sort specifier to this QueryRequest.
      • addSort

        public void addSort​(java.lang.String field,
                            Sort.SortOrder order)
      • getFacetSampleSize

        public int getFacetSampleSize()
        Get the sample size for sample based facets.
      • setFacetSampleSize

        public void setFacetSampleSize​(int value)
        Set the sample size for sample based facets.
      • hasFacets

        public boolean hasFacets()
        true if this QueryRequest is requesting any Facets.
      • getFacets

        public java.util.List<FacetRequest> getFacets()
        Get the facets requested for this QueryRequest.
      • forEachFacet

        public void forEachFacet​(java.util.function.Consumer<FacetRequest> consumer)
        Consume all requested FacetRequests with consumer.
      • setFacets

        public void setFacets​(java.lang.String... facets)
        Set the fields to request facets for.

        NOTE: overwrites any FacetRequests already set.

      • setFacets

        public void setFacets​(FacetRequest... facets)
        Set the FacetRequests for this query.

        NOTE: overwrites any FacetRequests already set

      • addFacetField

        public void addFacetField​(java.lang.String... fieldNames)
        Adds a FacetRequest for all specified fields.
      • removeFacet

        public boolean removeFacet​(FacetRequest facet)
        Remove the specified FacetRequest.
      • removeFacet

        public boolean removeFacet​(java.lang.String facetRequestName)
        Remove the specified FacetRequest by name.
      • isHighlight

        public boolean isHighlight()
        true if highlighting should be performed for configured fields.
      • setHighlight

        public void setHighlight​(boolean value)
        Set if highlighting should be performed for configured fields.
      • setHighlightMode

        public void setHighlightMode​(HighlightMode value)
        Set the HighlightMode for annotating scopes in highlighted text.
      • getHighlightScope

        public java.lang.String getHighlightScope()
        Get the name of the scope used to annotate matching phrases in highlighted text.
      • setHighlightScope

        public void setHighlightScope​(java.lang.String value)
        Set the name of the scope used to annotate matching phrases in highlighted text.
      • getFields

        @Deprecated
        public FieldExpression[] getFields()
        Deprecated.
        use getFieldRequests() or forEachField(Consumer) to get the requested fields instead.
        Get the fields requested for this query (or null for SELECT *).

        DEPRECATION NOTE: in a future release, this method will be updated to return FieldRequest[] instead.

      • getFieldRequestCount

        public int getFieldRequestCount()
        Get the number of requested fields, or -1 for Select *.
      • getFieldRequests

        public FieldRequest[] getFieldRequests()
        Get the fields requested for this query (or null for SELECT *).
      • forEachField

        public void forEachField​(java.util.function.Consumer<FieldRequest> consumer)
        Consume all FieldRequests with consumer.
      • setFields

        public void setFields​(FieldRequest... value)
        Set the fields to return for this QueryRequest.
      • setFields

        public void setFields​(java.util.Collection<FieldExpression> value)
        Set the fields to return for this QueryRequest.
      • setFields

        public void setFields​(FieldExpression... newFields)
        Set the fields to return for this QueryRequest.
      • setFields

        public void setFields​(java.lang.String... newFields)
        Set the names of the fields that should be returned in the response. (or null for SELECT *).

        NOTE: if isHighlight() returns true, then any field in fields that is configured in the schema for highlighting will be returned highlighted according to schema configuration. Use addField(FieldExpression) to add FieldExpressions configured as desired.

      • addField

        public QueryRequest addField​(java.lang.String field)
        Add a field to return in the response documents.
      • addField

        public QueryRequest addField​(FieldExpression field,
                                     java.lang.String name)
        Add a field to return in the response documents.
      • getFieldCollapse

        public FieldCollapse getFieldCollapse()
        Get the field collapsing specification for this QueryRequest.
      • setFieldCollapse

        public void setFieldCollapse​(FieldCollapse value)
        Set the field collapsing specification for this QueryRequest.
      • getGroupByFilter

        public FieldExpression getGroupByFilter()
        Experimental: Get the filter to apply to groups.

        This allows applying a HAVING filter to the result set. This filter requires that a groupby has been applied to the query.

      • setGroupByFilter

        public void setGroupByFilter​(FieldExpression value)
        Experimental: Set the filter to apply to groups.
      • setGroupByFilter

        public void setGroupByFilter​(java.lang.String value)
        Experimental: Set the filter to apply to groups.
      • getRowFilter

        public FieldExpression getRowFilter()
        Experimental: Get the filter to apply to rows.

        This allows applying a field expression based WHERE filter to the result set.

      • setRowFilter

        public void setRowFilter​(FieldExpression value)
        Experimental: Set the filter to apply to rows.
      • setRowFilter

        public void setRowFilter​(java.lang.String value)
        Experimental: Set the filter to apply to rows.
      • getGroupBy

        public FieldExpression[] getGroupBy()
        Get the Group By specification.
      • setGroupBy

        public void setGroupBy​(java.lang.String... columns)
        Set the Group By specification.
      • setGroupBy

        public void setGroupBy​(FieldExpression... columns)
        Set the Group By specification.
      • setGroupBy

        public void setGroupBy​(java.util.List<FieldExpression> columns)
        Set the Group By specification.
      • getSpellCheckDictionaryName

        public java.lang.String getSpellCheckDictionaryName()
        Get the name of the dictionary to use for spellcheck.
      • setSpellCheckDictionaryName

        public void setSpellCheckDictionaryName​(java.lang.String value)
        Set the name of the dictionary to use for spellcheck.
      • getSpellCheckExpandSize

        public int getSpellCheckExpandSize()
        Gets the number of expanded suggestions that will be added for misspelled terms.

        NOTE: this setting will only be used if the AUTO_EXPAND spell check mode is used.

      • setSpellCheckExpandSize

        public void setSpellCheckExpandSize​(int value)
        Sets the number of expanded suggestions that will be added for misspelled terms.

        NOTE: this setting will only be used if the AUTO_EXPAND spell check mode is used.

      • setAcronymsMode

        public void setAcronymsMode​(QueryRequest.AcronymsMode acronymsMode)
        Set the mode for expanding acronyms.
      • getAcronymDictionaryName

        public java.lang.String getAcronymDictionaryName()
        Get the name of the dictionary to use for acronym expansion.
      • setAcronymDictionaryName

        public void setAcronymDictionaryName​(java.lang.String value)
        Set the name of the dictionary to use for acronym expansion.
      • getAcronymBoost

        public int getAcronymBoost()
        Get the boost to apply to expanded acronyms.
      • setAcronymBoost

        public void setAcronymBoost​(int acronymBoost)
        Set the boost to apply to expanded acronyms.

        This can be used to reduce or nullify the boost contributed by acronyms in order to utilize acronym expansion for increasing recall.

      • setSynonymsMode

        public void setSynonymsMode​(QueryRequest.SynonymsMode synonymsMode)
        Set the mode for synonym expansion.
      • getSynonymDictionaryName

        public java.lang.String getSynonymDictionaryName()
        Get the name of the dictionary to use for synonym expansion.
      • setSynonymDictionaryName

        public void setSynonymDictionaryName​(java.lang.String value)
        Set the name of the dictionary to use for synonym expansion.
      • getSynonymBoost

        public int getSynonymBoost()
        Get the boost to apply to expanded synonyms.
      • setSynonymBoost

        public void setSynonymBoost​(int synonymBoost)
        Set the boost to apply to expanded synonyms.

        This can be used to reduce or nullify the boost contributed by synonyms in order to utilize synonym expansion for increasing recall.

      • setStopwordsMode

        public void setStopwordsMode​(QueryRequest.StopwordsMode stopwordsMode)
        Set the mode for stopword removal.
      • getStopwordDictionaryName

        public java.lang.String getStopwordDictionaryName()
        Get the name of the dictionary to use for stopword removal.
      • setStopwordDictionaryName

        public void setStopwordDictionaryName​(java.lang.String value)
        Set the name of the dictionary to use for stopword removal.
      • getFacetFinderCount

        public int getFacetFinderCount()
        Get the maximum number of facets FacetFinder will add to this QueryRequest.
      • setFacetFinderCount

        public void setFacetFinderCount​(int facetFinderCount)
        Set the maximum number of facets FacetFinder will add to this QueryRequest.
      • getLocale

        public java.util.Locale getLocale()
        Get the Locale for this query.
        Specified by:
        getLocale in interface LocaleAware
      • setLocale

        public void setLocale​(java.util.Locale l)
        Set the Locale for this query.

        In general a correct value for the Locale is required in order to perform proper query side linguistics.

        Specified by:
        setLocale in interface LocaleAware
      • getCenterTime

        public java.util.Date getCenterTime()
        Since:
        5.5.0.3 Get the center time used for evaluating date expressions.

        This center time will be used as the "current time" for all evaluated field expressions (such as CurrentTime)

      • setCenterTime

        public void setCenterTime​(java.util.Date value)
        Since:
        5.5.0.3 Set the center time used for evaluating date expressions.

        This center time will be used as the "current time" for all evaluated field expressions (such as CurrentTime)

      • getTimeZone

        public java.util.TimeZone getTimeZone()
        Get the TimeZone for this query.
      • setTimeZone

        public void setTimeZone​(java.util.TimeZone value)
        Set the TimeZone for this query.
      • getSchemaName

        public java.lang.String getSchemaName()
        Get the name of the schema to use for processing this QueryRequest.
      • setSchemaName

        public void setSchemaName​(java.lang.String schemaName)
        Set the name of the schema to use for processing this QueryRequest.
      • toString

        protected java.lang.StringBuilder toString​(java.lang.StringBuilder buffer)
        Append the string form of this request to buffer.
        Overrides:
        toString in class AbstractPlatformMessage
      • toCgiRequest

        public CgiRequest toCgiRequest()
        Creates a CgiRequest from a QueryRequest. This is the inverse operation of the QueryRequest create method.

        Not all queries and filters are guaranteed to have equivalent parseable string representations; this method cannot guarantee an equivalent CGI Request for such cases.

      • toCgiString

        public java.lang.String toCgiString()
        Returns a parseable CGI string representation of the request
      • getGeoLocationField

        public java.lang.String getGeoLocationField()
        Get the default field to use for geo distance calculations.
      • getGeoLocation

        public Point getGeoLocation()
        Get the default center point for geo distance calculations.
      • setProperties

        public void setProperties​(java.util.Map<java.lang.String,​java.lang.String[]> parameters)
                           throws AttivioException
        Throws:
        AttivioException
      • setProperty

        public void setProperty​(java.lang.String name,
                                java.lang.Object value)
        Description copied from class: AbstractPlatformMessage
        Sets an arbitrary property for the message. Some transformations of messages may result in the value being converted to a String.
        Specified by:
        setProperty in interface PlatformMessage
        Overrides:
        setProperty in class AbstractPlatformMessage
        Parameters:
        name - the key
        value - the value
      • create

        public static QueryRequest create​(CgiRequest cgi)
                                   throws AttivioException
        Converts CGI HTTP POST/GET request to a QueryRequest.

        ParameterType(1)DefaultMulti(2)DescriptionExample
        clientid String optional no Client ID. clientid=1234
        workflows String required no Comma separated list of workflows to send the query through. workflows=defaultQuery,searcher,defaultResponse
        q String required no Query String q=cat
        q.type String advanced no Query Language used. [ simple | advanced ] q.type=simple
        filter String optional yes Filter Query to apply. filter=position:POLYGON((5.0, 9.0), (5.0, 11.0), (6.0, 11.0), (6.0, 9.0))
        q.filter String optional yes Query Filter. q.filter=color:black
        q.filter.type String simple no Deprecated. Query Language used by filter. [ simple | advanced ] q.filter.type=advanced
        q.boost String optional yes Query Boost Expression q.boost=foo
        q.boost.type String advanced no Query Language used by query boosts. [ simple | advanced ] q.boost.type=advanced
        q.maxResubmits unsigned 0 no Maximum number of times query can be resubmitted. q.maxResubmits=5
        hits unsigned 10L no Number of records to return. hits=100
        offset unsigned 0L no Retrieve number of records starting from offset. offset=20
        searchDepth unsigned 0 no Number of rows deep to search. searchDepth=100
        searchProfile String optional no Name of the search profile to use. searchProfile=mySearchProfile
        debug boolean false no Enable debugging information. true or false debug=true
        includeMetadataInResponse boolean false no Include non essential/data (from the index) information in the response. true or false debug=true
        partialResults boolean false no Enable/Disable partial results from distributed indexes partialResults=false
        abc.enabled boolean false no Whether or not the query should be annotated as an Attivio Business Center query. abc.enabled=true
        cacheable boolean true no Is the result cacheable? cacheable=false
        seed long 0L no Seed to use for random number generation (random sorting, etc) seed=38293843928
        locale String en no 2 letter iso code for locale. locale=en
        timezone String UTC no Time Zone for date interpretation. timezone=EST
        schema String optional no Name of the schema to use for query processing schema=default
        relevancymodelname String optional no Comma separated list of relevancy model names to use for ranking documents by relevancy. The first relevancy model specified that exists will be used. relevancyModelName=myTestModel
        highlight boolean false no highlight results based on schema configuration highlight=true
        fields String optional yes Comma separated list of field expressions to return with response documents. fields=*,geodistance(position, 72.3, 71.5, degrees, miles) AS distance
        sort String optional no Comma separated list of fields to sort by [ ASC | DESC ] sort=title:asc,body:desc
        score.function String optional yes Score function to boost matching documents with score.function=product(sum(5.5, boostfield), boostfactorfield)
        collapse String optional no Field collapsing specification. Example: collapse=cat(mode=2D, rows=10)
        facet String optional yes Comma separated list of discrete facet definitions. Example: facet=title(mincutoff=3,sortby=count),category(maxnumbuckets=100)
        facet.filter String optional no Facet bucket to use for filtering results. Example: facet.filter=department:"Sales Engineering"
        rangeFacet String optional yes Comma separated list of range facet definitions. rangeFacet=size(range=int("label-1", 0, 5),range=int("label-2", 5, 10))
        rangeFacet.filter String optional no Range Facet bucket to use for filtering results. Example: rangeFacet.filter=size:[0 TO 50]
        schemaFacet String optional yes Schema facet definition schemaFacet=schema(schemaFields=true)
        facet.ff enum OFF no Facet finder mode. [ OFF | RESULTS ] facet.ff=RESULTS
        facet.ffcount unsigned 3 no Limit the number of facets returned by Facet Finder service facet.ffcount=4
        join.rollup enum AGGREGATE no Join children aggregation mode. [ AGGREGATE | TREE] join.rollup=TREE
        join.facet enum DISTINCT no Join children facet aggregation mode. [ DISTINCT | FULL] join.facet=FULL
        l.stopwords.mode enum OFF no Enable stop word removal. [ OFF | REMOVE | BLOCK ] l.stopwords.mode=off
        l.acronym.dictionary String optional no Name of the acronym dictionary to use. l.acronym.dictionary=myAcronymDictionary
        l.acronyms.mode enum OFF no Enable acronym expansion. [ OFF | ON | AUTO ] l.acronyms.mode=off
        l.acronyms.boost int 100 no Set boost for expanded acronyms. l.acronyms.boost=25
        l.synonym.dictionary String optional no Name of the synonym dictionary to use. l.synonym.dictionary=mySynonymDictionary
        l.synonyms.mode enum OFF no Enable synonyms. [ OFF | ON | AUTO ] l.synoynms.mode=off
        l.synonymBoost int 100 no set synonym boost or down weight. l.synoynmBoost=25
        l.spell.mode enum OFF no Spelling Correction Mode. [ OFF | SUGGEST | AUTOCORRECT | AUTOEXPAND ] l.spell.mode=SUGGEST
        l.spellexpandsize unsigned 2 no Sets the number of expanded suggestions that will be added for misspelled terms. l.spellexpandsize=2
        geo.field String optional no The default field to use for geo search. geo.field=position
        geo.latitude double optional no The default latitude of center point for geo search. geo.latitude=0
        geo.longitude double optional no The default longitude of center point for geo search. geo.longitude=0
        geo.distanceUnits enum KILOMETERS no The units distances are specified. [ KILOMETERS | METERS | MILES | YARDS | NAUTICAL_MILES ] geo.distanceUnits=MILES
        any unknown parameter String optional optional All unknown cgi parameters are set as message properties via setProperty(String, Object). These properties can then be used by custom transformers or accessed in cgi query logs for reporting purposes. myProp=myValue

        (1) The Type column indicates the data type expected for values of the query parameter. If values are specified that are not of this type, the default value will be used instead, unless the parameter is optional, in which case the parameter will be ignored.

        (2) The Multi column indicates whether or not the HTTP query parameter can be specified multiple times. For example, since the q.filter parameter is Multi=yes, you can specify it mulitiple times like so q.filter=filter1&q.filter=filter2.

        Parameters:
        cgi - - CGI request object
        Throws:
        AttivioException
      • getPrincipal

        public AttivioPrincipal getPrincipal()
        Returns:
        attivio principal on request, or null if none exists