Class QueryOptions

java.lang.Object
com.ibm.cloud.sdk.core.service.model.GenericModel
com.ibm.watson.discovery.v1.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
    • environmentId

      public String environmentId()
      Gets the environmentId.

      The ID of the environment.

      Returns:
      the environmentId
    • collectionId

      public String collectionId()
      Gets the collectionId.

      The ID of the collection.

      Returns:
      the collectionId
    • 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
    • passages

      public Boolean passages()
      Gets the passages.

      A passages query that returns the most relevant passages from the results.

      Returns:
      the passages
    • 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 String xReturn()
      Gets the xReturn.

      A comma-separated list of the portion of the document hierarchy to return.

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

      public String passagesFields()
      Gets the passagesFields.

      A comma-separated list of fields that passages are drawn from. If this parameter not specified, then all top-level fields are included.

      Returns:
      the passagesFields
    • passagesCount

      public Long passagesCount()
      Gets the passagesCount.

      The maximum number of passages to return. The search returns fewer passages if the requested total is not found. The default is `10`. The maximum is `100`.

      Returns:
      the passagesCount
    • passagesCharacters

      public Long passagesCharacters()
      Gets the passagesCharacters.

      The approximate number of characters that any one passage will have.

      Returns:
      the passagesCharacters
    • deduplicate

      public Boolean deduplicate()
      Gets the deduplicate.

      When `true`, and used with a Watson Discovery News collection, duplicate results (based on the contents of the **title** field) are removed. Duplicate comparison is limited to the current query only; **offset** is not considered. This parameter is currently Beta functionality.

      Returns:
      the deduplicate
    • deduplicateField

      public String deduplicateField()
      Gets the deduplicateField.

      When specified, duplicate results based on the field specified are removed from the returned results. Duplicate comparison is limited to the current query only, **offset** is not considered. This parameter is currently Beta functionality.

      Returns:
      the deduplicateField
    • similar

      public Boolean similar()
      Gets the similar.

      When `true`, results are returned based on their similarity to the document IDs specified in the **similar.document_ids** parameter.

      Returns:
      the similar
    • similarDocumentIds

      public String similarDocumentIds()
      Gets the similarDocumentIds.

      A comma-separated list of document IDs to find similar documents.

      **Tip:** Include the **natural_language_query** parameter to expand the scope of the document similarity search with the natural language query. Other query parameters, such as **filter** and **query**, are subsequently applied and reduce the scope.

      Returns:
      the similarDocumentIds
    • similarFields

      public String similarFields()
      Gets the similarFields.

      A comma-separated list of field names that are used as a basis for comparison to identify similar documents. If not specified, the entire document is used for comparison.

      Returns:
      the similarFields
    • bias

      public String bias()
      Gets the bias.

      Field which the returned results will be biased against. The specified field must be either a **date** or **number** format. When a **date** type field is specified returned results are biased towards field values closer to the current date. When a **number** type field is specified, returned results are biased towards higher field values. This parameter cannot be used in the same query as the **sort** parameter.

      Returns:
      the bias
    • spellingSuggestions

      public Boolean spellingSuggestions()
      Gets the spellingSuggestions.

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

      **Important:** this parameter is only valid when using the Cloud Pak version of Discovery.

      Returns:
      the spellingSuggestions
    • xWatsonLoggingOptOut

      public Boolean xWatsonLoggingOptOut()
      Gets the xWatsonLoggingOptOut.

      If `true`, queries are not stored in the Discovery **Logs** endpoint.

      Returns:
      the xWatsonLoggingOptOut