summaryrefslogtreecommitdiff
path: root/lib/VNDB
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2021-11-19 16:25:16 +0100
committerYorhel <git@yorhel.nl>2021-11-19 16:25:16 +0100
commit0ea2fb67930af01fe5f4484615e129a13bd8649b (patch)
tree67a209fb8841e343a4c7dc47424325c0f7e406ba /lib/VNDB
parent0a98d9df12cfc6ea73729b0b3feb3fee52c9f336 (diff)
Use new search for VNs; remove search cache updating from Multi
Diffstat (limited to 'lib/VNDB')
-rw-r--r--lib/VNDB/Func.pm52
1 files changed, 0 insertions, 52 deletions
diff --git a/lib/VNDB/Func.pm b/lib/VNDB/Func.pm
index 800c37a5..d5692a38 100644
--- a/lib/VNDB/Func.pm
+++ b/lib/VNDB/Func.pm
@@ -5,8 +5,6 @@ use warnings;
use TUWF::Misc 'uri_escape';
use Exporter 'import';
use POSIX 'strftime';
-use Encode 'encode_utf8';
-use Unicode::Normalize 'NFKD', 'compose';
use Socket 'inet_pton', 'inet_ntop', 'AF_INET', 'AF_INET6';
use VNDB::Config;
use VNDB::Types;
@@ -17,7 +15,6 @@ our @EXPORT = ('bb_format', qw|
shorten
resolution
gtintype
- normalize_titles normalize_query
imgsize
norm_ip
minage
@@ -93,55 +90,6 @@ sub gtintype {
}
-# a rather aggressive normalization
-sub normalize {
- local $_ = lc shift;
- use utf8;
- # Remove combining markings, except for kana.
- # This effectively removes all accents from the characters (e.g. é -> e)
- $_ = compose(NFKD($_) =~ s/(?<=[^ア-ンあ-ん])\pM//rg);
- # remove some characters that have no significance when searching
- tr/\r\n\t,_\-.~~〜∼ー῀:[]()%+!?#$"'`♥★☆♪†「」『』【】・‟“”‛’‘‚„«‹»›//d;
- tr/@/a/;
- tr/ı/i/; # Turkish lowercase i
- tr/×/x/;
- s/&/and/;
- # Remove spaces. We're doing substring search, so let it cross word boundary to find more stuff
- tr/ //d;
- # remove commonly used release titles ("x Edition" and "x Version")
- # this saves some space and speeds up the search
- s/(?:
- first|firstpress|firstpresslimited|limited|regular|standard
- |package|boxed|download|complete|popular
- |lowprice|best|cheap|budget
- |special|trial|allages|fullvoice
- |cd|cdr|cdrom|dvdrom|dvd|dvdpack|dvdpg|windows
- |初回限定|初回|限定|通常|廉価|パッケージ|ダウンロード
- )(?:edition|version|版|生産)//xg;
- # other common things
- s/fandisk/fandisc/g;
- s/sempai/senpai/g;
- no utf8;
- return $_;
-}
-
-
-# normalizes each title and returns a concatenated string of unique titles
-sub normalize_titles {
- my %t = map +(normalize($_), 1), @_;
- return join ' ', grep length $_, sort keys %t;
-}
-
-
-sub normalize_query {
- my $q = shift;
- # remove spaces within quotes, so that it's considered as one search word
- $q =~ s/"([^"]+)"/(my $s=$1)=~y{ }{}d;$s/ge;
- # split into search words and normalize
- return map quotemeta($_), grep length $_, map normalize($_), split / /, $q;
-}
-
-
# arguments: <image size>, <max dimensions>
# returns the size of the thumbnail with the same aspect ratio as the full-size
# image, but fits within the specified maximum dimensions