Bug 33610

Summary: Accelerated Reading Level Search not accurate
Product: Koha Reporter: Daphne Hoolahan <dch>
Component: SearchingAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: nick
Version: 22.11   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Daphne Hoolahan 2023-04-25 16:06:36 UTC
If you search for Accelerated Reader level 6 the system shows all the books at that level, but it also picks up titles that are a reading level of .6 
e.g. Angels and Demons by Dan Brown is 5.6 but it is listed when I search for AR level 6.
We need a search that will only return books at level 6 (including all decimal points up to 7)
Comment 1 Katrin Fischer 2023-05-03 22:28:56 UTC
Hi Daphne, are you using Zebra or Elasticsearch?

How do you search for the reading level? Are you using "expert search" or some other way?

Both search engines might treat . as a space, making 5.6 into too separate words. 

For Zebra using exact field search with ,ext might work, but I haven't figured out yet how to do an exact field search with Elasticsearch. You could try enclosing in "", but I feel it's probably not enough here.
Comment 2 Nick Clemens (kidclamp) 2023-05-04 12:36:32 UTC
We use the elasticsearch query string query, you want to do a range search:
https://www.elastic.co/guide/en/elasticsearch/reference/7.17/query-dsl-query-string-query.html#_ranges

Try:
arl:[6 TO 7}

That should get you 6 and above up to, but excluding 7
Comment 3 Katrin Fischer 2023-05-04 20:50:01 UTC
[ and } correct?
Comment 4 Nick Clemens (kidclamp) 2023-05-04 21:31:35 UTC
[] are inclusive
{} Are exclusive

They can be mixed
Comment 5 Daphne Hoolahan 2023-07-10 17:14:29 UTC
(In reply to Katrin Fischer from comment #1)
> Hi Daphne, are you using Zebra or Elasticsearch?
> 
> How do you search for the reading level? Are you using "expert search" or
> some other way?
> 
> Both search engines might treat . as a space, making 5.6 into too separate
> words. 
> 
> For Zebra using exact field search with ,ext might work, but I haven't
> figured out yet how to do an exact field search with Elasticsearch. You
> could try enclosing in "", but I feel it's probably not enough here.

Hi Katrin,

We're using Zebra Advanced Search and selecting Accelerated 
Reading Level 
search.pl?advsearch=1&idx=arl%2Cphr&q=6.&idx=kw&q=&idx=kw&q=&sort_by=relevance

We have tried entering 6; 6.; 6%; "6"; 6.0-6.999 but regardless of what we enter the system appears to return everything that contains 6 with 526$c
Comment 6 Katrin Fischer 2023-07-10 19:49:33 UTC
(In reply to Daphne Hoolahan from comment #5)
> 
> We have tried entering 6; 6.; 6%; "6"; 6.0-6.999 but regardless of what we
> enter the system appears to return everything that contains 6 with 526$c

Did you try Nick's suggestion from comment 2?
Comment 7 Daphne Hoolahan 2023-07-11 09:40:22 UTC
(In reply to Katrin Fischer from comment #6)
> (In reply to Daphne Hoolahan from comment #5)
> > 
> > We have tried entering 6; 6.; 6%; "6"; 6.0-6.999 but regardless of what we
> > enter the system appears to return everything that contains 6 with 526$c
> 
> Did you try Nick's suggestion from comment 2?

I did Katrin, but I don't think it applies to Zebra, I get a response:
 
No results match your search for '"arl:[6 TO 7}"'.
Comment 8 Katrin Fischer 2023-07-11 09:53:19 UTC
Oh! Zebra.

I don't have data for Accelarated Reader level, but this seems to work in our installation:

title-cover,first-in-subfield:D

Maybe try:

arl,first-in-subfield:6

See: https://koha-community.org/manual/22.11/en/html/searching.html#search-syntax