[Koha-bugs] [Bug 18316] Add weighting/relevancy options to ElasticSearch
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Wed Apr 18 22:33:43 CEST 2018
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18316
Jonathan Druart <jonathan.druart at bugs.koha-community.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|Passed QA |Failed QA
--- Comment #19 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
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?
2. Sounds like you could replaced the loop in is_mapped_biblios, with
$self->search_marc_maps->search({ index_name => 'biblios' })->count ? 1 : 0;
3. search_marc_maps reads wrong too.
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list