[Archivesspace_Users_Group] Advanced Search for API

Smith, Steelsen steelsen.smith at yale.edu
Mon May 18 15:05:32 EDT 2015


Awesome, thanks. I Don't think I would have figured this out on my own.

Best,
Steelsen

From: archivesspace_users_group-bounces at lyralists.lyrasis.org [mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org] On Behalf Of Chris Fitzpatrick
Sent: Monday, May 18, 2015 6:45 AM
To: Archivesspace Users Group
Subject: Re: [Archivesspace_Users_Group] Advanced Search for API


Hi Steelsen,



Yes, so for advanced queries, you pass in a jsonmodel advanced_query object ( https://github.com/archivesspace/archivesspace/blob/master/common/schemas/advanced_query.rb<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_archivesspace_archivesspace_blob_master_common_schemas_advanced-5Fquery.rb&d=AwMFAw&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=FlU_ig33o98uJUfe7Tv5TWs-EbGWSS7i3RH_JUJdg9A&m=Q512t8zeEpl-NggOW2V0X71mLIZtLKTKNL71eyIemzE&s=XKq3Z2Zcp5vN9160nKsQ5Fp36dAR-fNwL-niWBmhq-g&e=> )



 This  object has a property "query" that can be a boolean_query ( https://github.com/archivesspace/archivesspace/blob/master/common/schemas/boolean_query.rb)<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_archivesspace_archivesspace_blob_master_common_schemas_boolean-5Fquery.rb&d=AwMFAw&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=FlU_ig33o98uJUfe7Tv5TWs-EbGWSS7i3RH_JUJdg9A&m=Q512t8zeEpl-NggOW2V0X71mLIZtLKTKNL71eyIemzE&s=_6bZyOnpl71NPKRJjjla7NaDoWJlyhuiO4IlYlh4CGA&e=> boolean_field_query ( https://github.com/archivesspace/archivesspace/blob/master/common/schemas/boolean_field_query.rb<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_archivesspace_archivesspace_blob_master_common_schemas_boolean-5Ffield-5Fquery.rb&d=AwMFAw&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=FlU_ig33o98uJUfe7Tv5TWs-EbGWSS7i3RH_JUJdg9A&m=Q512t8zeEpl-NggOW2V0X71mLIZtLKTKNL71eyIemzE&s=4KJTLPivqB8fCgXYZKlV7hqV_Lyo2nM00Epsp3VAvjY&e=> ) date_field_query ( https://github.com/archivesspace/archivesspace/blob/master/common/schemas/date_field_query.rb<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_archivesspace_archivesspace_blob_master_common_schemas_date-5Ffield-5Fquery.rb&d=AwMFAw&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=FlU_ig33o98uJUfe7Tv5TWs-EbGWSS7i3RH_JUJdg9A&m=Q512t8zeEpl-NggOW2V0X71mLIZtLKTKNL71eyIemzE&s=u_8ujNq8W5fiGCkEaDkrxfIpBAKuy_Oqe7nhFFUUguE&e=> ) or a field_query ( https://github.com/archivesspace/archivesspace/blob/master/common/schemas/field_query.rb<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_archivesspace_archivesspace_blob_master_common_schemas_field-5Fquery.rb&d=AwMFAw&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=FlU_ig33o98uJUfe7Tv5TWs-EbGWSS7i3RH_JUJdg9A&m=Q512t8zeEpl-NggOW2V0X71mLIZtLKTKNL71eyIemzE&s=_juF6V_y9YnXDL2nWOt3-cb0CDSFnbSYnXUvs9sV0-U&e=> )





So, a queries could look like this:



boolean query ( keyword 'My Awesome Search Term' and 'AND'  published = true ) :

 "http://localhost:4567/repositories/2/search?page=1&aq={\<http://localhost:4567/repositories/2/search?page=1&aq=%7b\>"query\":{\"op\":\"AND\",\"subqueries\":[{\"field\":\"keyword\",\"value\":\"My Awesome Search Term\",\"jsonmodel_type\":\"field_query\",\"negated\":false,\"literal\":false},{\"field\":\"published\",\"value\":true,\"jsonmodel_type\":\"boolean_field_query\"}],\"jsonmodel_type\":\"boolean_query\"},\"jsonmodel_type\":\"advanced_query\"}"



boolean_field_query ( published = true ):

"http://localhost:4567/repositories/2/search?page=1&aq={\<http://localhost:4567/repositories/2/search?page=1&aq=%7b\>"query\":{\"field\":\"published\",\"value\":true,\"jsonmodel_type\":\"boolean_field_query\"},\"jsonmodel_type\":\"advanced_query\"}"



field query ( keyword for 'My Awesome Search Term') :

"http://localhost:4567/repositories/2/search?page=1&aq={\<http://localhost:4567/repositories/2/search?page=1&aq=%7b\>"query\":{\"field\":\"keyword\",\"value\":\"My Awesome Search Term\",\"jsonmodel_type\":\"field_query\",\"negated\":false,\"literal\":false}}



date_field_query  (  Created date after May 5 2015 ) :

 "http://localhost:4567/repositories/2/search?page=1&aq={\<http://localhost:4567/repositories/2/search?page=1&aq=%7b\>"query\":{\"field\":\"create_time\",\"value\":\"2015-05-05\",\"comparator\":\"greater_than\",\"jsonmodel_type\":\"date_field_query\"},\"jsonmodel_type\":\"advanced_query\"}"



 Does that help?



b,chris.










Chris Fitzpatrick | Developer, ArchivesSpace
Skype: chrisfitzpat  | Phone: 918.236.6048
http://archivesspace.org/
________________________________
From: archivesspace_users_group-bounces at lyralists.lyrasis.org<mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org> <archivesspace_users_group-bounces at lyralists.lyrasis.org<mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org>> on behalf of Smith, Steelsen <steelsen.smith at yale.edu<mailto:steelsen.smith at yale.edu>>
Sent: Sunday, May 17, 2015 2:41 AM
To: Archivesspace Users Group
Subject: [Archivesspace_Users_Group] Advanced Search for API

Hi All,

The Rest API Endpoint repositories/:id/search indicates that there's an advanced search input that requires a json formatted "advanced search" in the URI. Does anyone have an example of what it might look like, or a field list of what can be searched for? I'm trying to perform some very specific searches and am finding myself pulling in a lot of extra information and working through it. A more general question, is there better API documentation somewhere than exists in the autodocs? Sample strings would save a lot of time from the trial and error process I'm using now.

Thanks,
Steelsen



___________________________
Steelsen Smith
Fulfillment Systems Specialist
Enterprise Systems Group
Yale Library IT
203.432.3333

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20150518/958bcbc1/attachment.html>


More information about the Archivesspace_Users_Group mailing list