Bug 24103 - Add option to dump built search query to templates
Summary: Add option to dump built search query to templates
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Nick Clemens (kidclamp)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 30543
  Show dependency treegraph
 
Reported: 2019-11-25 15:02 UTC by Nick Clemens (kidclamp)
Modified: 2022-04-14 13:20 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This enhancement allows you to view the search query used by Zebra or Elasticsearch, to help with troubleshooting. To use, enable the new system preference DumpSearchQueryTemplate, enable `DumpTemplateVarsIntranet` and `DumpTemplateVarsOpac`, and then search the page source in the staff interface or OPAC for 'search_query'. **New system preference**: `DumpSearchQueryTemplate` defaults to disabled.
Version(s) released in:
20.05.00, 19.11.05
Circulation function:


Attachments
Bug 24103: Add option to dump search query to templates (7.71 KB, patch)
2019-11-25 15:09 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 24103: (follow-up) Dump query on opac authorities search (797 bytes, patch)
2020-02-14 11:36 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 24103: Add option to dump search query to templates (7.07 KB, patch)
2020-02-14 19:36 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 24103: (follow-up) Dump query on opac authorities search (849 bytes, patch)
2020-02-14 19:36 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 24103: Add option to dump search query to templates (7.10 KB, patch)
2020-02-15 02:58 UTC, David Nind
Details | Diff | Splinter Review
Bug 24103: (follow-up) Dump query on opac authorities search (896 bytes, patch)
2020-02-15 02:58 UTC, David Nind
Details | Diff | Splinter Review
Bug 24103: Add option to dump search query to templates (7.16 KB, patch)
2020-02-17 22:11 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 24103: (follow-up) Dump query on opac authorities search (954 bytes, patch)
2020-02-17 22:11 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2019-11-25 15:02:14 UTC
It would be nice to be able to see what is actually being searched in the search engine when performing a query
Comment 1 Nick Clemens (kidclamp) 2019-11-25 15:09:00 UTC Comment hidden (obsolete)
Comment 2 Myka Kennedy Stephens 2020-01-19 00:36:57 UTC Comment hidden (obsolete)
Comment 3 Nick Clemens (kidclamp) 2020-02-14 11:36:52 UTC
Created attachment 98928 [details] [review]
Bug 24103: (follow-up) Dump query on opac authorities search
Comment 4 Owen Leonard 2020-02-14 19:36:16 UTC
Created attachment 99023 [details] [review]
Bug 24103: Add option to dump search query to templates

To test:
1 - Apply patch, update database
2 - Note new syspref 'DumpSearchQueryTemplate'
3 - Leave it off
4 - Enable DumpTemplateVariablesOpac and Staff
5 - Search on staff and opac
6 - View the source
7 - Search for 'search_query' - you shouldn't find it
8 - Enable the new pref
9 - Repeat, but you should find the query
10 - Test staff/opac search and advanced search, cataloguing search, authority search, authfinder search, adding to a basket form a new biblio
11 - All should work and show the query
12 - This will work under both ES and Zebra

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 5 Owen Leonard 2020-02-14 19:36:19 UTC
Created attachment 99024 [details] [review]
Bug 24103: (follow-up) Dump query on opac authorities search

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 6 Owen Leonard 2020-02-14 19:38:22 UTC
I tested these under Zebra ONLY, so I don't think I can mark this as signed off. But I wanted to at least give a signoff for Zebra.
Comment 7 David Nind 2020-02-15 02:58:37 UTC
Created attachment 99054 [details] [review]
Bug 24103: Add option to dump search query to templates

To test:
1 - Apply the patch, update the database 
    (perl installer/data/mysql/updatedatabase.pl)
2 - Note new system preference 'DumpSearchQueryTemplate'
3 - Leave it off
4 - Enable DumpTemplateVarsIntranet and DumpTemplateVarsOpac system 
    preferences
5 - Search on staff and opac
6 - View the page source
7 - Search for 'search_query' - you shouldn't find it
8 - Enable the new system preference
9 - Repeat steps 5-7, but you should now find the 'search_query'
10 - Test staff/opac search and advanced search, cataloguing search, 
     authority search, authfinder search
     (/cgi-bin/koha/authorities/auth_finder.pl),
     adding to a basket form a new biblio
11 - All should work and show the query
12 - This will work under both ES and Zebra

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: David Nind <david@davidnind.com>
Comment 8 David Nind 2020-02-15 02:58:41 UTC
Created attachment 99055 [details] [review]
Bug 24103: (follow-up) Dump query on opac authorities search

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: David Nind <david@davidnind.com>
Comment 9 David Nind 2020-02-15 03:01:15 UTC
Tested on Elastic Search and everything works as per the test plan.

To enable Elastic Search on koha-testing-docker:
1) Start up with ku-es6 (instead of just ku)
   (see the note at bottom of koha-testing-docker README
   about 'Having Elasticsearch run')
2) Change the search engine from Zebra to Elasticsearch
   (SearchEngine system preference)
3) Reindex the content: go into the container using kshell 
   then change to the koha directory and run
   ./misc/search_tools/rebuild_elasticsearch.pl -v -d
4) Search in either the staff interface or OPAC to make sure
   you get results
Comment 10 Katrin Fischer 2020-02-17 22:10:36 UTC
I'd like it if this was not tied to the other preferences. It makes it hard to work with and not sure if we couldn't just have added to the output without needing a new pref? But working and helpful - passing QA.
Comment 11 Katrin Fischer 2020-02-17 22:11:22 UTC
Created attachment 99137 [details] [review]
Bug 24103: Add option to dump search query to templates

To test:
1 - Apply patch, update database
2 - Note new syspref 'DumpSearchQueryTemplate'
3 - Leave it off
4 - Enable DumpTemplateVariablesOpac and Staff
5 - Search on staff and opac
6 - View the source
7 - Search for 'search_query' - you shouldn't find it
8 - Enable the new pref
9 - Repeat, but you should find the query
10 - Test staff/opac search and advanced search, cataloguing search, authority search, authfinder search, adding to a basket form a new biblio
11 - All should work and show the query
12 - This will work under both ES and Zebra

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 12 Katrin Fischer 2020-02-17 22:11:26 UTC
Created attachment 99138 [details] [review]
Bug 24103: (follow-up) Dump query on opac authorities search

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 13 Martin Renvoize (ashimema) 2020-02-19 16:13:06 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 14 Joy Nelson 2020-03-13 00:41:46 UTC
enhancement not backported to 19.11.x
Comment 15 Joy Nelson 2020-04-01 15:38:36 UTC
Backported to 19.11.x branch for 19.11.05
Comment 16 Lucas Gass (lukeg) 2020-04-08 21:04:46 UTC
not backporting enhancement to 19.05