From c8c899b1543caeb66749fd857cfc2c288709e838 Mon Sep 17 00:00:00 2001 From: Paul Masurel Date: Mon, 1 Aug 2016 09:22:56 +0900 Subject: [PATCH] Body and title as defautl field --- src/main.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 58f5310..c164cf4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -60,7 +60,7 @@ impl IndexServer { let schema = index.schema(); let body_field = schema.get_field("body").unwrap(); let title_field = schema.get_field("title").unwrap(); - let query_parser = QueryParser::new(schema, body_field); + let query_parser = QueryParser::new(schema, vec!(body_field, title_field)); IndexServer { index: index, query_parser: query_parser, @@ -119,10 +119,9 @@ fn search(req: &mut Request) -> IronResult { let searcher = INDEX_SERVER.index.searcher().unwrap(); let mut count_collector = CountCollector::new(); - let mut top_collector = TopCollector::with_limit(10); + let mut top_collector = TopCollector::with_limit(30); { - // let mut multi_collector = MultiCollector::from(vec!(&mut count_collector, &mut top_collector)); let mut chained_collector = collector::chain() .add(&mut top_collector) .add(&mut count_collector);