Bug 35903: In cataloguing authority plugin using autocomplete must set operator exact

When cataloguing and using authority plugin, there is auto-completion on inputs and default operator is "contains".
When using auto-completion and selecting a result it would be logical to set operator "exact".

See doc https://api.jqueryui.com/autocomplete/#event-select

This patch also adds auto-completion missing on "Search all headings".

Test plan:
1) Create a new authority Topical Term with heading "Cart"
2) Create a new authority Topical Term with heading "Carthage"
3) Create a new biblio record
4) Use authority plugin on field 650
5) You see current operator are "contains"
6) Enter "Car" in "Search main heading ($a only):"
7) You see auto-completion showing "Cart" and "Carthage"
8) Click on "Cart"
9) You see operator changes to "is exactly"
10) Submit form to see the results
11) Clear form and repeat 6-9 for the three other inputs

Signed-off-by: Michelle Spinney <mspinney@clamsnet.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Fridolin Somers 2024-01-25 09:50:28 +01:00 committed by Katrin Fischer
parent a750c254da
commit 36d96180ae
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
2 changed files with 43 additions and 2 deletions

View File

@ -89,7 +89,8 @@
<option value="exact">is exactly</option>
[% END %]
</select>
<input type="text" name="value_match" value="[% value_match | html %]" />
<input id="value_match" style="width:400px;" type="text" name="value_match" value="[% value_match | html %]" />
<div id="yvaluecontainermarclistheading"></div>
</li>
<li>
<label for="marclistanywhere">Search entire record: </label>

View File

@ -9,7 +9,7 @@ $(document).ready(function(){
e.preventDefault();
finderjump('authorities.pl?index=' + index + '&authtypecode=' + authtypecode, 'full' );
});
// marclist
// marclistanywhere
$( "#value_any" ).autocomplete({
source: function(request, response) {
$.ajax({
@ -35,6 +35,40 @@ $(document).ready(function(){
}
});
},
select: function( event, ui ) {
$("#marclistanywhere").val("exact");
},
minLength: 3,
});
// marclistheading
$( "#value_match" ).autocomplete({
source: function(request, response) {
$.ajax({
url: "/cgi-bin/koha/authorities/ysearch.pl",
dataType: "json",
data: {
authtypecode : authtypecode,
term: request.term,
op: "do_search",
type: "intranet",
and_or: "and",
operator: "start",
orderby: "HeadingAsc",
querytype: "match"
},
success: function(data) {
response( $.map( data, function( item ) {
return {
label: item.summary,
value: item.summary
};
}));
}
});
},
select: function( event, ui ) {
$("#marclistheading").val("exact");
},
minLength: 3,
});
// mainentry
@ -63,6 +97,9 @@ $(document).ready(function(){
}
});
},
select: function( event, ui ) {
$("#mainentry").val("exact");
},
minLength: 3,
});
// mainmainentry
@ -91,6 +128,9 @@ $(document).ready(function(){
}
});
},
select: function( event, ui ) {
$("#mainmainentry").val("exact");
},
minLength: 3,
});
$("#clear-form").click(function(){