examples/search.rb in collectionspace-client-0.3.0 vs examples/search.rb in collectionspace-client-0.14.1
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
require 'awesome_print'
require 'collectionspace/client'
config = CollectionSpace::Configuration.new(
@@ -10,12 +12,23 @@
client = CollectionSpace::Client.new(config)
search_args = {
path: 'groups',
- type: 'groups_common',
+ namespace: 'groups_common',
field: 'title',
- expression: "ILIKE '%DTS 001%'"
+ expression: "ILIKE '%D%'"
}
-response = client.search(CollectionSpace::Search.new.from_hash(search_args))
-ap response.parsed['abstract_common_list'] if response.result.success?
+puts 'Search: %D'
+response = client.search(
+ CollectionSpace::Search.new.from_hash(search_args),
+ { sortBy: CollectionSpace::Search::DEFAULT_SORT }
+)
+if response.result.success?
+ response.parsed['abstract_common_list']['list_item'].map do |i|
+ puts i['uri']
+ end
+end
+
+puts 'Object and authority term searches have been moved to spec.'
+puts 'See helpers_spec.rb examples describing find'