Bug 11232: retrieve facets from Zebra's indexes in DOM
authorTomas Cohen Arazi <tomascohen@gmail.com>
Fri, 5 Sep 2014 19:05:54 +0000 (16:05 -0300)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Wed, 15 Oct 2014 15:55:42 +0000 (12:55 -0300)
commit4c1a9fbd392d428e593aae36a0c57a590dacc2ae
tree52f5f9d282af9231bfd3ce269191e73c59ae5664
parentc1e384f250266a26b1638dc3077cc054c55cf602
Bug 11232: retrieve facets from Zebra's indexes in DOM

This patch adds the following routines to C4::Search

- GetFacets
   This is a wrapper routine, that given a ZOOM::ResultSet, extracts
   the relevant facets. To do the job, it uses the internal functions:
   _get_facets_from_records and _get_facets_from_zebra. The choice is done
   on querying the indexing mode: grs1 will use records, and dom zebra's facets.
- _get_facets_from_records
   Just refactoring the already existent main loop from getRecords into a function.
- _get_facets_from_zebra
   Given a result set, loop through all defined facets in C4::Koha::getFacets
   and call _get_facet_from_result_set for each, to build the facets
   information. It retrieves the facets from Zebra's facets.
- _get_facet_from_result_set
   Given a result set and a facet index name, retrieve the facets
   for the given index, and build the result for rendering.

To test this preliminay work:
- Apply the patches, install on DOM, using MARC21, NORMARC and UNIMARC.
- Reindex some DB with lots of records.
- Check facets work.

Note: UNIMARC is the only dialect that has more than one subfield (concatenated)
for facets values, so it is better to test on uNIMARC. The approach leaves room
for re-thinking facets in MARC21/NORMARC, but it is outside of the scope of the bug
(e.g. we could have more author facets)

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: David Cook <dcook@prosentient.com.au>
Seems to work with DOM and MARC21.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
C4/Search.pm