Skip to content

Commit 76e879d

Browse files
authored
Merge pull request #1215 from metacpan/haarg/no-ratings
remove code for CPANRatings
2 parents 6d57ca5 + e634012 commit 76e879d

File tree

13 files changed

+104
-397
lines changed

13 files changed

+104
-397
lines changed

.gitignore

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# carton/local::lib
2-
# coverage
3-
# generated by Makefile.PL (for instance when doing `cpanm --installdeps .`)
4-
# tidyall
51
*.komodoproject
62
*.kpf
73
*.sqlite*
@@ -12,14 +8,14 @@
128
/Makefile
139
/Makefile.old
1410
/blib
11+
/cover_db/
1512
/etc/metacpan_local.pl
13+
/local/
14+
/log4perl_local.conf
15+
/metacpan_server_local.conf
16+
/perltidy.LOG
1617
/pm_to_blib
1718
/t/var/darkpan/
1819
/t/var/log/
1920
/t/var/tmp/
2021
/var
21-
cover_db/
22-
local/
23-
log4perl_local.conf
24-
metacpan_server_local.conf
25-
perltidy.LOG

docs/API-docs.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ Available fields can be found by accessing the corresponding `_mapping` endpoint
3232
* [`/favorite/_mapping`](https://fastapi.metacpan.org/v1/favorite/_mapping) - [explore](https://explorer.metacpan.org/?url=/favorite/_mapping)
3333
* [`/file/_mapping`](https://fastapi.metacpan.org/v1/file/_mapping) - [explore](https://explorer.metacpan.org/?url=/file/_mapping)
3434
* [`/module/_mapping`](https://fastapi.metacpan.org/v1/module/_mapping) - [explore](https://explorer.metacpan.org/?url=/module/_mapping)
35-
* [`/rating/_mapping`](https://fastapi.metacpan.org/v1/rating/_mapping) - [explore](https://explorer.metacpan.org/?url=/rating/_mapping)
3635
* [`/release/_mapping`](https://fastapi.metacpan.org/v1/release/_mapping) - [explore](https://explorer.metacpan.org/?url=/release/_mapping)
3736

3837

@@ -48,7 +47,6 @@ Performing a search without any constraints is an easy way to get sample data
4847
* [`/distribution/_search`](https://fastapi.metacpan.org/v1/distribution/_search)
4948
* [`/favorite/_search`](https://fastapi.metacpan.org/v1/favorite/_search)
5049
* [`/file/_search`](https://fastapi.metacpan.org/v1/file/_search)
51-
* [`/rating/_search`](https://fastapi.metacpan.org/v1/rating/_search)
5250
* [`/release/_search`](https://fastapi.metacpan.org/v1/release/_search)
5351

5452
## JSONP

lib/MetaCPAN/Document/Rating.pm

Lines changed: 0 additions & 54 deletions
This file was deleted.

lib/MetaCPAN/Document/Rating/Set.pm

Lines changed: 0 additions & 26 deletions
This file was deleted.

lib/MetaCPAN/Query/Rating.pm

Lines changed: 0 additions & 46 deletions
This file was deleted.

lib/MetaCPAN/Script/Mapping.pm

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use MetaCPAN::Script::Mapping::CPAN::File ();
1212
use MetaCPAN::Script::Mapping::CPAN::Mirror ();
1313
use MetaCPAN::Script::Mapping::CPAN::Permission ();
1414
use MetaCPAN::Script::Mapping::CPAN::Package ();
15-
use MetaCPAN::Script::Mapping::CPAN::Rating ();
1615
use MetaCPAN::Script::Mapping::CPAN::Release ();
1716
use MetaCPAN::Script::Mapping::DeployStatement ();
1817
use MetaCPAN::Script::Mapping::User::Account ();
@@ -511,8 +510,6 @@ sub _build_mapping {
511510
MetaCPAN::Script::Mapping::CPAN::Permission::mapping),
512511
package => decode_json(
513512
MetaCPAN::Script::Mapping::CPAN::Package::mapping),
514-
rating =>
515-
decode_json(MetaCPAN::Script::Mapping::CPAN::Rating::mapping),
516513
release => decode_json(
517514
MetaCPAN::Script::Mapping::CPAN::Release::mapping),
518515
},

lib/MetaCPAN/Script/Mapping/CPAN/Rating.pm

Lines changed: 0 additions & 64 deletions
This file was deleted.

lib/MetaCPAN/Script/Purge.pm

Lines changed: 0 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ sub _build_bulk {
4747
file => $self->es->bulk_helper( index => $index, type => 'file' ),
4848
permission =>
4949
$self->es->bulk_helper( index => $index, type => 'permission' ),
50-
rating => $self->es->bulk_helper( index => $index, type => 'rating' ),
5150
release =>
5251
$self->es->bulk_helper( index => $index, type => 'release' ),
5352
};
@@ -65,17 +64,6 @@ sub _get_scroller_release {
6564
);
6665
}
6766

68-
sub _get_scroller_rating {
69-
my ( $self, $query ) = @_;
70-
return $self->es->scroll_helper(
71-
size => 500,
72-
scroll => '10m',
73-
index => $self->index->name,
74-
type => 'rating',
75-
body => { query => $query },
76-
);
77-
}
78-
7967
sub _get_scroller_file {
8068
my ( $self, $query ) = @_;
8169
return $self->es->scroll_helper(
@@ -132,7 +120,6 @@ sub run {
132120
}
133121
$self->purge_author_releases;
134122
$self->purge_favorite;
135-
$self->purge_rating;
136123
if ( !$self->release ) {
137124
$self->purge_author;
138125
$self->purge_contributor;
@@ -330,87 +317,6 @@ sub purge_contributor {
330317
};
331318
}
332319

333-
sub purge_rating {
334-
my $self = shift;
335-
336-
if ( $self->release ) {
337-
$self->purge_rating_release;
338-
}
339-
else {
340-
$self->purge_rating_author;
341-
}
342-
}
343-
344-
sub purge_rating_release {
345-
my $self = shift;
346-
log_info {
347-
'Looking all up ratings for release '
348-
. $self->release
349-
. ' author '
350-
. $self->author
351-
};
352-
353-
my @remove;
354-
355-
my $query = {
356-
bool => {
357-
must => [
358-
{ term => { author => $self->author } },
359-
{ term => { release => $self->release } }
360-
]
361-
}
362-
};
363-
364-
my $scroll_rating = $self->_get_scroller_rating($query);
365-
366-
while ( my $r = $scroll_rating->next ) {
367-
log_debug {
368-
'Removing ratings for release '
369-
. $self->release
370-
. ' by author '
371-
. $self->author
372-
};
373-
push @remove, $r->{_id};
374-
}
375-
376-
if (@remove) {
377-
$self->bulk->{rating}->delete_ids(@remove);
378-
$self->bulk->{rating}->flush;
379-
}
380-
381-
log_info {
382-
'Finished purging rating entries for release '
383-
. $self->release
384-
. ' by author '
385-
. $self->author
386-
};
387-
}
388-
389-
sub purge_rating_author {
390-
my $self = shift;
391-
log_info { 'Looking all up ratings for author ' . $self->author };
392-
393-
my @remove;
394-
395-
my $query = { term => { author => $self->author } };
396-
397-
my $scroll_rating = $self->_get_scroller_rating($query);
398-
399-
while ( my $r = $scroll_rating->next ) {
400-
log_debug { 'Removing ratings related to author ' . $self->author };
401-
push @remove, $r->{_id};
402-
}
403-
404-
if (@remove) {
405-
$self->bulk->{rating}->delete_ids(@remove);
406-
$self->bulk->{rating}->flush;
407-
}
408-
409-
log_info {
410-
'Finished purging rating entries related to author ' . $self->author
411-
};
412-
}
413-
414320
__PACKAGE__->meta->make_immutable;
415321
1;
416322

0 commit comments

Comments
 (0)