Open smjwsk opened 4 years ago
@natlibfi-arlehiko @ammsalme as you are most recently and most active in this repo. Is there any interest?
@natlibfi-koskimim thanks for putting this on the todo list. As stated above. Reach out if contributions are welcome
Hi!
Yes, we are trying to find some time & resource to maintain marc-record-js 🙂 Sadly, it is just preliminary effort of few coders at the moment, but hopefully our entire organization some day understands the great value of maintenance and providing features needed by users 🙂
All the best,
Markus
Lähettäjä: Stefan Majewski @.> Lähetetty: perjantai 27. toukokuuta 2022 15.10 Vastaanottaja: NatLibFi/marc-record-js @.> Kopio: Koskimies, Markus J @.>; Mention @.> Aihe: Re: [NatLibFi/marc-record-js] Filtering fields by specified tag and indicators (#17)
@natlibfi-koskimimhttps://github.com/natlibfi-koskimim thanks for putting this on the todo list. As stated above. Reach out if contributions are welcome
— Reply to this email directly, view it on GitHubhttps://github.com/NatLibFi/marc-record-js/issues/17#issuecomment-1139559114, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AT6DJDKOEJTPO2YMJOC4HBDVMC3TVANCNFSM4SEXEXJQ. You are receiving this because you were mentioned.Message ID: @.***>
I noticed that it is currently only possible to select fields by a given tag and filter these selected fields on the basis of its subfields.
When working with marc-records we found it a frequent requirement to narrow down on basis of indicators. Here, we would have expected one of the given parameters to
getFields
orcontainsFieldWithValue
to provide this functionality.On closer inspections the parameters of
getFields
in the current implementation are divided in field selection and querying subfields:tag
: string indicating which fields are considered i.e. field selectionquery
: object describing the content of subfields. i.e. subfield queryinggiven above analysis, I would expect the first parameter to provide functionality to narrow down the fields on basis of the fields properties to consider for optional subfield querying.
I propose to extend the
tag
parameter by allowing to pass an object as first parameter for field selection. This may well be achieved by retaining the current api. The idea is to pass an object with properties that are all tested against each individual field. In case a string is passed, the previous behaviour is retained. In case the argument is neither of typestring
orobject
(not null) an empty array is returned.Example:
should yield this field if part of the record:
but still
would work.
Are you open for pull/merge requests? I'd be happy to contribute what I have so far.