[Archivesspace_Users_Group] Advanced Search for API

Chris Fitzpatrick Chris.Fitzpatrick at lyrasis.org
Wed Jun 10 06:26:18 EDT 2015


Hi,


Yeah, it's a little odd unless you have a look at the solr schema<https://github.com/archivesspace/archivesspace/blob/master/solr/schema.xml> to see what's going on. Identifier is a "sort_string", which is using the KeywordTokenizerFactory...this means the entire field is turned into a single token, regardless of it's content. Good for sorting, but not good for searching text with spaces...


That's why there's the four_part_id field, which is defined as a "text_general" field and uses the StandardTokenizerFactory and other filters that's optimized for search.


best,chris.


Chris Fitzpatrick | Developer, ArchivesSpace
Skype: chrisfitzpat  | Phone: 918.236.6048
http://archivesspace.org/
________________________________
From: archivesspace_users_group-bounces at lyralists.lyrasis.org <archivesspace_users_group-bounces at lyralists.lyrasis.org> on behalf of Smith, Steelsen <steelsen.smith at yale.edu>
Sent: Tuesday, June 9, 2015 9:59 PM
To: Archivesspace Users Group
Subject: Re: [Archivesspace_Users_Group] Advanced Search for API


Thanks, Chris. I was looking for “Identifier” (e.g., MS 1234) but found that field to be too picky, rejecting a search for having a space instead of a hyphen. Ultimately using four part ID seems to do the trick, although I’m not totally sure what it means. (e.g., repositories/12/search?q=four_part_id:("MS 1234")&type[]=resource&page=1).



Thanks again,

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: Tuesday, June 2, 2015 9:10 AM
To: Archivesspace Users Group
Subject: Re: [Archivesspace_Users_Group] Advanced Search for API



Hi Steelsen,



The fields listed in the search_definitions.rb file is the listing of fields for advanced search, but you can also search Solr directly against all the fields in there as well ( defined here : https://github.com/archivesspace/archivesspace/blob/master/solr/schema.xml#L21-L199<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_archivesspace_archivesspace_blob_master_solr_schema.xml-23L21-2DL199&d=AwMF-g&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=FlU_ig33o98uJUfe7Tv5TWs-EbGWSS7i3RH_JUJdg9A&m=2SU9mVgTq5WZscD6bjMXsNTUKH1EXm7mQPXWphY3eHA&s=-E3A7WvrmIThKLfzLbqnBjgu50f_rnPOMLaOhNPZiis&e=> )



What do you mean by call number? The identifier of a resource? Or the component unique identifier?



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: Monday, June 1, 2015 2:29 PM
To: Archivesspace Users Group
Subject: Re: [Archivesspace_Users_Group] Advanced Search for API



Hi All,



Just wanted to try again – does anyone know where I can find the fields allowed in the API advanced search? The list I could find in the search_definitions.rb file seemed too limited to be correct. Alternatively, does anyone know the most effective way to do a back-end call number search (exact call number but including tolerance for differences in group spacing or hyphens?).



Thanks,

Steelsen



From: archivesspace_users_group-bounces at lyralists.lyrasis.org<mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org> [mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org] On Behalf Of Smith, Steelsen
Sent: Friday, May 22, 2015 12:36 AM
To: Archivesspace Users Group
Subject: Re: [Archivesspace_Users_Group] Advanced Search for API



So following up, I’m trying to run a call number search and can’t find the fields that are allowed in the advanced search. It looks like https://github.com/archivesspace/archivesspace/blob/8b20b07346f42aa7babc97318219d70f32c52340/common/search_definitions.rb<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_archivesspace_archivesspace_blob_8b20b07346f42aa7babc97318219d70f32c52340_common_search-5Fdefinitions.rb&d=AwMFAg&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=FlU_ig33o98uJUfe7Tv5TWs-EbGWSS7i3RH_JUJdg9A&m=KRRwcFICA1Hn9zYvlLjrt2199sHZykbyhr98k9wWeOM&s=HD9IKXvfVNYvavzPMg5USBbIVohCuA8KvJcWgRnRVOc&e=> has a list that doesn’t include call number so I’m a bit lost there. I tried both “identifier” and “four_part_id” and got a 500 for invalid fields. Is there a field that I’m missing or is there a better way to do a call number search (Ideally so that AB 9 / AB-9 / AB—9 all work since it seems that ASpace will present them in slightly different formats.



Thanks,

Steelsen



From: archivesspace_users_group-bounces at lyralists.lyrasis.org<mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org> [mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org] On Behalf Of Smith, Steelsen
Sent: Monday, May 18, 2015 3:06 PM
To: Archivesspace Users Group
Subject: Re: [Archivesspace_Users_Group] Advanced Search for API



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> [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={\<https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A4567_repositories_2_search-3Fpage-3D1-26aq-3D-257b-255C&d=AwMFAg&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=FlU_ig33o98uJUfe7Tv5TWs-EbGWSS7i3RH_JUJdg9A&m=USAGuSwTvKRxDB1BPpWu4zSzsNvwit7T79mfljlWTcE&s=Ie4W3OOGZPHMcNjBBRKg_2oUsDj5gl4kmk5gfnjwXBo&e=>"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={\<https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A4567_repositories_2_search-3Fpage-3D1-26aq-3D-257b-255C&d=AwMFAg&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=FlU_ig33o98uJUfe7Tv5TWs-EbGWSS7i3RH_JUJdg9A&m=USAGuSwTvKRxDB1BPpWu4zSzsNvwit7T79mfljlWTcE&s=Ie4W3OOGZPHMcNjBBRKg_2oUsDj5gl4kmk5gfnjwXBo&e=>"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={\<https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A4567_repositories_2_search-3Fpage-3D1-26aq-3D-257b-255C&d=AwMFAg&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=FlU_ig33o98uJUfe7Tv5TWs-EbGWSS7i3RH_JUJdg9A&m=USAGuSwTvKRxDB1BPpWu4zSzsNvwit7T79mfljlWTcE&s=Ie4W3OOGZPHMcNjBBRKg_2oUsDj5gl4kmk5gfnjwXBo&e=>"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={\<https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A4567_repositories_2_search-3Fpage-3D1-26aq-3D-257b-255C&d=AwMFAg&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=FlU_ig33o98uJUfe7Tv5TWs-EbGWSS7i3RH_JUJdg9A&m=USAGuSwTvKRxDB1BPpWu4zSzsNvwit7T79mfljlWTcE&s=Ie4W3OOGZPHMcNjBBRKg_2oUsDj5gl4kmk5gfnjwXBo&e=>"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/<https://urldefense.proofpoint.com/v2/url?u=http-3A__archivesspace.org_&d=AwMFAg&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=FlU_ig33o98uJUfe7Tv5TWs-EbGWSS7i3RH_JUJdg9A&m=USAGuSwTvKRxDB1BPpWu4zSzsNvwit7T79mfljlWTcE&s=dChGuFOYw7LiREnrfz3bksRK06RdKsGZS97-P-UzCtQ&e=>

________________________________

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/20150610/893612cf/attachment.html>


More information about the Archivesspace_Users_Group mailing list