Skip to content

Add mapping of controlled vocab fields#716

Open
danamansana wants to merge 1 commit intoscc-5296/8from
scc-5320
Open

Add mapping of controlled vocab fields#716
danamansana wants to merge 1 commit intoscc-5296/8from
scc-5320

Conversation

@danamansana
Copy link
Copy Markdown
Contributor

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:

  • Adds controlledVocabularies config file (eventually we'll want to look into automatically keeping this up to date with Research Catalog, but it doesn't change much)
  • buildAtomicMain now switches between regular queries and controlled vocab fields, which have to be mapped first. Also scope has to be passed down
  • adds the mapping function
  • Adds tests and fixtures.

Also, an unrelated change to switch the shelfMark field we are using to the text version, to accommodate some requests to be able to match a part of a callnumber query

Copy link
Copy Markdown
Contributor

@charmingduchess charmingduchess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants