diff --git a/config/search.go b/config/search.go index 7c180f68..29c0c696 100644 --- a/config/search.go +++ b/config/search.go @@ -10,7 +10,7 @@ var DefaultSearchConfig = SearchConfig{} const ( // DefaultElasticsearchAnalyzer : default analyzer for ES - DefaultElasticsearchAnalyzer = "nyaapantsu_analyzer" + DefaultElasticsearchAnalyzer = "nyaapantsu_search_analyzer" // DefaultElasticsearchIndex : default search index for ES DefaultElasticsearchIndex = "nyaapantsu" // DefaultElasticsearchType : Name of the type in the es mapping diff --git a/deploy/ansible/group_vars/all b/deploy/ansible/group_vars/all index e50c99bc..1082305d 100644 --- a/deploy/ansible/group_vars/all +++ b/deploy/ansible/group_vars/all @@ -5,4 +5,5 @@ nyaapantsu_pgpool_port: 9998 nyaapantsu_directory: /nyaapantsu/ nyaapantsu_gpg_passphrase_file: "{{ nyaapantsu_directory }}/passphrase" nyaapantsu_elasticsearch_index: nyaapantsu +nyaapantsu_build_directory: go_nyaa/ # vim: ft=yaml diff --git a/deploy/ansible/install_nyaa.yml b/deploy/ansible/install_nyaa.yml new file mode 100644 index 00000000..31126903 --- /dev/null +++ b/deploy/ansible/install_nyaa.yml @@ -0,0 +1,7 @@ +# Should only be used for the dev machine until we get a nice setup to install +# both sukebei AND nyaa. +- name: Install nyaa + hosts: webservers + roles: + - nyaapantsu + diff --git a/deploy/ansible/roles/elasticsearch/files/elasticsearch_settings.yml b/deploy/ansible/roles/elasticsearch/files/elasticsearch_settings.yml index bcee849c..96cded7f 100644 --- a/deploy/ansible/roles/elasticsearch/files/elasticsearch_settings.yml +++ b/deploy/ansible/roles/elasticsearch/files/elasticsearch_settings.yml @@ -2,19 +2,41 @@ settings: analysis: analyzer: - nyaapantsu_analyzer: - tokenizer: nyaapantsu_tokenizer + nyaapantsu_search_analyzer: + type: custom + tokenizer: standard + char_filter: + - my_char_filter filter: - standard - lowercase - tokenizer: - nyaapantsu_tokenizer: - type: edge_ngram + nyaapantsu_index_analyzer: + type: custom + tokenizer: standard + char_filter: + - my_char_filter + filter: + - resolution + - lowercase + - my_ngram + - word_delimit + filter: + my_ngram: + type: edgeNGram min_gram: 2 max_gram: 15 - token_chars: - - letter - - digit + resolution: + type: pattern_capture + patterns: ["(\\d+)[xX](\\d+)"] + word_delimit: + type: word_delimiter + preserve_original: true + split_on_numerics: false + char_filter: + my_char_filter: + type: mapping + mappings: ["-=>_", "!=>_", "_=>\\u0020"] + index: number_of_shards: 1 number_of_replicas: 0 @@ -27,7 +49,7 @@ mappings: type: long name: type: text - analyzer: nyaapantsu_analyzer + analyzer: nyaapantsu_index_analyzer fielddata: true # Use to sort by id because it is currently a text field category: type: text diff --git a/deploy/ansible/roles/nyaapantsu/tasks/main.yml b/deploy/ansible/roles/nyaapantsu/tasks/main.yml new file mode 100644 index 00000000..abcf5c46 --- /dev/null +++ b/deploy/ansible/roles/nyaapantsu/tasks/main.yml @@ -0,0 +1,18 @@ +- name: Make directory + file: + state: directory + path: "{{ nyaapantsu_build_directory }}/src/github.com/NyaaPantsu" + +# TODO ability to get specify commit +- name: Get latest nyaa + git: + repo: 'https://github.com/NyaaPantsu/nyaa' + dest: "{{ nyaapantsu_build_directory }}/src/github.com/NyaaPantsu/nyaa" + +# Assumes the GOPATH variable has been set +- name: Go build + shell: go build + args: + chdir: "{{ nyaapantsu_build_directory }}/src/github.com/NyaaPantsu/nyaa" + environment: + GOPATH: "/home/{{ ansible_ssh_user }}/{{ nyaapantsu_build_directory }}"