diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 00000000..72d2ffd0
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Cargo.lock b/Cargo.lock
index 33e88a2c..c674092b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -34,6 +34,26 @@ dependencies = [
"trust-dns-resolver",
]
+[[package]]
+name = "actix-files"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "301482841d3d74483a446ead63cb7d362e187d2c8b603f13d91995621ea53c46"
+dependencies = [
+ "actix-http",
+ "actix-service",
+ "actix-web",
+ "bitflags",
+ "bytes",
+ "derive_more",
+ "futures",
+ "log",
+ "mime",
+ "mime_guess",
+ "percent-encoding",
+ "v_htmlescape",
+]
+
[[package]]
name = "actix-http"
version = "1.0.1"
@@ -71,7 +91,7 @@ dependencies = [
"mime",
"percent-encoding",
"pin-project",
- "rand 0.7.3",
+ "rand",
"regex",
"serde",
"serde_json",
@@ -291,23 +311,6 @@ dependencies = [
"syn",
]
-[[package]]
-name = "atomicwrites"
-version = "0.2.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a2baf2feb820299c53c7ad1cc4f5914a220a1cb76d7ce321d2522a94b54651f"
-dependencies = [
- "nix",
- "tempdir",
- "winapi 0.3.8",
-]
-
-[[package]]
-name = "autocfg"
-version = "0.1.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
-
[[package]]
name = "autocfg"
version = "1.0.0"
@@ -331,7 +334,7 @@ dependencies = [
"log",
"mime",
"percent-encoding",
- "rand 0.7.3",
+ "rand",
"serde",
"serde_json",
"serde_urlencoded",
@@ -371,15 +374,6 @@ version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
-[[package]]
-name = "bitpacking"
-version = "0.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3744aff20a3437a99ebc0bb7733e9e60c7bf590478c9b897e95b38d57e5acb68"
-dependencies = [
- "crunchy",
-]
-
[[package]]
name = "block-buffer"
version = "0.7.3"
@@ -454,12 +448,6 @@ version = "1.0.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3d87b23d6a92cd03af510a5ade527033f6aa6fa92161e2d5863a907d4c5e31d"
-[[package]]
-name = "census"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5927edd8345aef08578bcbb4aea7314f340d80c7f4931f99fbeb40b99d8f5060"
-
[[package]]
name = "cfg-if"
version = "0.1.10"
@@ -486,16 +474,6 @@ dependencies = [
"bitflags",
]
-[[package]]
-name = "combine"
-version = "4.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9d79eb8c0bfd05a68f8b6195b27c4f2e042f86d52da032817f89a3847e0495ed"
-dependencies = [
- "bytes",
- "memchr",
-]
-
[[package]]
name = "copyless"
version = "0.1.4"
@@ -511,83 +489,6 @@ dependencies = [
"cfg-if",
]
-[[package]]
-name = "crossbeam"
-version = "0.7.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "69323bff1fb41c635347b8ead484a5ca6c3f11914d784170b158d8449ab07f8e"
-dependencies = [
- "cfg-if",
- "crossbeam-channel",
- "crossbeam-deque",
- "crossbeam-epoch",
- "crossbeam-queue",
- "crossbeam-utils",
-]
-
-[[package]]
-name = "crossbeam-channel"
-version = "0.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cced8691919c02aac3cb0a1bc2e9b73d89e832bf9a06fc579d4e71b68a2da061"
-dependencies = [
- "crossbeam-utils",
- "maybe-uninit",
-]
-
-[[package]]
-name = "crossbeam-deque"
-version = "0.7.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285"
-dependencies = [
- "crossbeam-epoch",
- "crossbeam-utils",
- "maybe-uninit",
-]
-
-[[package]]
-name = "crossbeam-epoch"
-version = "0.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
-dependencies = [
- "autocfg 1.0.0",
- "cfg-if",
- "crossbeam-utils",
- "lazy_static",
- "maybe-uninit",
- "memoffset",
- "scopeguard",
-]
-
-[[package]]
-name = "crossbeam-queue"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c695eeca1e7173472a32221542ae469b3e9aac3a4fc81f7696bcad82029493db"
-dependencies = [
- "cfg-if",
- "crossbeam-utils",
-]
-
-[[package]]
-name = "crossbeam-utils"
-version = "0.7.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
-dependencies = [
- "autocfg 1.0.0",
- "cfg-if",
- "lazy_static",
-]
-
-[[package]]
-name = "crunchy"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
-
[[package]]
name = "derive_more"
version = "0.99.5"
@@ -608,12 +509,6 @@ dependencies = [
"generic-array",
]
-[[package]]
-name = "downcast-rs"
-version = "1.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "52ba6eb47c2131e784a38b726eb54c1e1484904f013e576a25354d0124161af6"
-
[[package]]
name = "dtoa"
version = "0.4.5"
@@ -651,25 +546,14 @@ dependencies = [
name = "fabricate"
version = "0.1.0"
dependencies = [
+ "actix-files",
"actix-rt",
"actix-web",
"handlebars",
+ "meilisearch-sdk",
"serde",
"serde_derive",
"serde_json",
- "tantivy",
- "tempdir",
-]
-
-[[package]]
-name = "fail"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f63eec71a3013ee912a0ecb339ff0c5fa5ed9660df04bfefa10c250b885d018c"
-dependencies = [
- "lazy_static",
- "log",
- "rand 0.6.5",
]
[[package]]
@@ -700,18 +584,6 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
-[[package]]
-name = "filetime"
-version = "0.2.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "affc17579b132fc2461adf7c575cc6e8b134ebca52c51f5411388965227dc695"
-dependencies = [
- "cfg-if",
- "libc",
- "redox_syscall",
- "winapi 0.3.8",
-]
-
[[package]]
name = "flate2"
version = "1.0.14"
@@ -730,50 +602,6 @@ version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
-[[package]]
-name = "fs2"
-version = "0.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213"
-dependencies = [
- "libc",
- "winapi 0.3.8",
-]
-
-[[package]]
-name = "fsevent"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6"
-dependencies = [
- "bitflags",
- "fsevent-sys",
-]
-
-[[package]]
-name = "fsevent-sys"
-version = "2.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "fst"
-version = "0.3.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "927fb434ff9f0115b215dc0efd2e4fbdd7448522a92a1aa37c77d6a2f8f1ebd6"
-dependencies = [
- "byteorder",
-]
-
-[[package]]
-name = "fuchsia-cprng"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
-
[[package]]
name = "fuchsia-zircon"
version = "0.3.3"
@@ -830,7 +658,6 @@ dependencies = [
"futures-core",
"futures-task",
"futures-util",
- "num_cpus",
]
[[package]]
@@ -974,12 +801,6 @@ dependencies = [
"winapi 0.3.8",
]
-[[package]]
-name = "htmlescape"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e9025058dae765dee5070ec375f591e2ba14638c63feff74f13805a72e523163"
-
[[package]]
name = "http"
version = "0.2.1"
@@ -1014,27 +835,7 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292"
dependencies = [
- "autocfg 1.0.0",
-]
-
-[[package]]
-name = "inotify"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "24e40d6fd5d64e2082e0c796495c8ef5ad667a96d03e5aaa0becfd9d47bcbfb8"
-dependencies = [
- "bitflags",
- "inotify-sys",
- "libc",
-]
-
-[[package]]
-name = "inotify-sys"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e74a1aa87c59aeff6ef2cc2fa62d41bc43f54952f55652656b18a02fd5e356c0"
-dependencies = [
- "libc",
+ "autocfg",
]
[[package]]
@@ -1058,15 +859,6 @@ dependencies = [
"winreg",
]
-[[package]]
-name = "itertools"
-version = "0.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484"
-dependencies = [
- "either",
-]
-
[[package]]
name = "itoa"
version = "0.4.5"
@@ -1095,21 +887,6 @@ version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
-[[package]]
-name = "lazycell"
-version = "1.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
-
-[[package]]
-name = "levenshtein_automata"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "73a004f877f468548d8d0ac4977456a249d8fabbdb8416c36db163dfc8f2e8ca"
-dependencies = [
- "fst",
-]
-
[[package]]
name = "libc"
version = "0.2.69"
@@ -1168,10 +945,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
[[package]]
-name = "maybe-uninit"
-version = "2.0.0"
+name = "meilisearch-sdk"
+version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
+checksum = "6873f8f9b90d8d451bf6e8af732ee1536a5fb69488eeef7fee4eda79ea0369fe"
+dependencies = [
+ "log",
+ "minreq",
+ "serde",
+ "serde_json",
+ "urlencoding",
+]
[[package]]
name = "memchr"
@@ -1179,31 +963,22 @@ version = "2.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
-[[package]]
-name = "memmap"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b"
-dependencies = [
- "libc",
- "winapi 0.3.8",
-]
-
-[[package]]
-name = "memoffset"
-version = "0.5.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b4fc2c02a7e374099d4ee95a193111f72d2110197fe200272371758f6c3643d8"
-dependencies = [
- "autocfg 1.0.0",
-]
-
[[package]]
name = "mime"
version = "0.3.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
+[[package]]
+name = "mime_guess"
+version = "2.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212"
+dependencies = [
+ "mime",
+ "unicase",
+]
+
[[package]]
name = "miniz_oxide"
version = "0.3.6"
@@ -1213,6 +988,12 @@ dependencies = [
"adler32",
]
+[[package]]
+name = "minreq"
+version = "2.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "11e4ea61052e3c3cced75e02c69d0a360e4a50149fab6ada11258756037d45a4"
+
[[package]]
name = "mio"
version = "0.6.22"
@@ -1232,18 +1013,6 @@ dependencies = [
"winapi 0.2.8",
]
-[[package]]
-name = "mio-extras"
-version = "2.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19"
-dependencies = [
- "lazycell",
- "log",
- "mio",
- "slab",
-]
-
[[package]]
name = "mio-uds"
version = "0.6.8"
@@ -1267,15 +1036,6 @@ dependencies = [
"ws2_32-sys",
]
-[[package]]
-name = "murmurhash32"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d736ff882f0e85fe9689fb23db229616c4c00aee2b3ac282f666d8f20eb25d4a"
-dependencies = [
- "byteorder",
-]
-
[[package]]
name = "net2"
version = "0.2.34"
@@ -1288,34 +1048,13 @@ dependencies = [
]
[[package]]
-name = "nix"
-version = "0.14.1"
+name = "nom"
+version = "4.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce"
+checksum = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6"
dependencies = [
- "bitflags",
- "cc",
- "cfg-if",
- "libc",
- "void",
-]
-
-[[package]]
-name = "notify"
-version = "4.0.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "80ae4a7688d1fab81c5bf19c64fc8db920be8d519ce6336ed4e7efe024724dbd"
-dependencies = [
- "bitflags",
- "filetime",
- "fsevent",
- "fsevent-sys",
- "inotify",
- "libc",
- "mio",
- "mio-extras",
- "walkdir",
- "winapi 0.3.8",
+ "memchr",
+ "version_check 0.1.5",
]
[[package]]
@@ -1324,7 +1063,7 @@ version = "0.1.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba"
dependencies = [
- "autocfg 1.0.0",
+ "autocfg",
"num-traits",
]
@@ -1334,7 +1073,7 @@ version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
dependencies = [
- "autocfg 1.0.0",
+ "autocfg",
]
[[package]]
@@ -1347,36 +1086,12 @@ dependencies = [
"libc",
]
-[[package]]
-name = "once_cell"
-version = "1.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1c601810575c99596d4afc46f78a678c80105117c379eb3650cf99b8a21ce5b"
-
[[package]]
name = "opaque-debug"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
-[[package]]
-name = "owned-read"
-version = "0.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b66d1e235abcebc845cf93550b89b74f468c051496fafb433ede4104b9f71ba1"
-dependencies = [
- "stable_deref_trait",
-]
-
-[[package]]
-name = "owning_ref"
-version = "0.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce"
-dependencies = [
- "stable_deref_trait",
-]
-
[[package]]
name = "parking_lot"
version = "0.10.2"
@@ -1524,38 +1239,6 @@ dependencies = [
"proc-macro2",
]
-[[package]]
-name = "rand"
-version = "0.4.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
-dependencies = [
- "fuchsia-cprng",
- "libc",
- "rand_core 0.3.1",
- "rdrand",
- "winapi 0.3.8",
-]
-
-[[package]]
-name = "rand"
-version = "0.6.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
-dependencies = [
- "autocfg 0.1.7",
- "libc",
- "rand_chacha 0.1.1",
- "rand_core 0.4.2",
- "rand_hc 0.1.0",
- "rand_isaac",
- "rand_jitter",
- "rand_os",
- "rand_pcg",
- "rand_xorshift",
- "winapi 0.3.8",
-]
-
[[package]]
name = "rand"
version = "0.7.3"
@@ -1564,19 +1247,9 @@ checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
dependencies = [
"getrandom",
"libc",
- "rand_chacha 0.2.2",
- "rand_core 0.5.1",
- "rand_hc 0.2.0",
-]
-
-[[package]]
-name = "rand_chacha"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
-dependencies = [
- "autocfg 0.1.7",
- "rand_core 0.3.1",
+ "rand_chacha",
+ "rand_core",
+ "rand_hc",
]
[[package]]
@@ -1586,24 +1259,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
dependencies = [
"ppv-lite86",
- "rand_core 0.5.1",
+ "rand_core",
]
-[[package]]
-name = "rand_core"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
-dependencies = [
- "rand_core 0.4.2",
-]
-
-[[package]]
-name = "rand_core"
-version = "0.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
-
[[package]]
name = "rand_core"
version = "0.5.1"
@@ -1613,108 +1271,13 @@ dependencies = [
"getrandom",
]
-[[package]]
-name = "rand_hc"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"
-dependencies = [
- "rand_core 0.3.1",
-]
-
[[package]]
name = "rand_hc"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
dependencies = [
- "rand_core 0.5.1",
-]
-
-[[package]]
-name = "rand_isaac"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08"
-dependencies = [
- "rand_core 0.3.1",
-]
-
-[[package]]
-name = "rand_jitter"
-version = "0.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b"
-dependencies = [
- "libc",
- "rand_core 0.4.2",
- "winapi 0.3.8",
-]
-
-[[package]]
-name = "rand_os"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071"
-dependencies = [
- "cloudabi",
- "fuchsia-cprng",
- "libc",
- "rand_core 0.4.2",
- "rdrand",
- "winapi 0.3.8",
-]
-
-[[package]]
-name = "rand_pcg"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44"
-dependencies = [
- "autocfg 0.1.7",
- "rand_core 0.4.2",
-]
-
-[[package]]
-name = "rand_xorshift"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c"
-dependencies = [
- "rand_core 0.3.1",
-]
-
-[[package]]
-name = "rayon"
-version = "1.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "db6ce3297f9c85e16621bb8cca38a06779ffc31bb8184e1be4bed2be4678a098"
-dependencies = [
- "crossbeam-deque",
- "either",
- "rayon-core",
-]
-
-[[package]]
-name = "rayon-core"
-version = "1.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "08a89b46efaf957e52b18062fb2f4660f8b8a4dde1807ca002690868ef2c85a9"
-dependencies = [
- "crossbeam-deque",
- "crossbeam-queue",
- "crossbeam-utils",
- "lazy_static",
- "num_cpus",
-]
-
-[[package]]
-name = "rdrand"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
-dependencies = [
- "rand_core 0.3.1",
+ "rand_core",
]
[[package]]
@@ -1731,31 +1294,16 @@ checksum = "a6020f034922e3194c711b82a627453881bc4682166cabb07134a10c26ba7692"
dependencies = [
"aho-corasick",
"memchr",
- "regex-syntax 0.6.17",
+ "regex-syntax",
"thread_local",
]
-[[package]]
-name = "regex-syntax"
-version = "0.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e931c58b93d86f080c734bfd2bce7dd0079ae2331235818133c8be7f422e20e"
-
[[package]]
name = "regex-syntax"
version = "0.6.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae"
-[[package]]
-name = "remove_dir_all"
-version = "0.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e"
-dependencies = [
- "winapi 0.3.8",
-]
-
[[package]]
name = "resolv-conf"
version = "0.6.3"
@@ -1766,16 +1314,6 @@ dependencies = [
"quick-error",
]
-[[package]]
-name = "rust-stemmers"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e46a2036019fdb888131db7a4c847a1063a7493f971ed94ea82c67eada63ca54"
-dependencies = [
- "serde",
- "serde_derive",
-]
-
[[package]]
name = "rustc-demangle"
version = "0.1.16"
@@ -1886,12 +1424,6 @@ version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4"
-[[package]]
-name = "snap"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f7fb9b0bb877b35a1cc1474a3b43d9c226a2625311760cdda2cbccbc0c7a8376"
-
[[package]]
name = "socket2"
version = "0.3.12"
@@ -1904,12 +1436,6 @@ dependencies = [
"winapi 0.3.8",
]
-[[package]]
-name = "stable_deref_trait"
-version = "1.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
-
[[package]]
name = "syn"
version = "1.0.18"
@@ -1933,98 +1459,6 @@ dependencies = [
"unicode-xid",
]
-[[package]]
-name = "tantivy"
-version = "0.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "02e1d2fbfa82ab829208e5f03f4d2c177b8a126252ab4f80ed232e1064770efb"
-dependencies = [
- "atomicwrites",
- "base64",
- "bitpacking",
- "byteorder",
- "census",
- "chrono",
- "crc32fast",
- "crossbeam",
- "downcast-rs",
- "fail",
- "failure",
- "fnv",
- "fs2",
- "futures",
- "htmlescape",
- "itertools",
- "levenshtein_automata",
- "log",
- "memmap",
- "murmurhash32",
- "notify",
- "num_cpus",
- "once_cell",
- "owned-read",
- "owning_ref",
- "rayon",
- "regex",
- "rust-stemmers",
- "serde",
- "serde_derive",
- "serde_json",
- "smallvec",
- "snap",
- "stable_deref_trait",
- "tantivy-fst",
- "tantivy-query-grammar",
- "tempfile",
- "uuid",
- "winapi 0.3.8",
-]
-
-[[package]]
-name = "tantivy-fst"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38878efb477cf2efb7d9112b12b230c27d32abdfec4bea5e66095733f2928610"
-dependencies = [
- "byteorder",
- "levenshtein_automata",
- "regex-syntax 0.4.2",
- "utf8-ranges",
-]
-
-[[package]]
-name = "tantivy-query-grammar"
-version = "0.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "900f098da37d350b0e8f116791b9ee43e600704cb6b5cc83b7f826d1b119f21c"
-dependencies = [
- "combine",
-]
-
-[[package]]
-name = "tempdir"
-version = "0.3.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
-dependencies = [
- "rand 0.4.6",
- "remove_dir_all",
-]
-
-[[package]]
-name = "tempfile"
-version = "3.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
-dependencies = [
- "cfg-if",
- "libc",
- "rand 0.7.3",
- "redox_syscall",
- "remove_dir_all",
- "winapi 0.3.8",
-]
-
[[package]]
name = "thread_local"
version = "1.0.1"
@@ -2115,7 +1549,7 @@ dependencies = [
"idna",
"lazy_static",
"log",
- "rand 0.7.3",
+ "rand",
"smallvec",
"socket2",
"tokio",
@@ -2153,6 +1587,15 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
+[[package]]
+name = "unicase"
+version = "2.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
+dependencies = [
+ "version_check 0.9.1",
+]
+
[[package]]
name = "unicode-bidi"
version = "0.3.4"
@@ -2195,26 +1638,53 @@ dependencies = [
]
[[package]]
-name = "utf8-ranges"
-version = "1.0.4"
+name = "urlencoding"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba"
+checksum = "3df3561629a8bb4c57e5a2e4c43348d9e29c7c29d9b1c4c1f47166deca8f37ed"
[[package]]
-name = "uuid"
-version = "0.8.1"
+name = "v_escape"
+version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9fde2f6a4bea1d6e007c4ad38c6839fa71cbb63b6dbf5b595aa38dc9b1093c11"
+checksum = "660b101c07b5d0863deb9e7fb3138777e858d6d2a79f9e6049a27d1cc77c6da6"
dependencies = [
- "rand 0.7.3",
- "serde",
+ "v_escape_derive",
]
[[package]]
-name = "void"
-version = "1.0.2"
+name = "v_escape_derive"
+version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
+checksum = "c2ca2a14bc3fc5b64d188b087a7d3a927df87b152e941ccfbc66672e20c467ae"
+dependencies = [
+ "nom",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "v_htmlescape"
+version = "0.4.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e33e939c0d8cf047514fb6ba7d5aac78bc56677a6938b2ee67000b91f2e97e41"
+dependencies = [
+ "cfg-if",
+ "v_escape",
+]
+
+[[package]]
+name = "version_check"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
+
+[[package]]
+name = "version_check"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce"
[[package]]
name = "walkdir"
diff --git a/Cargo.toml b/Cargo.toml
index 2844a81c..473513ee 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,6 @@ actix-rt = "1.1.1"
handlebars = { version = "3.0.0", features = ["dir_source"] }
serde_json = "1.0"
serde_derive = "1.0.107"
-serde = "1.0.107"
-tantivy = "0.12.0"
-tempdir = "0.3.7"
-
+serde = {version="1.0", features=["derive"]}
+meilisearch-sdk = "0.1.1"
+actix-files = "0.2.1"
diff --git a/src/main.rs b/src/main.rs
index ec69638a..39b95beb 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,48 +1,48 @@
#[macro_use]
extern crate serde_json;
-#[macro_use]
-extern crate tantivy;
-
-use actix_web::{web, web::Data, web::Query, App, HttpRequest, HttpResponse, HttpServer, Responder, get, post};
+use actix_web::{web, web::Data, App, HttpRequest, HttpResponse, HttpServer, Responder, get, post};
use handlebars::Handlebars;
-use serde_derive::Deserialize;
+use meilisearch_sdk::{document::*, indexes::*, client::*, search::*};
+use serde::{Serialize, Deserialize};
+use actix_files as fs;
+
+#[derive(Serialize, Deserialize, Debug)]
+struct Mod {
+ mod_id: usize,
+ title: String,
+ description: String,
+}
+
+impl Document for Mod {
+ type UIDType = usize;
+
+ fn get_uid(&self) -> &Self::UIDType {
+ &self.mod_id
+ }
+}
-use tantivy::collector::TopDocs;
-use tantivy::query::{QueryParser};
-use tantivy::schema::*;
-use tantivy::{Index, IndexReader};
-use tantivy::ReloadPolicy;
-use tempdir::TempDir;
#[derive(Deserialize)]
pub struct SearchRequest {
q: Option,
+ f: Option,
}
#[post("search")]
-async fn search_post(Query(info): Query, reader: Data, parser: Data>, schema: Data>) -> HttpResponse {
- let results = handle_search(Query(info), reader, parser, schema);
+async fn search_post(web::Query(info): web::Query) -> HttpResponse {
+ let results = search(web::Query(info));
- let mut data = "{ \"results\": [".to_owned();
-
- for result in &results {
- data.push_str(&result);
- data.push_str(",");
- }
-
- if &results.len() > &(0 as usize) {
- data.pop();
- }
-
- data.push_str("] }");
+ let data = json!({
+ "results": results,
+ });
HttpResponse::Ok().body(data)
}
#[get("search")]
-async fn search(Query(info): Query, hb: Data>, reader: Data, parser: Data>, schema: Data>) -> HttpResponse {
- let results = handle_search(Query(info), reader, parser, schema);
+async fn search_get(web::Query(info): web::Query, hb: Data>) -> HttpResponse {
+ let results = search(web::Query(info));
let data = json!({
"results": results,
@@ -53,28 +53,27 @@ async fn search(Query(info): Query, hb: Data>, rea
HttpResponse::Ok().body(body)
}
-fn handle_search(Query(info): Query, reader: Data, parser: Data>, schema: Data>) -> Vec{
- let mut search_query : String = "".to_string();
+fn search(web::Query(info): web::Query) -> Vec {
+ let client = Client::new("http://localhost:7700", "");
+
+ let mut search_query = "".to_string();
+ let mut filters = "".to_string();
if let Some(q) = info.q {
search_query = q;
}
- let searcher = reader.searcher();
-
- let mut results = vec![];
-
- if let Ok(query) = parser.parse_query(&search_query) {
- if let Ok(top_docs) = searcher.search(&query, &TopDocs::with_limit(10)) {
- for (_score, doc_address) in top_docs {
- if let Ok(retrieved_doc) = searcher.doc(doc_address) {
- results.push(schema.to_json(&retrieved_doc));
- }
- }
- }
+ if let Some(f) = info.f {
+ filters = f;
}
- return results;
+ let mut query = Query::new(&search_query).with_limit(10);
+
+ if !filters.is_empty() {
+ query = Query::new(&search_query).with_limit(10).with_filters(&filters);
+ }
+
+ client.get_index("mods").unwrap().search::(&query).unwrap().hits
}
#[get("/")]
@@ -88,72 +87,53 @@ async fn index(hb: web::Data>) -> HttpResponse {
}
#[actix_rt::main]
-async fn main() -> tantivy::Result<()> {
+async fn main() -> std::io::Result<()> {
//Handlebars
let mut handlebars = Handlebars::new();
handlebars
- .register_templates_directory(".html", "./static/templates")
+ .register_templates_directory(".hbs", "./templates")
.unwrap();
let handlebars_ref = web::Data::new(handlebars);
//Search
- let index_path = TempDir::new("search_index")?;
- let mut schema_builder = Schema::builder();
+ let client = Client::new("http://localhost:7700", "");
+ let mut mods = client.get_or_create("mods").unwrap();
- schema_builder.add_text_field("title", TEXT | STORED);
- schema_builder.add_text_field("keywords", TEXT | STORED);
- schema_builder.add_text_field("description", TEXT | STORED);
- schema_builder.add_text_field("body", TEXT);
-
- let schema = schema_builder.build();
- let schema_ref = web::Data::new(schema.clone());
-
- let title = schema.get_field("title").unwrap();
- let keywords = schema.get_field("keywords").unwrap();
- let description = schema.get_field("description").unwrap();
- let body = schema.get_field("body").unwrap();
-
- let site_index = Index::create_in_dir(&index_path, schema.clone())?;
- let mut index_writer = site_index.writer(50_000_000)?;
-
- index_writer.add_document(doc!(
- title => "Magic",
- keywords => "Magic Fun Adventure",
- description => "A magic mod for magical purposes!",
- body => "A cool magic mod made by your mom :)",
- ));
-
- index_writer.add_document(doc!(
- title => "Technology",
- keywords => "Technology Fun Adventure",
- description => "A tech mod for tech purposes!",
- body => "A tech mod made by your mom :)",
- ));
-
- index_writer.commit()?;
-
- let reader = site_index.reader_builder().reload_policy(ReloadPolicy::OnCommit).try_into()?;
- let reader_ref = web::Data::new(reader);
-
- let query_parser = QueryParser::for_index(&site_index, vec![title, body, keywords, description]);
- let query_parser_ref = web::Data::new(query_parser);
+ mods.add_documents(vec![
+ Mod {
+ mod_id: 0,
+ title: String::from("Magic Mod"),
+ description: String::from("An illustrious magic mod for magical wizards"),
+ },
+ Mod {
+ mod_id: 1,
+ title: String::from("Tech Mod"),
+ description: String::from("An technological mod for complete NERDS"),
+ },
+ Mod {
+ mod_id: 2,
+ title: String::from("Hood Mod"),
+ description: String::from("A hood mod to roleplay as if you were a real street person. Some adventure stuff too"),
+ },
+ Mod {
+ mod_id: 3,
+ title: String::from("Adventure Mod"),
+ description: String::from("An epic gamer adventure mod for epic adventure gamers"),
+ },
+ ], Some("mod_id")).unwrap();
//Init App
HttpServer::new(move || {
App::new()
.app_data(handlebars_ref.clone())
- .app_data(reader_ref.clone())
- .app_data(query_parser_ref.clone())
- .app_data(schema_ref.clone())
+ .service(fs::Files::new("/static", "./static").show_files_listing())
.service(index)
- .service(search)
+ .service(search_get)
.service(search_post)
})
.bind("127.0.0.1:8000")?
.run()
- .await?;
-
- Ok(())
+ .await
}
diff --git a/static/css/multiselect.css b/static/css/multiselect.css
new file mode 100644
index 00000000..5d9c5f5e
--- /dev/null
+++ b/static/css/multiselect.css
@@ -0,0 +1,122 @@
+.multiselect-wrapper {
+ width: 180px;
+ display: inline-block;
+ white-space: nowrap;
+ font-size: 12px;
+ font-family: "Segoe UI", Verdana, Helvetica, Sans-Serif;
+}
+
+.multiselect-wrapper .multiselect-input {
+ width: 100%;
+ padding-right: 50px;
+}
+
+.multiselect-wrapper label {
+ display: block;
+ font-size: 12px;
+ font-weight : 600;
+}
+
+.multiselect-wrapper .multiselect-list {
+ z-index: 1;
+ position: absolute;
+ display: none;
+ background-color: white;
+ border: 1px solid grey;
+ border-bottom-left-radius: 2px;
+ border-bottom-right-radius: 2px;
+ margin-top: -2px;
+}
+
+.multiselect-wrapper .multiselect-list.active {
+ display: block;
+}
+
+.multiselect-wrapper .multiselect-list > span {
+ font-weight: bold;
+}
+
+.multiselect-wrapper .multiselect-list .multiselect-checkbox {
+ margin-right: 2px;
+}
+
+.multiselect-wrapper .multiselect-list > span,
+.multiselect-wrapper .multiselect-list li {
+ cursor: default;
+}
+
+.multiselect-wrapper .multiselect-list {
+ padding: 5px;
+ min-width: 200px;
+}
+
+.multiselect-wrapper ul {
+ list-style: none;
+ display: block;
+ position: relative;
+ padding: 0px;
+ margin: 0px;
+ max-height: 200px;
+ overflow-y: auto;
+ overflow-x: hidden;
+}
+
+.multiselect-wrapper ul li {
+ padding-right: 20px;
+ display: block;
+}
+
+.multiselect-wrapper ul li.active {
+ background-color: rgb(0, 102, 255);
+ color: white;
+}
+
+.multiselect-wrapper ul li:hover {
+ background-color: rgb(0, 102, 255);
+ color: white;
+}
+
+.multiselect-input-div {
+ height: 34px;
+}
+
+.multiselect-input-div input{
+ border: 1px solid #ababab;
+ background : #fff;
+ margin: 5px 0 6px 0;
+ padding: 5px;
+ vertical-align:middle;
+}
+
+.multiselect-count {
+ position: relative;
+ text-align: center;
+ border-radius: 2px;
+ background-color: lightblue;
+ display: inline-block !important;
+ padding: 2px 7px;
+ left: -45px;
+}
+
+.multiselect-wrapper.disabled .multiselect-dropdown-arrow {
+ border-top: 5px solid lightgray;
+}
+
+.multiselect-wrapper.disabled .multiselect-count {
+ background-color: lightgray;
+}
+
+.multiselect-dropdown-arrow {
+ width: 0;
+ height: 0;
+ border-left: 5px solid transparent;
+ border-right: 5px solid transparent;
+ border-top: 5px solid black;
+ position: absolute;
+ line-height: 20px;
+ text-align: center;
+ display: inline-block !important;
+ margin-top: 17px;
+ margin-left: -42px;
+}
+
diff --git a/static/css/style.css b/static/css/style.css
new file mode 100644
index 00000000..83aac180
--- /dev/null
+++ b/static/css/style.css
@@ -0,0 +1,48 @@
+@import url('https://fonts.googleapis.com/css?family=Montserrat:400,600');
+
+body {
+ margin: 0;
+ font-family: 'Montserrat', sans-serif;
+}
+
+#categories_multiSelect {
+ width: 200px;
+}
+
+.results {
+ width: 75%;
+ margin: auto;
+}
+
+.result {
+ display: flex;
+ height: 100px;
+ margin: 30px auto;
+ padding: 5px;
+ width: 75%;
+ flex-direction: row;
+ align-items: center;
+}
+
+.result img {
+ padding: 0 10px 0 0;
+}
+
+.result-info {
+ display: flex;
+ flex-direction: column;
+}
+
+.result-info * {
+ padding: 0 5px 0 0;
+ margin: 0;
+}
+
+.rounded-border {
+ border-radius: 10px;
+ border: 1px;
+}
+
+.gray-border {
+ border: 1px solid darkgray;
+}
\ No newline at end of file
diff --git a/static/js/multiselect.min.js b/static/js/multiselect.min.js
new file mode 100644
index 00000000..b2bf236e
--- /dev/null
+++ b/static/js/multiselect.min.js
@@ -0,0 +1,44 @@
+if(!m_helper)
+{var m_helper={removeNode:function(id){var el=document.getElementById(id);if(el){el.parentNode.removeChild(el)}},insertAfter:function(item,target){var parent=target.parentNode;if(target.nextElementSibling){parent.insertBefore(item,target.nextElementSibling)}else{parent.appendChild(item)}},hide:function(element){element.style.display='none'},hideAll:function(array){for(var i=0;i-1){window.multiselects._items.splice(index,1);window.multiselects.splice(index,1)}},select:function(val){this._toggle(val,!0)},deselect:function(val){this._toggle(val,!1)},setIsEnabled(isEnabled){if(this._isEnabled===isEnabled)return;var wrapperItem=document.getElementById(this._getIdentifier());if(isEnabled){wrapperItem.classList.remove('disabled')}else{wrapperItem.classList.add('disabled')}
+ m_helper.setDisabled(this._item,!isEnabled);m_helper.setDisabled(document.getElementById(this._getInputFieldIdentifier()),!isEnabled);this._isEnabled=isEnabled},_toggle:function(val,setCheck){var self=this;if(val){m_helper.each(document.getElementById(this._getIdentifier()).querySelectorAll('.multiselect-checkbox'),function(e){if(e.dataset.val==val){if(setCheck&&!e.checked){m_helper.check(e);self._onCheckBoxChange(e,self)}else if(!setCheck&&e.checked){m_helper.uncheck(e);self._onCheckBoxChange(e,self)}}});self._updateText(self)}},selectAll:function(val){var selectAllChkBox=document.querySelector('#'+this._getIdentifier()+' .multiselect-checkbox');m_helper.check(selectAllChkBox);this._onCheckBoxChange(selectAllChkBox,this);this._updateText(this)},deselectAll:function(){var selectAllChkBox=document.querySelector('#'+this._getIdentifier()+' .multiselect-checkbox');m_helper.uncheck(selectAllChkBox);this._onCheckBoxChange(selectAllChkBox,this);this._updateText(this)},_checkboxClickEvents:{},setCheckBoxClick(id,handler){if(typeof handler==="function"){this._checkboxClickEvents[id]=handler}else{console.error("Checkbox click handler for checkbox value="+id+" is not a function")}
+ return this},_appendEvents:function(){var self=this;document.getElementById(self._getInputFieldIdentifier()).addEventListener('focus',function(event){self._showList(self);document.getElementById(self._getInputFieldIdentifier()).value='';m_helper.each(window.multiselects,function(e){if(document.getElementById(e._getItemListIdentifier()).offsetParent&&m_helper.parent(event.target,e._getIdentifier())){e._hideList(self)}})});document.getElementById(self._getInputFieldIdentifier()).addEventListener('click',function(){self._showList(self);document.getElementById(self._getInputFieldIdentifier()).value=''});document.getElementById(self._getIdentifier()).addEventListener('click',function(event){event=event||window.event;var target=event.target||event.srcElement;if(m_helper.parent(target,self._getIdentifier())){event.stopPropagation()}});document.getElementById(self._getItemListIdentifier()).addEventListener('mouseover',function(){self._showList(self)});m_helper.each(document.getElementById(self._getIdentifier()).querySelectorAll('.multiselect-checkbox'),function(e){e.addEventListener('change',function(event){self._onCheckBoxChange(e,self,event)})});var onInput=function(){var text=this.value.toLowerCase();if(!text||text==''){m_helper.show(document.querySelector('#'+self._getItemListIdentifier()+' > span'));m_helper.show(document.querySelector('#'+self._getItemListIdentifier()+' > hr'));m_helper.showAll(document.querySelectorAll('#'+self._getItemListIdentifier()+' li'))}else{m_helper.hide(document.querySelector('#'+self._getItemListIdentifier()+' > span'));m_helper.hide(document.querySelector('#'+self._getItemListIdentifier()+' > hr'));var array=Array.prototype.filter.call(document.querySelectorAll('#'+self._getItemListIdentifier()+' li span'),function(obj){return obj.innerHTML.toLowerCase().indexOf(text)>-1});m_helper.hideAll(document.querySelectorAll('#'+self._getItemListIdentifier()+' li'));m_helper.each(array,function(e){m_helper.show(e.parentElement.parentElement)})}}
+ document.getElementById(self._getInputFieldIdentifier()).addEventListener('propertychange',onInput);document.getElementById(self._getInputFieldIdentifier()).addEventListener('input',onInput)},_onCheckBoxChange:function(checkbox,self,event){if(!checkbox.dataset.multiselectElement){var checkedState=self._performSelectAll(checkbox,self);if(typeof self._checkboxClickEvents.checkboxAll==="function"){self._checkboxClickEvents.checkboxAll(checkbox,{checked:checkedState})}}
+ else{var checkedState=self._performSelectItem(checkbox,self);if(typeof self._checkboxClickEvents[checkedState.id]==="function"){self._checkboxClickEvents[checkedState.id](checkbox,checkedState)}
+ self._updateSelectAll(self)}
+ self._forceUpdate()},_performSelectItem:function(checkbox,self){var item=JSON.parse(checkbox.dataset.multiselectElement);if(checkbox.checked){self._itemCounter++;m_helper.select(this._item.options[item.index]);m_helper.setActive(checkbox.parentElement.parentElement);return{id:item.id,checked:!0}}
+ self._itemCounter--;m_helper.deselect(this._item.options[item.index]);m_helper.setUnactive(checkbox.parentElement.parentElement);return{id:item.id,checked:!1}},_performSelectAll:function(checkbox,self){var items=self._getItems();if(checkbox.checked){self._itemCounter=items.length;m_helper.each(items,function(e){m_helper.setActive(e.multiselectElement.parentElement.parentElement);m_helper.select(self._item.options[e.index]);m_helper.check(e.multiselectElement)});return!0}
+ self._itemCounter=0;m_helper.each(items,function(e){e.multiselectElement.parentElement.parentElement.classList.remove('active');m_helper.deselect(self._item.options[e.index]);m_helper.uncheck(e.multiselectElement)});return!1},_updateSelectAll:function(self){var allChkBox=document.getElementById(self._getItemListIdentifier()).querySelector('input[type=checkbox]');if(self._itemCounter==self._getItems().length){allChkBox.checked=!0}
+ else if(allChkBox.checked){allChkBox.checked=!1}},_hideList:function(context,event){m_helper.setUnactive(document.getElementById(context._getItemListIdentifier()));m_helper.show(document.getElementById(context._getItemListIdentifier()).querySelector('span'));m_helper.show(document.getElementById(context._getItemListIdentifier()).querySelector('hr'));m_helper.showAll(document.getElementById(context._getItemListIdentifier()).querySelectorAll('li'));context._updateText(context);if(event)
+ event.stopPropagation()},_updateText:function(context){var activeItems=document.getElementById(context._getItemListIdentifier()).querySelectorAll('ul .active');if(activeItems.length>0){var val='';for(var i=0;i<(activeItems.length<5?activeItems.length:5);i++){val+=activeItems[i].innerText+", "}
+ val=val.substr(0,val.length-2);if(val.length>20){val=val.substr(0,17)+'...'}}
+ if(activeItems.length==document.getElementById(context._getItemListIdentifier()).querySelectorAll('ul li').length){val='All selected'}
+ document.getElementById(context._getInputFieldIdentifier()).value=val?val:''},_showList:function(context){m_helper.setActive(document.getElementById(context._getItemListIdentifier()))},_forceUpdate:function(){var badge=document.getElementById(this._getInputBadgeIdentifier());badge.style.visibility='hidden';if(this._itemCounter!=0){badge.innerHTML=this._itemCounter;badge.style.visibility='visible';var ddArrow=badge.nextElementSibling;if(this._itemCounter<10){badge.style.left='-45px';ddArrow.style.marginLeft='-42px'}
+ else if(this._itemCounter<100){badge.style.left='-50px';ddArrow.style.marginLeft='-47px'}
+ else if(this._itemCounter<1000){badge.style.left='-55px';ddArrow.style.marginLeft='-52px'}
+ else if(this._itemCounter<10000){badge.style.left='-60px';ddArrow.style.marginLeft='-57px'}}},_items:undefined,_itemCounter:0,_isEnabled:!0,_getItems:function(){if(this._items==undefined){var result=[];var opts=this._item.options;for(var i=0;i
+
+
+
${result.title}
+
${result.description}
+
+
+ `
+ }
+
+ resultContainer.innerHTML = contentToSet;
+ }
+ }
+ xmlHttp.open("POST", "search?q=" + safeName, true);
+ xmlHttp.send(null);
+
+ window.history.pushState('Search', 'Search', '/search?q=' + safeName);
+}
\ No newline at end of file
diff --git a/static/templates/search.html b/static/templates/search.html
deleted file mode 100644
index c2060d25..00000000
--- a/static/templates/search.html
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
- Search
-
-
-
-Test Mod Search
-
-
-{{results}}
-
-
-
-
-
\ No newline at end of file
diff --git a/static/templates/index.html b/templates/index.hbs
similarity index 100%
rename from static/templates/index.html
rename to templates/index.hbs
diff --git a/templates/search.hbs b/templates/search.hbs
new file mode 100644
index 00000000..55527728
--- /dev/null
+++ b/templates/search.hbs
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Search
+
+
+
+Test Mod Search
+
+
+
+ {{#each results}}
+
+

+
+
{{this.title}}
+
{{this.description}}
+
+
+ {{/each}}
+
+
+
+
+
+
+
+
\ No newline at end of file