Add mapping of controlled vocab fields#716
Conversation
There was a problem hiding this comment.
Instead of hard coding these values, we should rely on nypl core values where possible. Something like what happens in this file that generates these values from nypl-core mostly. I don't think we need to be running the aggregations queries since we're not displaying these values to users. But we should be generating values dynamically from nypl-core - especially or at least the collection/holding location mapping.
The language mapping isn't in nypl core, but is served in JSON-LD from loc here. That one maybe makes sense to just hardcode here, but it ought to have some way of dynamically regenerating it. Personally, I wouldn't be opposed to accessing it from the loc.gov endpoint. This iso language code library might also be worth looking into.
Adds logic to map free text queries against controlled vocabulary fields to the corresponding controlled vocab fields.
The basic logic is that a match between a term and a document means that the document contains any of the ids that contain the term, or whose corresponding labels include the term, except in case of == where we require that the id is exactly the query term
For adj/=/== queries, "term" means the whole query. For any/all queries, "term" means any word in the query, and a match means any/all terms are a match according to the above criteria
Overview of code changes:
controlledVocabulariesconfig file (eventually we'll want to look into automatically keeping this up to date with Research Catalog, but it doesn't change much)buildAtomicMainnow switches between regular queries and controlled vocab fields, which have to be mapped first. Alsoscopehas to be passed downAlso, an unrelated change to switch the
shelfMarkfield we are using to thetextversion, to accommodate some requests to be able to match a part of a callnumber query