https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18235 --- Comment #56 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- (In reply to Josef Moravec from comment #50)
Comment on attachment 85214 [details] [review] Bug 18235: DB changes
Review of attachment 85214 [details] [review]: -----------------------------------------------------------------
::: installer/data/mysql/atomicupdate/bug_18235-add-search_field-facet_order.sql @@ +1,1 @@
+ALTER TABLE search_field ADD COLUMN facet_order TINYINT(4) DEFAULT '0' AFTER weight;
Here is default 0
::: installer/data/mysql/kohastructure.sql @@ +1493,4 @@
`label` varchar(255) NOT NULL COMMENT 'the human readable name of the field, for display', `type` ENUM('', 'string', 'date', 'number', 'boolean', 'sum', 'isbn', 'stdno') NOT NULL COMMENT 'what type of data this holds, relevant when storing it in the search engine', `weight` decimal(5,2) DEFAULT NULL, + `facet_order` TINYINT(4) DEFAULT NULL COMMENT 'the order place of the field in facet list if faceted',
And here NULL
Right, must be NULL in the atomic update file. (In reply to Josef Moravec from comment #51)
Comment on attachment 85212 [details] [review] Bug 18235: ES - Facets configurable
Review of attachment 85212 [details] [review]: -----------------------------------------------------------------
::: Koha/SearchEngine/Elasticsearch.pm @@ +971,5 @@
+ my @faceted_fields = Koha::SearchFields->search( + { name => { -in => \@search_field_names }, facet_order => { '!=' => undef } }, { order_by => ['facet_order'] } + ); + my @not_faceted_fields = Koha::SearchFields->search( + { name => { -in => \@search_field_names }, facet_order => undef }, { order_by => ['facet_order'] }
Why do you retrieve fields from database in 2 queries, you always use them all.
To have the not faceted fields at the end of the array. I agree it's a lazy way to handle that, but it works :)
::: admin/searchengine/elasticsearch/mappings.pl @@ +215,4 @@
push @all_search_fields, $search_field_unblessed; }
+my @facetable_fields = Koha::SearchEngine::Elasticsearch->get_facetable_fields();
get_facetable_fields is called 3 or 4 times every run of mappings.pl.
Yep, could be lowered to 2. -- You are receiving this mail because: You are watching all bug changes.