Update dependencies (#428)

* Bump serde from 1.0.82 to 1.0.84
* Bump ructe from 0.5.4 to 0.5.6
* Bump colored from 1.6.1 to 1.7.0
* Bump itertools from 0.7.11 to 0.8.0
* Bump ammonia from 1.2.0 to 2.0.0
* Bump hyper from 0.12.19 to 0.12.20
* Bump serde_derive from 1.0.80 to 1.0.84
* Bump stdweb from 0.4.12 to 0.4.13
* Bump rsass from 0.9.4 to 0.9.6
* Bump failure from 0.1.3 to 0.1.5
* Bump reqwest from 0.9.5 to 0.9.8
* Bump serde_derive from 0.7.1 to 0.8.0
This commit is contained in:
fdb-hiroshima
2019-01-18 19:22:36 +01:00
committed by GitHub
parent 09a26b4602
commit 944a9d08a7
5 changed files with 201 additions and 234 deletions
+5 -5
View File
@@ -6,7 +6,7 @@ use Connection;
use chrono::Datelike;
use itertools::Itertools;
use tantivy::{
collector::TopCollector, directory::MmapDirectory,
collector::TopDocs, directory::MmapDirectory,
schema::*, tokenizer::*, Index, IndexWriter, Term
};
use whatlang::{detect as detect_lang, Lang};
@@ -177,14 +177,14 @@ impl Searcher {
let schema = self.index.schema();
let post_id = schema.get_field("post_id").unwrap();
let mut collector = TopCollector::with_limit(cmp::max(1,max) as usize);
let collector = TopDocs::with_limit(cmp::max(1,max) as usize);
let searcher = self.index.searcher();
searcher.search(&query.into_query(), &mut collector).unwrap();
let res = searcher.search(&query.into_query(), &collector).unwrap();
collector.docs().get(min as usize..).unwrap_or(&[])
res.get(min as usize..).unwrap_or(&[])
.into_iter()
.filter_map(|doc_add| {
.filter_map(|(_,doc_add)| {
let doc = searcher.doc(*doc_add).ok()?;
let id = doc.get_first(post_id)?;
Post::get(conn, id.i64_value() as i32).ok()