[Archivesspace_Users_Group] Search API- detailed documentation?

Andrew Morrison andrew.morrison at bodleian.ox.ac.uk
Thu Jun 17 05:56:02 EDT 2021


I think the idea is that there is a lot of documentation and many 
examples of Solr queries available online, and that's what most people 
use to when searching via the API. You can build AdvancedSearch objects, 
which the backend will convert to Solr queries, but it is more difficult 
and less powerful.


I'm not entirely clear what you are trying to achieve with your 
chained-terms query, but one thing I can suggest is that the square 
brackets aren't needed between agents and :Collinson. That is inside the 
q parameter, hence part of the the Solr query you are telling 
ArchivesSpace to pass on to Solr, and multi-valued fields aren't 
searched any differently than single-value ones in Solr queries.


Dates applicable to the item (rather than the record) are indexed in a 
"dates" multi-valued field in Solr, but without anything to indicate 
which dates have the label "Creation". If, by policy, you only ever 
catalogue creation dates, you could do a Solr range search on that, but 
that would be quite restrictive on cataloguers. Searching the "json" 
field isn't an option (it isn't indexed for starters) but your client 
script could parse it and discard records that don't match your date 
criteria (it depends what you are doing whether that it practical.) 
Probably what I'd do is customize the indexer so that it populates a 
new, dedicated Solr index field just with creation dates. That way, 
after a re-index, you'd be able to do Solr range queries on that. That 
isn't too difficult to set up, in a plug-in, but it has an ongoing 
maintenance cost of having to test it still works every time you upgrade 
ArchivesSpace.


Also, when experimenting with queries in the Solr admin interface, 
remember to select "edismax" because that is the query parser which 
ArchivesSpace uses by default. It doesn't just give more options, but 
also changes the way "q" and "fq" are interpreted (although not 
radically, in most cases.)


Andrew.



On 16/06/2021 16:15, RENTON Scott wrote:
> Hi again folks
>
>
> I'm wondering if anyone has any detailed documentation for the search 
> API, with some examples. The git resource is really good, but it 
> doesn't go that deeply into search, and I'm trying to write something 
> for internal users interfacing with the API.
>
> Issues I'm trying to resolve most directly- chaining terms with 
> agents, and working with dates (I can do some of this with the SOLR 
> admin panel, but there are some differences between the syntax, and 
> I'm falling down there).
>
> Chaining terms:
> Running something like this:
> search?type[]=archival_object&page= 1&q=language_enum_s:gla AND 
> title:Loch AND certainty_enum_s:approximate AND agents[]:Collinson
>
> It all looks good till I get to the agents- where I get some records 
> back which don't have that agent. Is there an easy fix there?
>
> Dates:
> I'd like to be able to search where a Date of Creation is greater than 
> X but less than Y. However, as that field is in the json object 
> returned by Search, I don't think I can logically perform that search 
> (as I'd basically be wildcard matching a string)- unless there's a way 
> to drill into the json?
>
> Any advice gratefully received!
>
> Thanks
> Scott
>
> ==========
>
> Scott Renton
>
> Digital Library Development & Systems
>
> Floor F East
>
> Argyle House
>
> 515219
>
> The University of Edinburgh is a charitable body, registered in 
> Scotland, with registration number SC005336. Is e buidheann 
> carthannais a th’ ann an Oilthigh Dhùn Èideann, clàraichte an Alba, 
> àireamh clàraidh SC005336.
>
> _______________________________________________
> Archivesspace_Users_Group mailing list
> Archivesspace_Users_Group at lyralists.lyrasis.org
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20210617/4a1c54be/attachment.html>


More information about the Archivesspace_Users_Group mailing list