@@ -505,84 +505,6 @@ def delete_configuration(environment_id:, configuration_id:)
505505 response
506506 end
507507 #########################
508- # Test your configuration on a document
509- #########################
510-
511- ##
512- # @!method test_configuration_in_environment(environment_id:, configuration: nil, file: nil, filename: nil, file_content_type: nil, metadata: nil, step: nil, configuration_id: nil)
513- # Test configuration.
514- # **Deprecated** This method is no longer supported and is scheduled to be removed
515- # from service on July 31st 2019.
516- #
517- # Runs a sample document through the default or your configuration and returns
518- # diagnostic information designed to help you understand how the document was
519- # processed. The document is not added to the index.
520- # @param environment_id [String] The ID of the environment.
521- # @param configuration [String] The configuration to use to process the document. If this part is provided, then
522- # the provided configuration is used to process the document. If the
523- # **configuration_id** is also provided (both are present at the same time), then
524- # request is rejected. The maximum supported configuration size is 1 MB.
525- # Configuration parts larger than 1 MB are rejected. See the `GET
526- # /configurations/{configuration_id}` operation for an example configuration.
527- # @param file [File] The content of the document to ingest. The maximum supported file size when adding
528- # a file to a collection is 50 megabytes, the maximum supported file size when
529- # testing a confiruration is 1 megabyte. Files larger than the supported size are
530- # rejected.
531- # @param filename [String] The filename for file.
532- # @param file_content_type [String] The content type of file.
533- # @param metadata [String] The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB
534- # are rejected. Example: ``` {
535- # "Creator": "Johnny Appleseed",
536- # "Subject": "Apples"
537- # } ```.
538- # @param step [String] Specify to only run the input document through the given step instead of running
539- # the input document through the entire ingestion workflow. Valid values are
540- # `convert`, `enrich`, and `normalize`.
541- # @param configuration_id [String] The ID of the configuration to use to process the document. If the
542- # **configuration** form part is also provided (both are present at the same time),
543- # then the request will be rejected.
544- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
545- def test_configuration_in_environment ( environment_id :, configuration : nil , file : nil , filename : nil , file_content_type : nil , metadata : nil , step : nil , configuration_id : nil )
546- raise ArgumentError . new ( "environment_id must be provided" ) if environment_id . nil?
547-
548- headers = {
549- }
550- sdk_headers = Common . new . get_sdk_headers ( "discovery" , "V1" , "test_configuration_in_environment" )
551- headers . merge! ( sdk_headers )
552-
553- params = {
554- "version" => @version ,
555- "step" => step ,
556- "configuration_id" => configuration_id
557- }
558-
559- form_data = { }
560-
561- form_data [ :configuration ] = HTTP ::FormData ::Part . new ( configuration . to_s , content_type : "text/plain" ) unless configuration . nil?
562-
563- unless file . nil?
564- unless file . instance_of? ( StringIO ) || file . instance_of? ( File )
565- file = file . respond_to? ( :to_json ) ? StringIO . new ( file . to_json ) : StringIO . new ( file )
566- end
567- filename = file . path if filename . nil? && file . respond_to? ( :path )
568- form_data [ :file ] = HTTP ::FormData ::File . new ( file , content_type : file_content_type . nil? ? "application/octet-stream" : file_content_type , filename : filename )
569- end
570-
571- form_data [ :metadata ] = HTTP ::FormData ::Part . new ( metadata . to_s , content_type : "text/plain" ) unless metadata . nil?
572-
573- method_url = "/v1/environments/%s/preview" % [ ERB ::Util . url_encode ( environment_id ) ]
574-
575- response = request (
576- method : "POST" ,
577- url : method_url ,
578- headers : headers ,
579- params : params ,
580- form : form_data ,
581- accept_json : true
582- )
583- response
584- end
585- #########################
586508 # Collections
587509 #########################
588510
@@ -1383,7 +1305,7 @@ def delete_document(environment_id:, collection_id:, document_id:)
13831305 #########################
13841306
13851307 ##
1386- # @!method query(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, collection_ids: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, x_watson_logging_opt_out: nil)
1308+ # @!method query(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, x_watson_logging_opt_out: nil)
13871309 # Query a collection.
13881310 # By using this method, you can construct long queries. For details, see the
13891311 # [Discovery
@@ -1425,8 +1347,6 @@ def delete_document(environment_id:, collection_id:, document_id:)
14251347 # @param deduplicate_field [String] When specified, duplicate results based on the field specified are removed from
14261348 # the returned results. Duplicate comparison is limited to the current query only,
14271349 # **offset** is not considered. This parameter is currently Beta functionality.
1428- # @param collection_ids [String] A comma-separated list of collection IDs to be queried against. Required when
1429- # querying multiple collections, invalid when performing a single collection query.
14301350 # @param similar [Boolean] When `true`, results are returned based on their similarity to the document IDs
14311351 # specified in the **similar.document_ids** parameter.
14321352 # @param similar_document_ids [String] A comma-separated list of document IDs to find similar documents.
@@ -1446,7 +1366,7 @@ def delete_document(environment_id:, collection_id:, document_id:)
14461366 # parameter.
14471367 # @param x_watson_logging_opt_out [Boolean] If `true`, queries are not stored in the Discovery **Logs** endpoint.
14481368 # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1449- def query ( environment_id :, collection_id :, filter : nil , query : nil , natural_language_query : nil , passages : nil , aggregation : nil , count : nil , _return : nil , offset : nil , sort : nil , highlight : nil , passages_fields : nil , passages_count : nil , passages_characters : nil , deduplicate : nil , deduplicate_field : nil , collection_ids : nil , similar : nil , similar_document_ids : nil , similar_fields : nil , bias : nil , x_watson_logging_opt_out : nil )
1369+ def query ( environment_id :, collection_id :, filter : nil , query : nil , natural_language_query : nil , passages : nil , aggregation : nil , count : nil , _return : nil , offset : nil , sort : nil , highlight : nil , passages_fields : nil , passages_count : nil , passages_characters : nil , deduplicate : nil , deduplicate_field : nil , similar : nil , similar_document_ids : nil , similar_fields : nil , bias : nil , x_watson_logging_opt_out : nil )
14501370 raise ArgumentError . new ( "environment_id must be provided" ) if environment_id . nil?
14511371
14521372 raise ArgumentError . new ( "collection_id must be provided" ) if collection_id . nil?
@@ -1477,7 +1397,6 @@ def query(environment_id:, collection_id:, filter: nil, query: nil, natural_lang
14771397 "passages.characters" => passages_characters ,
14781398 "deduplicate" => deduplicate ,
14791399 "deduplicate.field" => deduplicate_field ,
1480- "collection_ids" => collection_ids ,
14811400 "similar" => similar ,
14821401 "similar.document_ids" => similar_document_ids ,
14831402 "similar.fields" => similar_fields ,
@@ -1594,12 +1513,13 @@ def query_notices(environment_id:, collection_id:, filter: nil, query: nil, natu
15941513 end
15951514
15961515 ##
1597- # @!method federated_query(environment_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, collection_ids : nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, x_watson_logging_opt_out: nil)
1516+ # @!method federated_query(environment_id:, collection_ids:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, x_watson_logging_opt_out: nil)
15981517 # Query multiple collections.
15991518 # By using this method, you can construct long queries that search multiple
16001519 # collection. For details, see the [Discovery
16011520 # documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-query-concepts#query-concepts).
16021521 # @param environment_id [String] The ID of the environment.
1522+ # @param collection_ids [String] A comma-separated list of collection IDs to be queried against.
16031523 # @param filter [String] A cacheable query that excludes documents that don't mention the query content.
16041524 # Filter searches are better for metadata-type searches and for assessing the
16051525 # concepts in the data set.
@@ -1635,8 +1555,6 @@ def query_notices(environment_id:, collection_id:, filter: nil, query: nil, natu
16351555 # @param deduplicate_field [String] When specified, duplicate results based on the field specified are removed from
16361556 # the returned results. Duplicate comparison is limited to the current query only,
16371557 # **offset** is not considered. This parameter is currently Beta functionality.
1638- # @param collection_ids [String] A comma-separated list of collection IDs to be queried against. Required when
1639- # querying multiple collections, invalid when performing a single collection query.
16401558 # @param similar [Boolean] When `true`, results are returned based on their similarity to the document IDs
16411559 # specified in the **similar.document_ids** parameter.
16421560 # @param similar_document_ids [String] A comma-separated list of document IDs to find similar documents.
@@ -1656,7 +1574,7 @@ def query_notices(environment_id:, collection_id:, filter: nil, query: nil, natu
16561574 # parameter.
16571575 # @param x_watson_logging_opt_out [Boolean] If `true`, queries are not stored in the Discovery **Logs** endpoint.
16581576 # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1659- def federated_query ( environment_id :, filter : nil , query : nil , natural_language_query : nil , passages : nil , aggregation : nil , count : nil , _return : nil , offset : nil , sort : nil , highlight : nil , passages_fields : nil , passages_count : nil , passages_characters : nil , deduplicate : nil , deduplicate_field : nil , collection_ids : nil , similar : nil , similar_document_ids : nil , similar_fields : nil , bias : nil , x_watson_logging_opt_out : nil )
1577+ def federated_query ( environment_id :, collection_ids : , filter : nil , query : nil , natural_language_query : nil , passages : nil , aggregation : nil , count : nil , _return : nil , offset : nil , sort : nil , highlight : nil , passages_fields : nil , passages_count : nil , passages_characters : nil , deduplicate : nil , deduplicate_field : nil , similar : nil , similar_document_ids : nil , similar_fields : nil , bias : nil , x_watson_logging_opt_out : nil )
16601578 raise ArgumentError . new ( "environment_id must be provided" ) if environment_id . nil?
16611579
16621580 headers = {
@@ -1670,6 +1588,7 @@ def federated_query(environment_id:, filter: nil, query: nil, natural_language_q
16701588 }
16711589
16721590 data = {
1591+ "collection_ids" => collection_ids ,
16731592 "filter" => filter ,
16741593 "query" => query ,
16751594 "natural_language_query" => natural_language_query ,
@@ -1685,7 +1604,6 @@ def federated_query(environment_id:, filter: nil, query: nil, natural_language_q
16851604 "passages.characters" => passages_characters ,
16861605 "deduplicate" => deduplicate ,
16871606 "deduplicate.field" => deduplicate_field ,
1688- "collection_ids" => collection_ids ,
16891607 "similar" => similar ,
16901608 "similar.document_ids" => similar_document_ids ,
16911609 "similar.fields" => similar_fields ,
@@ -1791,116 +1709,6 @@ def federated_query_notices(environment_id:, collection_ids:, filter: nil, query
17911709 )
17921710 response
17931711 end
1794-
1795- ##
1796- # @!method query_entities(environment_id:, collection_id:, feature: nil, entity: nil, context: nil, count: nil, evidence_count: nil)
1797- # Knowledge Graph entity query.
1798- # See the [Knowledge Graph
1799- # documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-kg#kg)
1800- # for more details.
1801- # @param environment_id [String] The ID of the environment.
1802- # @param collection_id [String] The ID of the collection.
1803- # @param feature [String] The entity query feature to perform. Supported features are `disambiguate` and
1804- # `similar_entities`.
1805- # @param entity [QueryEntitiesEntity] A text string that appears within the entity text field.
1806- # @param context [QueryEntitiesContext] Entity text to provide context for the queried entity and rank based on that
1807- # association. For example, if you wanted to query the city of London in England
1808- # your query would look for `London` with the context of `England`.
1809- # @param count [Fixnum] The number of results to return. The default is `10`. The maximum is `1000`.
1810- # @param evidence_count [Fixnum] The number of evidence items to return for each result. The default is `0`. The
1811- # maximum number of evidence items per query is 10,000.
1812- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1813- def query_entities ( environment_id :, collection_id :, feature : nil , entity : nil , context : nil , count : nil , evidence_count : nil )
1814- raise ArgumentError . new ( "environment_id must be provided" ) if environment_id . nil?
1815-
1816- raise ArgumentError . new ( "collection_id must be provided" ) if collection_id . nil?
1817-
1818- headers = {
1819- }
1820- sdk_headers = Common . new . get_sdk_headers ( "discovery" , "V1" , "query_entities" )
1821- headers . merge! ( sdk_headers )
1822-
1823- params = {
1824- "version" => @version
1825- }
1826-
1827- data = {
1828- "feature" => feature ,
1829- "entity" => entity ,
1830- "context" => context ,
1831- "count" => count ,
1832- "evidence_count" => evidence_count
1833- }
1834-
1835- method_url = "/v1/environments/%s/collections/%s/query_entities" % [ ERB ::Util . url_encode ( environment_id ) , ERB ::Util . url_encode ( collection_id ) ]
1836-
1837- response = request (
1838- method : "POST" ,
1839- url : method_url ,
1840- headers : headers ,
1841- params : params ,
1842- json : data ,
1843- accept_json : true
1844- )
1845- response
1846- end
1847-
1848- ##
1849- # @!method query_relations(environment_id:, collection_id:, entities: nil, context: nil, sort: nil, filter: nil, count: nil, evidence_count: nil)
1850- # Knowledge Graph relationship query.
1851- # See the [Knowledge Graph
1852- # documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-kg#kg)
1853- # for more details.
1854- # @param environment_id [String] The ID of the environment.
1855- # @param collection_id [String] The ID of the collection.
1856- # @param entities [Array[QueryRelationsEntity]] An array of entities to find relationships for.
1857- # @param context [QueryEntitiesContext] Entity text to provide context for the queried entity and rank based on that
1858- # association. For example, if you wanted to query the city of London in England
1859- # your query would look for `London` with the context of `England`.
1860- # @param sort [String] The sorting method for the relationships, can be `score` or `frequency`.
1861- # `frequency` is the number of unique times each entity is identified. The default
1862- # is `score`. This parameter cannot be used in the same query as the **bias**
1863- # parameter.
1864- # @param filter [QueryRelationsFilter]
1865- # @param count [Fixnum] The number of results to return. The default is `10`. The maximum is `1000`.
1866- # @param evidence_count [Fixnum] The number of evidence items to return for each result. The default is `0`. The
1867- # maximum number of evidence items per query is 10,000.
1868- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1869- def query_relations ( environment_id :, collection_id :, entities : nil , context : nil , sort : nil , filter : nil , count : nil , evidence_count : nil )
1870- raise ArgumentError . new ( "environment_id must be provided" ) if environment_id . nil?
1871-
1872- raise ArgumentError . new ( "collection_id must be provided" ) if collection_id . nil?
1873-
1874- headers = {
1875- }
1876- sdk_headers = Common . new . get_sdk_headers ( "discovery" , "V1" , "query_relations" )
1877- headers . merge! ( sdk_headers )
1878-
1879- params = {
1880- "version" => @version
1881- }
1882-
1883- data = {
1884- "entities" => entities ,
1885- "context" => context ,
1886- "sort" => sort ,
1887- "filter" => filter ,
1888- "count" => count ,
1889- "evidence_count" => evidence_count
1890- }
1891-
1892- method_url = "/v1/environments/%s/collections/%s/query_relations" % [ ERB ::Util . url_encode ( environment_id ) , ERB ::Util . url_encode ( collection_id ) ]
1893-
1894- response = request (
1895- method : "POST" ,
1896- url : method_url ,
1897- headers : headers ,
1898- params : params ,
1899- json : data ,
1900- accept_json : true
1901- )
1902- response
1903- end
19041712 #########################
19051713 # Training data
19061714 #########################
0 commit comments