[Archivesspace_Users_Group] Searches including colons

Andrew Morrison andrew.morrison at bodleian.ox.ac.uk
Thu Mar 4 06:21:57 EST 2021


I think your problem is here:


https://github.com/archivesspace/archivesspace/blob/4554d0b8bb47558f18bbcae2f63bea84effc9b28/backend/app/model/advanced_query_string.rb#L84-L95


The backend, when converting the "advanced_query" data structures the 
PUI and SUI send it into Solr queries, is stripping out colons. That 
might work if the index field were "text_general" but for a "string" 
type Solr does no tokenization, so matches have to be exact.


If you look further up in the same file, it will escape colons, which is 
what you want, if this condition is met:


https://github.com/archivesspace/archivesspace/blob/4554d0b8bb47558f18bbcae2f63bea84effc9b28/backend/app/model/advanced_query_string.rb#L54


But I don't know how you'd go about triggering that.


Andrew.



On 03/03/2021 09:18, Nick Butler wrote:
> Hi Andrew,
>
> We've added it to the PUI and SUI advanced search, in what I believe 
> to be the standard manner (for the SUI, adding a line to 
> search_definitions.rb, and for the PUI adding it to the :field_options 
> arrays in the locals for the shared/search partial, in both the PUI 
> search/search_results and welcome/show views). It's a *_u_sstr field, 
> if that makes a difference, and we're storing multiple values in it. 
> Exact (or wildcard) searches for any of the values being stored in the 
> field are returning correct matches, except (as far as we can tell) 
> when the searches contain colons, when they uniformly return no results.
>
> Many thanks,
> Nick
>
> ------------------------------------------------------------------------
> *From:* archivesspace_users_group-bounces at lyralists.lyrasis.org 
> <archivesspace_users_group-bounces at lyralists.lyrasis.org> on behalf of 
> Andrew Morrison <andrew.morrison at bodleian.ox.ac.uk>
> *Sent:* 02 March 2021 16:44
> *To:* archivesspace_users_group at lyralists.lyrasis.org 
> <archivesspace_users_group at lyralists.lyrasis.org>
> *Subject:* Re: [Archivesspace_Users_Group] Searches including colons
>
> How are you searching this field? If you've added it to the options in 
> the PUI or SUI advanced search, it should be escaping the colon for 
> you. If searching via the API, you probably need to do it yourself 
> <https://lucene.apache.org/core/8_0_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#Escaping_Special_Characters>.
>
>
> Andrew.
>
>
>
> On 02/03/2021 15:01, Nick Butler wrote:
>> Hi all,
>>
>> We're currently experimenting with creating a new index field (a 
>> StrField) for alternative forms of our resource and archival object 
>> identifiers. This field is largely working fine and behaving as 
>> expected, but over the course of testing this work out we've noticed 
>> that searches including colons don't appear to return any results, 
>> even when the exact content of the index field is used (with or 
>> without quotation marks around the whole search). Have other people 
>> experienced something similar? Is there a known workaround?
>>
>> Many thanks,
>> Nick
>>
>> _______________________________________________
>> Archivesspace_Users_Group mailing list
>> Archivesspace_Users_Group at lyralists.lyrasis.org  <mailto:Archivesspace_Users_Group at lyralists.lyrasis.org>
>> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group  <http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group>
>
> _______________________________________________
> 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/20210304/25d00db8/attachment.html>


More information about the Archivesspace_Users_Group mailing list