<div dir="ltr">I have seen use_zebra_facets=1 cause no facets rendered when GRS-1 configuration files are kept during upgrades up to where GRS-1 got deprecated (3.20?). Is it the case? What does the About > System information page says about your config?<div><br></div><div>The slowliness is not in zebra per se, but in the way we retrieve the facets from it (so Koha/Perl side). We retrieve each facet at a time instead of fetching them all in one call. And they come in XML format, so need to be parsed. So, if anyone is willing to improve it, just need to optimize this function (read the TODO):</div><div><div><br></div><div>sub _get_facet_from_result_set {</div><div><br></div><div>    my $facet_idx = shift;</div><div>    my $rs        = shift;</div><div>    my $sep       = shift;</div><div><br></div><div>    my $internal_sep  = '<*>';</div><div>    my $facetMaxCount = C4::Context->preference('FacetMaxCount') // 20;</div><div><br></div><div>    return if ( ! defined $facet_idx || ! defined $rs );</div><div>    # zebra's facet element, untokenized index</div><div>    my $facet_element = 'zebra::facet::' . $facet_idx . ':0:' . $facetMaxCount;</div><div>    # configure zebra results for retrieving the desired facet</div><div>    $rs->option( elementSetName => $facet_element );</div><div>    # get the facet record from result set</div><div>    my $facet = $rs->record( 0 )->raw;</div><div>    # if the facet has no restuls...</div><div>    return if !defined $facet;</div><div>    # TODO: benchmark DOM vs. SAX performance</div><div>    my $facet_dom = XML::LibXML->load_xml(</div><div>      string => ($facet)</div><div>    );</div><div>    my @terms = $facet_dom->getElementsByTagName('term');</div><div>    return if ! @terms;</div><div><br></div><div>    my $facets = {};</div><div>    foreach my $term ( @terms ) {</div><div>        my $facet_value = $term->textContent;</div><div>        $facet_value =~ s/\Q$internal_sep\E/$sep/ if defined $sep;</div><div>        $facets->{ $facet_value } = $term->getAttribute( 'occur' );</div><div>    }</div><div><br></div><div>    return $facets;</div><div>}</div></div><div><br></div><div>Another option would be to make _get_facets_from_zebra build the element set containing all facets so they are read in one call (comma-separate all elements). The problem is that Zebra returns zero if one of the elements is empty. Jared proposed to create a ghost record with all facet fields. I didn't manage to make it work. Another option is to patch Zebra. I started that, but abandoned once the ES code got pushed.</div><div><br></div><div>So, if use_zebra_facets=0 is good enough, maybe it should be recommended. Problem is it is not a real facet, but the sole extraction of the fields from the first x records.</div><div>As I said, it could be good enough anyway.</div><div><br></div><div>Regards</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">El mar., 23 ago. 2016 a las 10:21, Barton Chittenden (<<a href="mailto:barton@bywatersolutions.com">barton@bywatersolutions.com</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Zebra tends to be I/O bound -- we've seen it write enormous .zrs files to disk (~16G/query on large libraries). Bug 13665 mentions that searches could be taking upwards of 40 seconds to complete -- I think that we've seen searches time out and return no results at about 1 minute.<div><br></div><div>Is it possible to tune Zebra's space/time optimizations in any way so that it doesn't write such large files to disk?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 23, 2016 at 5:38 AM, Jonathan Druart <span dir="ltr"><<a href="mailto:jonathan.druart@bugs.koha-community.org" target="_blank">jonathan.druart@bugs.koha-community.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">See bug 13665 - Retrieve facets from zebra is slow<br>
To understand why and when use_zebra_facet=1 is slow<br>
<div><div><br>
2016-08-22 21:31 GMT+01:00 Barton Chittenden <<a href="mailto:barton@bywatersolutions.com" target="_blank">barton@bywatersolutions.com</a>>:<br>
> I haven't run into the issue with the dashes in idzebra-2.0 2.0.59, but I<br>
> have run into this, when using ICU-Chains:<br>
><br>
> Bug 16581 : ICU tokenization bug in idzebra-2.0 2.0.59-1<br>
> URL       : <a href="https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16581" rel="noreferrer" target="_blank">https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16581</a><br>
> Priority  : P5 - low<br>
> Urgency   : enhancement<br>
> Status    : NEW<br>
><br>
> I also know that when use_zebra_facets was first introduced, it was *very*<br>
> slow -- I can't find any bugs about that though. It's possible that it got<br>
> so slow under idzebra-2.0 2.61 that the searches are timing out.<br>
><br>
> It should be possible to set the logging for zebra so that you can see the<br>
> PQF queries:<br>
><br>
> See<br>
><br>
> Bug 15714 : Remove zebra.log from debian scripts and add optional log levels<br>
> URL       : <a href="https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15714" rel="noreferrer" target="_blank">https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15714</a><br>
> Priority  : P5 - low<br>
> Urgency   : enhancement<br>
> Status    : RESOLVED<br>
><br>
> For setting the log levels<br>
><br>
> And <a href="http://koha.1045719.n5.nabble.com/Improving-Zebra-logging-td5861827.html" rel="noreferrer" target="_blank">http://koha.1045719.n5.nabble.com/Improving-Zebra-logging-td5861827.html</a><br>
><br>
> For a general discussion of how to use them.<br>
><br>
> ... This should give you some idea of what's failing, both in terms of the<br>
> dashes in 2.0.59 and the non-functional zebra facets under 2.0.61.<br>
><br>
> My general feeling is that 2.0.59 is irredeemably broken by bug 16581, and<br>
> we need at least 2.0.60, but I don't have any experience with zebra facets.<br>
><br>
> --Barton<br>
><br>
><br>
><br>
> On Mon, Aug 22, 2016 at 2:49 PM, Mark Tompsett <<a href="mailto:mtompset@hotmail.com" target="_blank">mtompset@hotmail.com</a>> wrote:<br>
>><br>
>> Greetings,<br>
>><br>
>> Similar problem. I hope someone has a better solution than setting it to<br>
>> 0.<br>
>><br>
>> GPML,<br>
>> Mark Tompsett<br>
>><br>
>> -----Original Message-----<br>
>> From: Philippe Blouin<br>
>> Sent: Monday, August 22, 2016 2:40 PM<br>
>> To: <a href="mailto:koha-devel@lists.koha-community.org" target="_blank">koha-devel@lists.koha-community.org</a><br>
>> Subject: [Koha-devel] 16.05, zebra and jessie<br>
>><br>
>> Hello!<br>
>><br>
>> We're trying to find the correction combination.  We're new on Jessie,<br>
>> so we still have some tweaking needed...<br>
>><br>
>> - By default, we get zebra 2.00.59 installed on Jessie through the<br>
>> packages.<br>
>> - On 16.05, we get some very bad results in the search when the itemtype<br>
>> contains an hyphen (-), like 'A-DOC'.<br>
>> - So we installed zebra 2.00.62.  This fixes the search...<br>
>> - But now we do not have facets.<br>
>> - So we set <use_zebra_facets>0</use_zebra_facets><br>
>> - And now we have facets.  But this feels... wrong?<br>
>><br>
>> My dummy question: what is the supposedly correct version of Zebra on<br>
>> Jessie ?<br>
>> And we're we correct in setting the config to 0 ?<br>
>><br>
>> Thanks<br>
>> Blou<br>
>> _______________________________________________<br>
>> Koha-devel mailing list<br>
>> <a href="mailto:Koha-devel@lists.koha-community.org" target="_blank">Koha-devel@lists.koha-community.org</a><br>
>> <a href="http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel" rel="noreferrer" target="_blank">http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel</a><br>
>> website : <a href="http://www.koha-community.org/" rel="noreferrer" target="_blank">http://www.koha-community.org/</a><br>
>> git : <a href="http://git.koha-community.org/" rel="noreferrer" target="_blank">http://git.koha-community.org/</a><br>
>> bugs : <a href="http://bugs.koha-community.org/" rel="noreferrer" target="_blank">http://bugs.koha-community.org/</a><br>
>><br>
>> _______________________________________________<br>
>> Koha-devel mailing list<br>
>> <a href="mailto:Koha-devel@lists.koha-community.org" target="_blank">Koha-devel@lists.koha-community.org</a><br>
>> <a href="http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel" rel="noreferrer" target="_blank">http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel</a><br>
>> website : <a href="http://www.koha-community.org/" rel="noreferrer" target="_blank">http://www.koha-community.org/</a><br>
>> git : <a href="http://git.koha-community.org/" rel="noreferrer" target="_blank">http://git.koha-community.org/</a><br>
>> bugs : <a href="http://bugs.koha-community.org/" rel="noreferrer" target="_blank">http://bugs.koha-community.org/</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> Koha-devel mailing list<br>
> <a href="mailto:Koha-devel@lists.koha-community.org" target="_blank">Koha-devel@lists.koha-community.org</a><br>
> <a href="http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel" rel="noreferrer" target="_blank">http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel</a><br>
> website : <a href="http://www.koha-community.org/" rel="noreferrer" target="_blank">http://www.koha-community.org/</a><br>
> git : <a href="http://git.koha-community.org/" rel="noreferrer" target="_blank">http://git.koha-community.org/</a><br>
> bugs : <a href="http://bugs.koha-community.org/" rel="noreferrer" target="_blank">http://bugs.koha-community.org/</a><br>
</div></div></blockquote></div><br></div>
_______________________________________________<br>
Koha-devel mailing list<br>
<a href="mailto:Koha-devel@lists.koha-community.org" target="_blank">Koha-devel@lists.koha-community.org</a><br>
<a href="http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel" rel="noreferrer" target="_blank">http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel</a><br>
website : <a href="http://www.koha-community.org/" rel="noreferrer" target="_blank">http://www.koha-community.org/</a><br>
git : <a href="http://git.koha-community.org/" rel="noreferrer" target="_blank">http://git.koha-community.org/</a><br>
bugs : <a href="http://bugs.koha-community.org/" rel="noreferrer" target="_blank">http://bugs.koha-community.org/</a></blockquote></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr"><div style="color:rgb(117,117,117);font-family:'helvetica neue',helvetica,arial,sans-serif;font-size:12.8px">Tomás Cohen Arazi</div><div style="color:rgb(117,117,117);font-family:'helvetica neue',helvetica,arial,sans-serif;font-size:12.8px">Theke Solutions (<a href="http://theke.io/">https://theke.io</a>)<br>✆ +54 9351 3513384<br>GPG: B2F3C15F</div></div></div>