Bug 40964 - koha-elasticsearch is missing --where option
Summary: koha-elasticsearch is missing --where option
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Thomas Klausner
QA Contact: Jonathan Druart
URL:
Keywords:
Depends on: 35345
Blocks:
  Show dependency treegraph
 
Reported: 2025-10-07 13:55 UTC by Thomas Klausner
Modified: 2025-11-18 10:11 UTC (History)
7 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: Sponsored
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.11.00
Circulation function:


Attachments
Bug 40964: add --where to koha-elasticsearch wrapper scripts and document it (3.49 KB, patch)
2025-10-07 14:47 UTC, Thomas Klausner
Details | Diff | Splinter Review
Bug 40964: add --where to koha-elasticsearch wrapper scripts and document it (3.56 KB, patch)
2025-10-08 11:05 UTC, Anke Bruns
Details | Diff | Splinter Review
Bug 40964: add --where to koha-elasticsearch wrapper scripts and document it (3.61 KB, patch)
2025-10-23 13:58 UTC, Jonathan Druart
Details | Diff | Splinter Review
bug 40964: Add long version of options to man (2.14 KB, patch)
2025-10-23 13:58 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40964: Add long version of options to man (2.14 KB, patch)
2025-11-04 08:06 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 Thomas Klausner 2025-10-07 13:55:09 UTC
misc/search_tools/rebuild_elasticsearch.pl has an option --where to pass arbitrary SQL to select which records to index.

The koha-elasticsearch wrapper script is missing this option.

Add it!
Comment 1 Thomas Klausner 2025-10-07 14:47:02 UTC
Created attachment 187530 [details] [review]
Bug 40964: add --where to koha-elasticsearch wrapper scripts and document it

Test Plan:

* Start and enter ktd
* run koha-elasticsearch with --where, which has no effect:
  debian/scripts/koha-elasticsearch --rebuild -b -v --where 'biblionumber > 427'  kohadev
* But you will see some warnings like:
  Unknown instance --where
  Unknown instance biblionumber > 427
* Final output is: Total 435 records indexed

Apply the patch

* run the same command again:
  debian/scripts/koha-elasticsearch --rebuild -b -v --where 'biblionumber > 427'  kohadev
* output should be
 Checking state of biblios index
 Indexing biblios
 Committing final records...
 Total 11 records indexed

* Run `debian/scripts/koha-elasticsearch --help`
* "-w|--where" should show up in the docs

Sponsored-by: HKS3
Sponsored-by: Koha DACH Hackfest
Comment 2 Anke Bruns 2025-10-08 11:05:02 UTC
Created attachment 187555 [details] [review]
Bug 40964: add --where to koha-elasticsearch wrapper scripts and document it

Test Plan:

* Start and enter ktd
* run koha-elasticsearch with --where, which has no effect:
  debian/scripts/koha-elasticsearch --rebuild -b -v --where 'biblionumber > 427'  kohadev
* But you will see some warnings like:
  Unknown instance --where
  Unknown instance biblionumber > 427
* Final output is: Total 435 records indexed

Apply the patch

* run the same command again:
  debian/scripts/koha-elasticsearch --rebuild -b -v --where 'biblionumber > 427'  kohadev
* output should be
 Checking state of biblios index
 Indexing biblios
 Committing final records...
 Total 11 records indexed

* Run `debian/scripts/koha-elasticsearch --help`
* "-w|--where" should show up in the docs

Sponsored-by: HKS3
Sponsored-by: Koha DACH Hackfest
Signed-off-by: John Doe <you@example.com>
Signed-off-by: Anke Bruns <anke.bruns@gwdg.de>
Comment 3 Thomas Klausner 2025-10-13 12:48:49 UTC
see also #35345 (the actual implementation in rebuild_elasticsearch.pl)
Comment 4 Jonathan Druart 2025-10-23 13:58:38 UTC
Created attachment 188361 [details] [review]
Bug 40964: add --where to koha-elasticsearch wrapper scripts and document it

Test Plan:

* Start and enter ktd
* run koha-elasticsearch with --where, which has no effect:
  debian/scripts/koha-elasticsearch --rebuild -b -v --where 'biblionumber > 427'  kohadev
* But you will see some warnings like:
  Unknown instance --where
  Unknown instance biblionumber > 427
* Final output is: Total 435 records indexed

Apply the patch

* run the same command again:
  debian/scripts/koha-elasticsearch --rebuild -b -v --where 'biblionumber > 427'  kohadev
* output should be
 Checking state of biblios index
 Indexing biblios
 Committing final records...
 Total 11 records indexed

* Run `debian/scripts/koha-elasticsearch --help`
* "-w|--where" should show up in the docs

Sponsored-by: HKS3
Sponsored-by: Koha DACH Hackfest
Signed-off-by: Anke Bruns <anke.bruns@gwdg.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 5 Jonathan Druart 2025-10-23 13:58:40 UTC
Created attachment 188362 [details] [review]
bug 40964: Add long version of options to man

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 6 Jonathan Druart 2025-10-23 13:59:09 UTC
Removed John Doe's signed-off-by line.
Comment 7 Lucas Gass (lukeg) 2025-11-03 20:16:47 UTC
Please fix this commit message: 

bug 40964: Add long version of options to man


* Commit title does not start with 'Bug XXXXX: ' - 7031c83280b
Comment 8 Jonathan Druart 2025-11-04 08:06:54 UTC
Created attachment 189001 [details] [review]
Bug 40964: Add long version of options to man

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 9 Lucas Gass (lukeg) 2025-11-07 17:56:10 UTC
Nice work everyone!

Pushed to main for 25.11