Lines 27-32
rebuild_elasticsearch.pl - inserts records from a Koha database into Elasticsear
Link Here
|
27 |
|
27 |
|
28 |
B<rebuild_elasticsearch.pl> |
28 |
B<rebuild_elasticsearch.pl> |
29 |
[B<-c|--commit>=C<count>] |
29 |
[B<-c|--commit>=C<count>] |
|
|
30 |
[B<-d|--delete>] |
31 |
[B<-r|--reset>] |
32 |
[B<-a|--authorities>] |
33 |
[B<-b|--biblios>] |
34 |
[B<-bn|--bnumber>] |
35 |
[B<-ai|--authid>] |
36 |
[B<-p|--processes>] |
30 |
[B<-v|--verbose>] |
37 |
[B<-v|--verbose>] |
31 |
[B<-h|--help>] |
38 |
[B<-h|--help>] |
32 |
[B<--man>] |
39 |
[B<--man>] |
Lines 48-53
Higher should be faster, but will cause more RAM usage. Default is 5000.
Link Here
|
48 |
|
55 |
|
49 |
Delete the index and recreate it before indexing. |
56 |
Delete the index and recreate it before indexing. |
50 |
|
57 |
|
|
|
58 |
=item B<-r|--reset> |
59 |
|
60 |
Reload mappings from files (specified in koha-conf.xml) before indexing. |
61 |
Implies --delete. |
62 |
|
51 |
=item B<-a|--authorities> |
63 |
=item B<-a|--authorities> |
52 |
|
64 |
|
53 |
Index the authorities only. Combining this with B<-b> is the same as |
65 |
Index the authorities only. Combining this with B<-b> is the same as |
Lines 98-104
use Koha::Script;
Link Here
|
98 |
use C4::Context; |
110 |
use C4::Context; |
99 |
use Koha::MetadataRecord::Authority; |
111 |
use Koha::MetadataRecord::Authority; |
100 |
use Koha::BiblioUtils; |
112 |
use Koha::BiblioUtils; |
|
|
113 |
use Koha::SearchEngine::Elasticsearch; |
101 |
use Koha::SearchEngine::Elasticsearch::Indexer; |
114 |
use Koha::SearchEngine::Elasticsearch::Indexer; |
|
|
115 |
use Koha::Caches; |
102 |
use MARC::Field; |
116 |
use MARC::Field; |
103 |
use MARC::Record; |
117 |
use MARC::Record; |
104 |
use Modern::Perl; |
118 |
use Modern::Perl; |
Lines 106-112
use Pod::Usage;
Link Here
|
106 |
|
120 |
|
107 |
my $verbose = 0; |
121 |
my $verbose = 0; |
108 |
my $commit = 5000; |
122 |
my $commit = 5000; |
109 |
my ($delete, $help, $man, $processes); |
123 |
my ($delete, $reset, $help, $man, $processes); |
110 |
my ($index_biblios, $index_authorities); |
124 |
my ($index_biblios, $index_authorities); |
111 |
my (@biblionumbers,@authids); |
125 |
my (@biblionumbers,@authids); |
112 |
|
126 |
|
Lines 115-120
$|=1; # flushes output
Link Here
|
115 |
GetOptions( |
129 |
GetOptions( |
116 |
'c|commit=i' => \$commit, |
130 |
'c|commit=i' => \$commit, |
117 |
'd|delete' => \$delete, |
131 |
'd|delete' => \$delete, |
|
|
132 |
'r|reset' => \$reset, |
118 |
'a|authorities' => \$index_authorities, |
133 |
'a|authorities' => \$index_authorities, |
119 |
'b|biblios' => \$index_biblios, |
134 |
'b|biblios' => \$index_biblios, |
120 |
'bn|bnumber=i' => \@biblionumbers, |
135 |
'bn|bnumber=i' => \@biblionumbers, |
Lines 139-144
pod2usage( -exitstatus => 0, -verbose => 2 ) if $man;
Link Here
|
139 |
|
154 |
|
140 |
_sanity_check(); |
155 |
_sanity_check(); |
141 |
|
156 |
|
|
|
157 |
if ($reset){ |
158 |
Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings; |
159 |
my $cache = Koha::Caches->get_instance(); |
160 |
$cache->clear_from_cache('elasticsearch_search_fields_staff_client'); |
161 |
$cache->clear_from_cache('elasticsearch_search_fields_opac'); |
162 |
$delete = 1; |
163 |
} |
164 |
|
142 |
_verify_index_state($Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX, $delete) if ($index_biblios); |
165 |
_verify_index_state($Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX, $delete) if ($index_biblios); |
143 |
_verify_index_state($Koha::SearchEngine::Elasticsearch::AUTHORITIES_INDEX, $delete) if ($index_authorities); |
166 |
_verify_index_state($Koha::SearchEngine::Elasticsearch::AUTHORITIES_INDEX, $delete) if ($index_authorities); |
144 |
|
167 |
|
145 |
- |
|
|