In authorities popup search (auth_finder.pl), some search inputs have auto-completion : - Anywhere - Main entry - Main entry ($a only), alias mainmainentry For anywhere and main entry, auto-completion works well : select a term and launch search, you will find authorities. For mainmainentry, select a term and launch search, you will sometimes not find authorities. It is because auto-compete returns authorities headings, composed of $a and other subfields of heading field whereas search on mainmainentry will only look in $a. I propose that auto-completion of mainmainentry field return a list of the mainmainentry of found authorities.
Created attachment 14073 [details] [review] Proposed patch C4::AuthoritiesMarc : add 'hemain' key in authorities search results containing mainmainentry ($a most of the time). This can also be usefull for other features. authorities/ysearch.pl : - use of JSON module to encode output (this is usefull if data contains syntax characters like a double quote) - returned list as no duplicates (case is ignored) - add 'catalogue' permission test (like auth_finder.pl) => no access for a OPAC user - if authentication fails, an empty page is returned, lighter than a 500 error page (like many other ajax scripts) - UTF8 encoding is directly done by to_json (like in getitem-ajax.pl). I think it is the best performance way.
Created attachment 14075 [details] [review] Proposed patch (follow-up 1) follow-up : Authority type is missing from auto-complete ajax call. So actually, auto-complete search in all authority types.
I tested on my VM : I created 2 authorities author : - Melot, Michel (professeur, 1956-....) - Melot, Pierre Without the patch : 1. I enter "Mel" in "Main entry ($a only)" field 2. The autocompletion gives me the 2 complete names : "Melot, Michel (professeur, 1956-....)" and "Melot, Pierre". 3. I click on one of the 2 names 4. The field filled in with the complete name (ex :"Melot Pierre"). 5. I click on "Start Search" 6. "No result found" With the patch : 1. I enter "Mel" in "Main entry ($a only)" field 2. The autocompletion gives me just 1 lastname "Melot" 3. I click on "Melot" 4. The field filled in with the lastname 5. I click on "Start Search" 6. 2 results : "Melot, Michel (professeur, 1956-....)" and "Melot, Pierre". I sign off M. Saby Rennes 2 university
Created attachment 14734 [details] [review] [PATCH] [SIGNED OFF] Bug 9282: authorities auto-completion in mainmainentry
Created attachment 14735 [details] [review] [PATCH 2/2] [SIGNED OFF] Bug 9282: Followup : authtypecode missing in auto-completion
Katrin, Jonathan or I should not QA this one, because it's worth having a MARC21 point of view (event if I don't really fear something wrong) So, giving you this one.
Someone to QA ?
(In reply to comment #7) > Someone to QA ? I will if someone does not beat me to it. Note that adding a comment drops you from top of the list to the very end (when sorting by Change date). Will try to remember.
QA: Looking now..
Looks quite good to me, but I am wondering about this now: } elsif ($tag eq '180') { $subfields_to_report = 'vxyz'; [etc. etc. etc.] if ($subfields_to_report) { push @authorized, { heading => $field->as_string($subfields_to_report), hemain => $field->subfield( substr($subfields_to_report, 0, 1) ), If you use the first char here, you will take $v into hemain. But I think that you should take $x for the 18X fields. I would like to see a response from Jared here, as I assume that he was responsible for quite some changes in this module. Could you please attract his attention? Thanks. Changing status to reflect need for clarification.
(In reply to M. de Rooy from comment #10) > Looks quite good to me, but I am wondering about this now: > > } elsif ($tag eq '180') { > $subfields_to_report = 'vxyz'; > [etc. etc. etc.] > if ($subfields_to_report) { > push @authorized, { > heading => $field->as_string($subfields_to_report), > hemain => $field->subfield( > substr($subfields_to_report, 0, 1) ), > > If you use the first char here, you will take $v into hemain. But I think > that you should take $x for the 18X fields. > I would like to see a response from Jared here, as I assume that he was > responsible for quite some changes in this module. Could you please attract > his attention? Thanks. As hemain is used for mainmainentry, the search does not make sense for 18x authorities anyway, as there is no Main Entry for 18x authorities. However, since 18x authorities are not supported in any useful way by Koha, and probably never will be, I see no problem with pushing the code as-is.
Created attachment 19551 [details] [review] Bug 9282: authorities auto-completion in mainmainentry Signed-off-by: Mathieu Saby <mathieu.saby@univ-rennes2.fr> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Works as advertised. Tested with an authority where I added my search term in $b. The modified authority came up in main entry, not in mainmainentry. That was the desired result.
Created attachment 19552 [details] [review] Bug 9282: Followup : authtypecode missing in auto-completion Signed-off by: Mathieu Saby <mathieu.saby@univ-rennes2.fr> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
QA Comment: See also former comment and response from Jared. Further looks good to me. Note that hemain is not the most attractive/descriptive variable name, but it works :) Passed QA
Pushed to master. Thanks, Fridolyn!