Browse Source

blop

develop
Paul Masurel 8 years ago
parent
commit
b15519e4c4
4 changed files with 13 additions and 10 deletions
  1. +6
    -4
      Cargo.toml
  2. +4
    -4
      src/main.rs
  3. +1
    -1
      static/index.html
  4. +2
    -1
      static/style.less

+ 6
- 4
Cargo.toml View File

@@ -7,11 +7,13 @@ authors = ["Paul Masurel <paul.masurel@gmail.com>"]
[dependencies]
tantivy = { path = "../tantivy" }
time = "0.1.34"
iron = "0.3.0"
staticfile = "*"
mount= "*"
iron = "0.4"
staticfile = "0.3.0"
lazy_static = "*"
rustc-serialize = "0.3.16"

[dependencies.urlencoded]
version = "*"
version = "0.4"

[dependencies.mount]
git = "https://github.com/iron/mount.git"

+ 4
- 4
src/main.rs View File

@@ -9,11 +9,11 @@ extern crate staticfile;
extern crate mount;

use tantivy::schema::Field;
use tantivy::collector::{CountCollector, MultiCollector};
use tantivy::collector::CountCollector;
use tantivy::Index;
use std::convert::From;
use time::PreciseTime;
use tantivy::collector::chain;
use tantivy::collector;
use urlencoded::UrlEncodedQuery;
use iron::status;
use rustc_serialize::json::as_pretty_json;
@@ -43,7 +43,7 @@ struct Hit {

lazy_static! {
static ref INDEX_SERVER: IndexServer = {
IndexServer::load(&Path::new("/Users/pmasurel/wiki-index/"))
IndexServer::load(&Path::new("/data/wiki-index/"))
};
}

@@ -123,7 +123,7 @@ fn search(req: &mut Request) -> IronResult<Response> {

{
// let mut multi_collector = MultiCollector::from(vec!(&mut count_collector, &mut top_collector));
let mut chained_collector = chain()
let mut chained_collector = collector::chain()
.add(&mut top_collector)
.add(&mut count_collector);
let timings = parsed_query.search(&searcher, &mut chained_collector).unwrap();


+ 1
- 1
static/index.html View File

@@ -10,7 +10,7 @@
<div class='num_hits'>{{ num_hits }} articles</div>
<ul class="timings">
{{#timings}}
<li>{{name}} - {{duration}} µs</li>
<li>{{name}} - {{duration}} &mu;s</li>
{{/timings}}
</ul>
</ul>


+ 2
- 1
static/style.less View File

@@ -9,7 +9,6 @@ body {

input, button {
font-size: 20px;
//height: 45px;
padding: 5px;
}

@@ -38,6 +37,8 @@ div.query {
}

ul.hits {
margin-top: 30px;
clear: both;
padding: 0;
list-style-type: none;
li {


Loading…
Cancel
Save