d8e17478f8
* Add flags for torrents Add a new field, .Language, to the Torrent model, and a new package, torrentLanguages, which maps languages to flags. Added also a flag icon pack from googlei18n/region-flags, with (mostly) public domain flags from Wikipedia. * Optimize flags * Use FlagSprites CSS instead of .png files * Only use flags for languages we support * Add test for CSS flags Ensure that we have all the flags for the languages we support. * Add AdditionalLanguages field to config This allows us to support additional languages for new uploaded torrents, even if we have no translation for it. * Minor CSS fix * Add "other" and "multiple" torrent languages Also removed the TorrentLanguage struct, as it wasn't much useful. * Fix test * Add colspan=2 to category when language is empty Also hide the language column if empty. * Add lang field to search. Hopefully it works with Elasticsearch as well, but I haven't tested (lol Java) * Add language field to ES index and settings * Add language column to JS template * Add keyword type to language ES field * Remove 'raw' from keyword * Set "simple" analyzer on language * Document .Language field on Torrent model
77 lignes
1,5 Kio
YAML
77 lignes
1,5 Kio
YAML
---
|
|
settings:
|
|
analysis:
|
|
analyzer:
|
|
# Don't use ngram for search otherwise 'horribleexample' would match
|
|
# 'horriblesubs'
|
|
nyaapantsu_search_analyzer:
|
|
tokenizer: standard
|
|
filter:
|
|
- standard
|
|
- lowercase
|
|
char_filter:
|
|
- dash_to_underscore
|
|
|
|
nyaapantsu_index_analyzer:
|
|
tokenizer: standard
|
|
filter:
|
|
- standard
|
|
- lowercase
|
|
- e_ngram_filter
|
|
char_filter:
|
|
- dash_to_underscore
|
|
|
|
filter:
|
|
e_ngram_filter:
|
|
type: edge_ngram
|
|
min_gram: 1
|
|
max_gram: 16
|
|
|
|
char_filter:
|
|
dash_to_underscore:
|
|
type: pattern_replace
|
|
pattern: "([^\\s]+)-(?=[^\\s]+)"
|
|
replacement: "$1_"
|
|
|
|
index:
|
|
number_of_shards: 1
|
|
number_of_replicas: 0
|
|
max_result_window: 30000
|
|
|
|
mappings:
|
|
torrents:
|
|
properties:
|
|
# TODO Consistent ID's type in TorrentJSON
|
|
id:
|
|
type: long
|
|
name:
|
|
type: text
|
|
analyzer: nyaapantsu_index_analyzer
|
|
fields:
|
|
raw:
|
|
type: keyword
|
|
category:
|
|
type: text
|
|
sub_category:
|
|
type: text
|
|
status:
|
|
type: long
|
|
hash:
|
|
type: text
|
|
date:
|
|
type: date
|
|
uploader_id:
|
|
type: long
|
|
downloads:
|
|
type: long
|
|
seeders:
|
|
type: long
|
|
leechers:
|
|
type: long
|
|
completed:
|
|
type: long
|
|
filesize:
|
|
type: long
|
|
language:
|
|
type: text
|
|
analyzer: simple
|