Bug 36750 - OPAC - some facet heading labels are not displayed in search results when using Elasticsearch
Summary: OPAC - some facet heading labels are not displayed in search results when usi...
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact:
URL:
Keywords:
: 36803 (view as bug list)
Depends on: 35138
Blocks:
  Show dependency treegraph
 
Reported: 2024-05-02 03:40 UTC by David Nind
Modified: 2024-05-08 12:37 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00


Attachments
OPAC - Missing facet headings (183.27 KB, image/png)
2024-05-02 03:41 UTC, David Nind
Details
OPAC - Zebra facet headings (no issues) (112.24 KB, image/png)
2024-05-02 03:42 UTC, David Nind
Details
Bug 36750: (35138 follow-up) Use same display code for OPAC (4.92 KB, patch)
2024-05-02 16:47 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 36750: (35138 follow-up) Use same display code for OPAC (4.97 KB, patch)
2024-05-02 20:11 UTC, David Nind
Details | Diff | Splinter Review
Bug 36750: Fix some labels (3.16 KB, patch)
2024-05-06 09:07 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 36750: Fix some labels (3.65 KB, patch)
2024-05-06 09:57 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 36750: Use the same label for Zebra (6.74 KB, patch)
2024-05-06 09:57 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 36750: Fix aria-label for show more/less links (9.38 KB, patch)
2024-05-06 09:57 UTC, Jonathan Druart
Details | Diff | Splinter Review
OPAC - Elasticsearch (2024-05-06) - Current facets (76.84 KB, image/png)
2024-05-06 09:57 UTC, David Nind
Details
Bug 36750: (35138 follow-up) Use same display code for OPAC (5.03 KB, patch)
2024-05-07 13:34 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 36750: Fix some labels (3.71 KB, patch)
2024-05-07 13:34 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 36750: Use the same label for Zebra (6.79 KB, patch)
2024-05-07 13:34 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 36750: Fix aria-label for show more/less links (9.44 KB, patch)
2024-05-07 13:34 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 36750: Fix Languages vs Language (1.39 KB, patch)
2024-05-07 13:47 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 36750: (35138 follow-up) Use same display code for OPAC (5.37 KB, patch)
2024-05-07 14:14 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 36750: Fix some labels (3.71 KB, patch)
2024-05-07 14:14 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 36750: Use the same label for Zebra (6.75 KB, patch)
2024-05-07 14:14 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 36750: Fix aria-label for show more/less links (9.39 KB, patch)
2024-05-07 14:14 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 36750: Fix Languages vs Language (2.63 KB, patch)
2024-05-07 14:14 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Nind 2024-05-02 03:40:04 UTC
When searching in the OPAC using Elasticsearch (or OpenSearch) some facet labels are not displayed in the search results.

The actual facets are displayed, but not the heading they are grouped under.

The facet heading labels that are not displayed are (for the sample data in KTD):
- Item types
- Collections
- Holding libraries
- Home libraries
- Languages

To replicate (using koha-testing-docker (KTD)):
1. Start up KTD using Elasticsearch (or OpenSearch): ktd --es8 up (or --es7, os1, os2 - note os1 and os2 were having trouble starting up for me when I created this bug).
2. In the OPAC, search for books.
3. Note that facet heading labels are missing for these facets:
   - Item types
   - Collections
   - Holding libraries
   - Home libraries
   - Languages
4. Search in the staff interface, and note that facet headings are displayed correctly.
5. Change the Searchengine system preference to Zebra.
6. Search in the OPAC again for books and note that the facet heading labels are correctly displayed.
Comment 1 David Nind 2024-05-02 03:41:07 UTC
Created attachment 166031 [details]
OPAC - Missing facet headings
Comment 2 David Nind 2024-05-02 03:42:29 UTC
Created attachment 166032 [details]
OPAC - Zebra facet headings (no issues)
Comment 3 Nick Clemens (kidclamp) 2024-05-02 16:47:26 UTC
Created attachment 166083 [details] [review]
Bug 36750: (35138 follow-up) Use same display code for OPAC

To test:
1 - In OPAC with ES enabled do a search
2 - Note missing facet labels
3 - Apply patch
4 - They are back!
Comment 4 David Nind 2024-05-02 20:11:44 UTC
Created attachment 166084 [details] [review]
Bug 36750: (35138 follow-up) Use same display code for OPAC

To test:
1 - In OPAC with ES enabled do a search
2 - Note missing facet labels
3 - Apply patch
4 - They are back!

Signed-off-by: David Nind <david@davidnind.com>
Comment 5 David Nind 2024-05-02 20:12:16 UTC
Thanks Nick!
Comment 6 Katrin Fischer 2024-05-06 07:44:00 UTC
There is something not quite right here. 

For me without the patch the labels display in the OPAC and it doesn't look like on the screenshot which seems a little odd. 

With the patch I see "HomeLibrary" as a label, but it should be "Home libraries" 
(requires  DisplayLibraryFacets set to both)

Maybe we need to double check the database update?
Comment 7 Jonathan Druart 2024-05-06 09:07:41 UTC
Created attachment 166187 [details] [review]
Bug 36750: Fix some labels
Comment 8 Jonathan Druart 2024-05-06 09:08:24 UTC
Nick's patch looks good to me. I have found other "typos" that will cause problems with translation.
Comment 9 Katrin Fischer 2024-05-06 09:16:01 UTC
(In reply to Jonathan Druart from comment #8)
> Nick's patch looks good to me. I have found other "typos" that will cause
> problems with translation.

What about the HomeLibrary issue I found? For me the situation worsens with the patch.
Comment 10 Katrin Fischer 2024-05-06 09:16:52 UTC
(In reply to Katrin Fischer from comment #9)
> (In reply to Jonathan Druart from comment #8)
> > Nick's patch looks good to me. I have found other "typos" that will cause
> > problems with translation.
> 
> What about the HomeLibrary issue I found? For me the situation worsens with
> the patch.

To be clear, I have "Home libraries" showing fine and all other labels are ok 2. They break WITH the patch applied.
Comment 11 Katrin Fischer 2024-05-06 09:51:23 UTC
For clarification: Turns out I somehow ended up with Zebra instead of Elasticsearch while testing. So the regression was in Zebra actually. 
Waiting for Joubu's Go on this now.
Comment 12 Jonathan Druart 2024-05-06 09:57:13 UTC
Created attachment 166191 [details] [review]
Bug 36750: Fix some labels
Comment 13 Jonathan Druart 2024-05-06 09:57:16 UTC
Created attachment 166192 [details] [review]
Bug 36750: Use the same label for Zebra
Comment 14 Jonathan Druart 2024-05-06 09:57:18 UTC
Created attachment 166193 [details] [review]
Bug 36750: Fix aria-label for show more/less links

Didn't manage to keep the more_less_labels because of the space in the
key names
Comment 15 David Nind 2024-05-06 09:57:47 UTC
Created attachment 166194 [details]
OPAC - Elasticsearch (2024-05-06) - Current facets

For what it is worth, I had another look (after Jonathan's patch) and the screenshot shows what I see now.

Additional things that I noticed:

1. Collections: displaying authorized value codes rather than the OPAC description. I added some OPAC descriptions in the authorized values, but it made no difference, even after reindexing. For the Elasticsearch configuration, ccode is mapped to 9528.

2. Languages: Zebra doesn't have languages shown in the facets, values look like they are coming from 041$a (I initially thought they would be coming from the LANG authorized values).

3. Item types: the odd values are coming from "bad data" - records with non-authorized values in 942$c.
Comment 16 Jonathan Druart 2024-05-06 09:57:57 UTC
yes, I reassigned it to myself because I found issues with Zebra. Should be fixed now but I really would like Nick's opinion on those follow-ups :)
Comment 17 David Nind 2024-05-06 10:04:00 UTC
Ignore my comment, these were before Jonathan's additional patches!

I'll wait to sign off until Nick has had a look.
Comment 18 Katrin Fischer 2024-05-06 10:07:43 UTC
Hi David, I think having your feedback on the new patches would be very helpful in moving this forward if you can spare the time!
Comment 19 David Nind 2024-05-06 10:43:09 UTC
Nothing too much to add (Jonathan fixed the Collections facet - now displays CCODE authorized value description, if it has an OPAC description then that is displayed instead):

Elasticsearch - facet labels and order:[1]
- Availability
- Authors
- Item types
- Locations
- Places
- Series
- Topics
- Collections
- Holding libraries
- Home libraries
- Languages [4]

Zebra - facet labels and order:[2]
- Availability
- Authors
- Collections
- Holding libraries[3]
- Item types
- Locations
- Series
- Places
- Topics
- Titles [4]

[1] Elasticsearch - can configure the facet order from Administration > Catalog > Search engine configuration (Elasticsearch) > Bibliographic records > bottom of the page

[2] I don't think there is a UI way to configure the facet order in Zebra (but I don't know enough about configuring either Zebra or Elasticsearch).

[3] There is a Zebra only system preference to configure what is shown for home and holding libraries: DisplayLibraryFacets - default in KTD is to show facets for holding library. Other options are home library, and both home and holding library (both of these work as expected with Zebra).

[4] Default KTD differences (apart from Home and holdings libraries (see [3]):
    - Elasticsearch has a Languages facet
    - Zebra has a Titles facet
Comment 20 Nick Clemens (kidclamp) 2024-05-07 13:34:00 UTC
Created attachment 166281 [details] [review]
Bug 36750: (35138 follow-up) Use same display code for OPAC

To test:
1 - In OPAC with ES enabled do a search
2 - Note missing facet labels
3 - Apply patch
4 - They are back!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 21 Nick Clemens (kidclamp) 2024-05-07 13:34:02 UTC
Created attachment 166282 [details] [review]
Bug 36750: Fix some labels

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 22 Nick Clemens (kidclamp) 2024-05-07 13:34:04 UTC
Created attachment 166283 [details] [review]
Bug 36750: Use the same label for Zebra

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 23 Nick Clemens (kidclamp) 2024-05-07 13:34:06 UTC
Created attachment 166284 [details] [review]
Bug 36750: Fix aria-label for show more/less links

Didn't manage to keep the more_less_labels because of the space in the
key names

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 24 Nick Clemens (kidclamp) 2024-05-07 13:34:28 UTC
This all looks good to me - if David can test too and add his sign off then we can mark this PQA
Comment 26 Katrin Fischer 2024-05-07 13:46:39 UTC
(In reply to Katrin Fischer from comment #25)
> I am not persuaded by the current "design" of the radiobox buttons, but
> maybe we can get some help there if we ask really nicely as a follow-up?

wrong bug...
Comment 27 Jonathan Druart 2024-05-07 13:47:11 UTC
Created attachment 166286 [details] [review]
Bug 36750: Fix Languages vs Language
Comment 28 Jonathan Druart 2024-05-07 13:48:40 UTC
*** Bug 36803 has been marked as a duplicate of this bug. ***
Comment 29 Jonathan Druart 2024-05-07 14:14:18 UTC
Created attachment 166288 [details] [review]
Bug 36750: (35138 follow-up) Use same display code for OPAC

To test:
1 - In OPAC with ES enabled do a search
2 - Note missing facet labels
3 - Apply patch
4 - They are back!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 30 Jonathan Druart 2024-05-07 14:14:21 UTC
Created attachment 166289 [details] [review]
Bug 36750: Fix some labels

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 31 Jonathan Druart 2024-05-07 14:14:24 UTC
Created attachment 166290 [details] [review]
Bug 36750: Use the same label for Zebra

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 32 Jonathan Druart 2024-05-07 14:14:28 UTC
Created attachment 166291 [details] [review]
Bug 36750: Fix aria-label for show more/less links

Didn't manage to keep the more_less_labels because of the space in the
key names

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 33 Jonathan Druart 2024-05-07 14:14:31 UTC
Created attachment 166292 [details] [review]
Bug 36750: Fix Languages vs Language
Comment 34 Jonathan Druart 2024-05-07 14:14:58 UTC
Fixed conflicts with bug 36396.
Comment 35 Katrin Fischer 2024-05-07 15:14:28 UTC
We still have a little issue with the labels for Zebra:

They display as:

* CollectionCodes
* HoldingLibrary

Can you please have a look?
Comment 36 Katrin Fischer 2024-05-07 15:15:44 UTC
Forget it, it just fixed itself!
Comment 37 Katrin Fischer 2024-05-07 15:16:45 UTC
Testing this myself as you can see... :)
Comment 38 Katrin Fischer 2024-05-07 15:41:55 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 39 Katrin Fischer 2024-05-07 18:41:51 UTC
I am not sure if this is related to this or another facets patch, but it seems definitely related to the facets work:

t_db_dependent_Koha_SearchEngine_Elasticsearch_QueryBuilder_t.build_query tests (59)
    not ok 9 - homebranch not added to facets if DisplayLibraryFacets=holding
    ok 10 - holdingbranch added to facets if DisplayLibraryFacets=holding
    ok 11 - homebranch added to facets if DisplayLibraryFacets=home
    not ok 12 - holdingbranch not added to facets if DisplayLibraryFacets=home
Comment 40 Jonathan Druart 2024-05-08 12:37:06 UTC
(In reply to Katrin Fischer from comment #39)
> I am not sure if this is related to this or another facets patch, but it
> seems definitely related to the facets work:
> 
> t_db_dependent_Koha_SearchEngine_Elasticsearch_QueryBuilder_t.build_query
> tests (59)
>     not ok 9 - homebranch not added to facets if DisplayLibraryFacets=holding
>     ok 10 - holdingbranch added to facets if DisplayLibraryFacets=holding
>     ok 11 - homebranch added to facets if DisplayLibraryFacets=home
>     not ok 12 - holdingbranch not added to facets if
> DisplayLibraryFacets=home

See bug 35138.