Class QueryOptions

java.lang.Object
com.ibm.cloud.sdk.core.service.model.GenericModel
com.ibm.watson.discovery.v2.model.QueryOptions
All Implemented Interfaces:
com.ibm.cloud.sdk.core.service.model.ObjectModel

public class QueryOptions
extends com.ibm.cloud.sdk.core.service.model.GenericModel
The query options.
  • Method Details

    • newBuilder

      public QueryOptions.Builder newBuilder()
      New builder.
      Returns:
      a QueryOptions builder
    • projectId

      public String projectId()
      Gets the projectId.

      The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling.

      Returns:
      the projectId
    • collectionIds

      public List<String> collectionIds()
      Gets the collectionIds.

      A comma-separated list of collection IDs to be queried against.

      Returns:
      the collectionIds
    • filter

      public String filter()
      Gets the filter.

      A cacheable query that excludes documents that don't mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.

      Returns:
      the filter
    • query

      public String query()
      Gets the query.

      A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first. Use a query search when you want to find the most relevant search results.

      Returns:
      the query
    • naturalLanguageQuery

      public String naturalLanguageQuery()
      Gets the naturalLanguageQuery.

      A natural language query that returns relevant documents by utilizing training data and natural language understanding.

      Returns:
      the naturalLanguageQuery
    • aggregation

      public String aggregation()
      Gets the aggregation.

      An aggregation search that returns an exact answer by combining query search with filters. Useful for applications to build lists, tables, and time series. For a full list of possible aggregations, see the Query reference.

      Returns:
      the aggregation
    • count

      public Long count()
      Gets the count.

      Number of results to return.

      Returns:
      the count
    • xReturn

      public List<String> xReturn()
      Gets the xReturn.

      A list of the fields in the document hierarchy to return. If this parameter not specified, then all top-level fields are returned.

      Returns:
      the xReturn
    • offset

      public Long offset()
      Gets the offset.

      The number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results.

      Returns:
      the offset
    • sort

      public String sort()
      Gets the sort.

      A comma-separated list of fields in the document to sort on. You can optionally specify a sort direction by prefixing the field with `-` for descending or `+` for ascending. Ascending is the default sort direction if no prefix is specified. This parameter cannot be used in the same query as the **bias** parameter.

      Returns:
      the sort
    • highlight

      public Boolean highlight()
      Gets the highlight.

      When `true`, a highlight field is returned for each result which contains the fields which match the query with `<em></em>` tags around the matching query terms.

      Returns:
      the highlight
    • spellingSuggestions

      public Boolean spellingSuggestions()
      Gets the spellingSuggestions.

      When `true` and the **natural_language_query** parameter is used, the **natural_language_query** parameter is spell checked. The most likely correction is returned in the **suggested_query** field of the response (if one exists).

      Returns:
      the spellingSuggestions
    • tableResults

      public QueryLargeTableResults tableResults()
      Gets the tableResults.

      Configuration for table retrieval.

      Returns:
      the tableResults
    • suggestedRefinements

      public QueryLargeSuggestedRefinements suggestedRefinements()
      Gets the suggestedRefinements.

      Configuration for suggested refinements.

      Returns:
      the suggestedRefinements
    • passages

      public QueryLargePassages passages()
      Gets the passages.

      Configuration for passage retrieval.

      Returns:
      the passages