From d0fa2ac906ff8aa4f6cb59c64455d1e56e8e0cc3 Mon Sep 17 00:00:00 2001 From: Paul Masurel Date: Thu, 11 Aug 2016 16:26:54 +0900 Subject: [PATCH] Added starting tutorial --- Cargo.toml | 24 ++++++++++++------- LICENSE | 7 ++++++ docs/tutorial.md | 43 +++++++++++++++++++++++++++++++++++ script/build-static-binary.sh | 4 ++++ script/profile.sh | 5 ++++ 5 files changed, 75 insertions(+), 8 deletions(-) create mode 100644 LICENSE create mode 100644 docs/tutorial.md create mode 100644 script/build-static-binary.sh create mode 100644 script/profile.sh diff --git a/Cargo.toml b/Cargo.toml index f60990184..cc46269a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,33 +3,42 @@ name = "tantivy" version = "0.1.0" authors = ["Paul Masurel "] build = "build.rs" +license = "MIT" + +description = """Tantivy is a search engine library.""" + +documentation = "http://fulmicoton.com/tantivy/tantivy/index.html" +homepage = "https://github.com/fulmicoton/tantivy" +repository = "https://github.com/fulmicoton/tantivy" + +readme = "README.md" +keywords = ["search", "information", "retrieval"] [dependencies] byteorder = "0.4" memmap = "0.2" -lazy_static = "0.1.*" +lazy_static = "0.1.16" regex = "0.1" fst = "0.1.31" atomicwrites = "0.0.14" tempfile = "2.0.0" rustc-serialize = "0.3.16" log = "0.3.5" -combine = "*" +combine = "1.3.0" tempdir = "0.3.4" bincode = "0.4.0" libc = "0.2.6" -argparse = "*" num_cpus = "0.2" itertools = "0.4.16" lz4 = "1.13.131" time = "0.1.34" uuid = "0.1" - iron = "0.4" staticfile = "0.3.0" -persistent="*" -ansi_term = "*" +persistent="0.2.0" +ansi_term = "0.8.0" clap = "2" +mount = "0.2.1" [dev-dependencies] rand = "0.3.13" @@ -48,5 +57,4 @@ doc = false [dependencies.urlencoded] version = "0.4" -[dependencies.mount] -git = "https://github.com/iron/mount.git" + diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..45a673820 --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2016 Paul Masurel + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/docs/tutorial.md b/docs/tutorial.md new file mode 100644 index 000000000..e7e86be25 --- /dev/null +++ b/docs/tutorial.md @@ -0,0 +1,43 @@ +# Indexing Wikipedia with Tantivy CLI interface + +## Introduction + +In this tutorial, we will create a brand new index +with the articles of English wikipedia in it. + + + +## Step 1 - Get tantivy CLI interface + +There are two ways to get `tantivy`. +If you are a rust programmer, you can run `cargo install tantivy`. +Alternatively, if you are on `Linux 64bits`, you can download a +static binary here []() + +## Step 2 - creating the index + +Create a directory in which your index will be stored. + +```bash + # create the directory + mkdir wikipedia-index +``` + + +We will now initialize the index and create it's schema. + +Our documents will contain +* a title +* a body +* a url + +Running + +```bash + # create the directory + tantivy +``` + + + +https://www.dropbox.com/s/wwnfnu441w1ec9p/wiki-articles.json.bz2?dl=0 \ No newline at end of file diff --git a/script/build-static-binary.sh b/script/build-static-binary.sh new file mode 100644 index 000000000..3fa3b43c0 --- /dev/null +++ b/script/build-static-binary.sh @@ -0,0 +1,4 @@ +# the musl-tools package must be installed. +rustup target add x86_64-unknown-linux-musl +cargo build --release --target=x86_64-unknown-linux-musl + diff --git a/script/profile.sh b/script/profile.sh new file mode 100644 index 000000000..d5ea02407 --- /dev/null +++ b/script/profile.sh @@ -0,0 +1,5 @@ +#/bin/bash +valgrind --tool=cachegrind target/release/tantivy-bench -i /data/wiki-index -q ./queries.txt -n 3 +valgrind --tool=callgrind target/release/tantivy-bench -i /data/wiki-index -q ./queries.txt -n 3 + +