Bug 38145

Summary: Having ES enabled but unreachable breaks cataloguing
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: Architecture, internals, and plumbingAssignee: Bugs List <koha-bugs>
Status: CONFIRMED --- QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: dcook, tomascohen
Version: Main   
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 Tomás Cohen Arazi (tcohen) 2024-10-10 18:21:57 UTC
It seems that changing between Zebra and Elasticsearch produces a bad behavior on the latter, when the search engine is not available.

I noticed this while doing some acquisitions where AutoLinkBiblios was set and Koha exploded while trying to link authorities.

While writing the steps to reproduce I thought about just adding a record, and boom :-D

To reproduce:
1. Start KTD with ES
   $ ktd --es7 up -d
2. Edit koha-conf.xml so it doesn't find the ES server
   $ ktd --shell
  k$ vim /etc/koha/sites/kohadev/koha-conf.xml
...
<elasticsearch>
     <server>potato:9200</server>
3. Catalog a new bibliographic record
4. Click 'Save'
=> FAIL: Koha explodes:
Unable to perform your search. Please try again.
 at /kohadevbox/koha/Koha/SearchEngine/Elasticsearch/Search.pm line 104
5. Switch SearchEngine=Zebra
6. Stop Zebra:
  k$ sudo koha-zebra --stop kohadev
7. Repeat 3-4 (you can go back in the browser)
=> SUCCESS: It saved the record
Comment 1 Tomás Cohen Arazi (tcohen) 2024-10-11 12:33:54 UTC
I will add that the bibliographic search behavior differs between Zebra and ES.

* ES: Shows a yellow alert box saying the search couldn't be done
* Zebra: Silently shows 'No results for your query'

Which is the right one? On attempting to provide a patch, I noticed I was actually changing this behavior to match Zebra's, so asking y'all what we prefer.
Comment 2 Katrin Fischer 2024-10-14 07:15:46 UTC
I think a "more helpful" message would probably be better. It's a difference if there are no results because of my chosen search terms or because the index/search engine is not there at all.
Comment 3 David Cook 2024-10-21 23:46:11 UTC
(In reply to Katrin Fischer from comment #2)
> I think a "more helpful" message would probably be better. It's a difference
> if there are no results because of my chosen search terms or because the
> index/search engine is not there at all.

Yeah, I think Koha should say if it can't connect to the search engine.