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

Jonathan Druart <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Passed QA                   |Failed QA

--- Comment #19 from Jonathan Druart <[email protected]> 
---
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.
_______________________________________________
Koha-bugs mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to