Bug 23630: Do not remove field 999 in Elasticsearch indexing
authorFridolin Somers <fridolin.somers@biblibre.com>
Thu, 19 Sep 2019 14:55:51 +0000 (16:55 +0200)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 29 Oct 2019 12:13:58 +0000 (12:13 +0000)
commitfb083813a8237691f0b9d419d826fdea58096cd4
treed7d9014cfa753a2aa4750a62e9fd26bea5ae2e66
parentfe5c65c5cd1a797324a8c3c28d66e691a6d68b1a
Bug 23630: Do not remove field 999 in Elasticsearch indexing

Elasticsearch indexing uses 999$c to store record id by deleting the all field first !
So you can not store anything in field 999, even in UNIMARC and even in authorities records.

Looks like it is quick fix code added to start Elasticsearch use.

This behavior is disturbing and very strange for UNIMARC flavour.

This patch corrects by defining record ids mandatory in Koha::SearchEngine::Elasticsearch::Indexer::update_index().
This ids array is actually always given (except in UT).
I think it is useless to allow adding a record without its id.

Test plan :
1) Use Elasticsearch as SearchEngine
2) Create a subfield 999$z in default framework
3) Create a record with default framework
4) Enter a random string (never used in catalog) like "tototata" in 999$z
5) In Search engine configuration, define search field "subject" for 999$z
6) Rebuild record : misc/search_tools/rebuild_elasticsearch.pl -b -bn <biblionumber> -v
7) Search for the random string => You get a result
8) Optionnaly look at records in ES : <es server>:9200/<es index name>/data/<biblionumber>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/SearchEngine/Elasticsearch.pm
Koha/SearchEngine/Elasticsearch/Indexer.pm
t/db_dependent/Koha/SearchEngine/Elasticsearch/Indexer.t