Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support label_fieldName auto-complete templates, e.g. *_dateOfBirth (RPB-169) #397

Merged
merged 5 commits into from
Jun 11, 2024

Conversation

For autocomplete format: https://lobid.org/gnd/api#auto-complete,
e.g. `format=json:preferredName,*_dateOfBirth+in_placeOfBirth`
@fsteeg fsteeg requested a review from acka47 June 4, 2024 10:01
@acka47
Copy link
Contributor

acka47 commented Jun 4, 2024

Looks already quite good. I noticed the following: While several occupation are already automatically concatenated by commas, this is not the case for placeOfActivity. See e.g. this query which contains this:

{
        "image": "https://commons.wikimedia.org/wiki/Special:FilePath/Friedrich%20Schiller%20by%20Ludovike%20Simanowiz.jpg?width=100",
        "label": "Schiller, Friedrich | Schriftsteller, Dramatiker, Erzähler, Historiker, Hochschullehrer, Librettist, Arzt, Hochschullehrer | * 1759 in Marbach am Neckar | † 1805 in Weimar | wirkte in MannheimWeimarJena",
        "id": "https://d-nb.info/gnd/118607626",
        "category": "Individualisierte Person"
  }

@acka47
Copy link
Contributor

acka47 commented Jun 4, 2024

I also noticed that the results of these queries are not pretty-printed when queried with curl, e.g.:

$ curl"https://test.lobid.org/gnd/search?q=Twain&format=json%3ApreferredName%2C*_dateOfBirth+in_placeOfBirth%2C%E2%80%A0_dateOfDeath+in_placeOfDeath"
[{"label":"Twain (Musikgruppe)","id":"https://d-nb.info/gnd/1229526226","category":"Musikalische Körperschaft"},{"image":"https://commons.wikimedia.org/wiki/Special:FilePath/Shania%20Twain%20March%202020.png?width=100","label":"Twain, Shania | * 1965 in Windsor (Ontario)","id":"https://d-nb.info/gnd/121570924","category":"Individualisierte Person"},{"label":"These Twain","id":"https://d-nb.info/gnd/1215051689","category":"Werk"},{"image":"https://commons.wikimedia.org/wiki/Special:FilePath/MarkTwain.LOC.jpg?width=100","label":"Twain, Mark | * 1835 in Florida, Mo. | † 1910 in Redding, Conn.","id":"https://d-nb.info/gnd/118624822","category":"Individualisierte Person"},{"label":"Bezirkszentralbibliothek Mark Twain. Schreibwerkstatt","id":"https://d-nb.info/gnd/1045623490","category":"Körperschaft"},{"label":"Mark-Twain-Schule","id":"https://d-nb.info/gnd/1150522305","category":"Körperschaft"},{"label":"Bezirkszentralbibliothek Mark Twain","id":"https://d-nb.info/gnd/1045623113","category":"Körperschaft"},{"label":"Twain, K. V. | * 1981 in Galatz","id":"https://d-nb.info/gnd/1179733045","category":"Individualisierte Person"},{"label":"International Mark Twain Society","id":"https://d-nb.info/gnd/75281-2","category":"Körperschaft"},{"label":"Autobiography of Mark Twain","id":"https://d-nb.info/gnd/1081942517","category":"Werk"}]

As we pretty-print – so far as I knwo – all other responses, this should also be pretty-printed for sake of consistency.

@acka47
Copy link
Contributor

acka47 commented Jun 4, 2024

While several occupation are already automatically concatenated by commas, this is not the case for placeOfActivity.

Looking at the implementation in https://github.com/hbz/strapi-rpb/pull/31/files#diff-464e263cd47a4e96e7232665ebc65ba8aeb2f4377fadcef146a855feca83028cR5-R6 it seems to work. So I hav edone something wrong or do not understand fully how this works:

https://test.lobid.org/gnd/search?q=Friedrich+Schiller+arzt&format=json%3ApreferredName,*_dateOfBirth+_placeOfBirth,%E2%80%A0_dateOfDeath+_placeOfDeath,placeOfActivity,professionOrOccupation

@fsteeg
Copy link
Member Author

fsteeg commented Jun 5, 2024

While several occupation are already automatically concatenated by commas, this is not the case for placeOfActivity [...] it seems to work. So I have done something wrong or do not understand fully how this works

No, good catch, it only worked for the old, plain-field syntax, not for the new templates. Fixed on test, see your query and an example in RPPD (I changed the delimiter from , to ; since , is often used in field values).

As we pretty-print – so far as I know – all other responses, this should also be pretty-printed for sake of consistency.

Fixed on test, see "View Page Source" on the examples above or
curl "https://test.lobid.org/gnd/search?q=Twain&format=json:suggest"

Copy link
Contributor

@acka47 acka47 left a comment

Choose a reason for hiding this comment

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

+1

@fsteeg fsteeg merged commit f1fd3ca into master Jun 11, 2024
1 check passed
@fsteeg fsteeg deleted the rpb-169-customizeSuggestions branch June 11, 2024 11:39
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.

None yet

2 participants