[Koha-bugs] [Bug 18316] Add weighting/relevancy options to ElasticSearch

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Apr 19 14:04:18 CEST 2018


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18316

--- Comment #20 from Alex Arnaud <alex.arnaud at biblibre.com> ---
(In reply to Jonathan Druart from comment #19)
> 1. 
> From Koha::SearchFields->weighted_fields
> 
> +    while ( my $field = $fields->next ) {
> +        push @$w_fields, $field->name;
> +        push @$weight, $field->weight;
> +    }
> +
> +    return ($w_fields, $weight);
> 
> From search.pl:
> ($w_fields, $weight) = Koha::SearchFields->weighted_fields();
> 
> then we call build_query_compat with { w_fields => @$w_fields, weight =>
> @$weight  }
> 
> which will finally do:
> +    if ( defined $weights[0] ) {
> +        for (my $i = 0 ; $i < (scalar @weights) ; $i++ ){
> +            push @fields, "$w_fields[$i]^$weights[$i]";
> +        }
> +    }
> 
> so basically you want to fetch the weighted fields from build_query_compat,
> with something like:
>   push @fields, sprintf("%s^%s", $_->name, $_->weight) for
> Koha::SearchFields->weighted_fields;
> 
> That seems much more easier, what did I miss?
We don't want to use weighted fields on advanced search and build_query_compat
is called for both simple and adv search.
But i can propose something similar in search.pl
> 
> 
> 2. Sounds like you could replaced the loop in is_mapped_biblios, with
> $self->search_marc_maps->search({ index_name => 'biblios' })->count ? 1 : 0;
Right.
> 
> 3. search_marc_maps reads wrong too.
What is wrong?

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list