From 3555e4f918f5d19dcce5633f53f44196f6fb8cc8 Mon Sep 17 00:00:00 2001 From: kelson42 Date: Sun, 4 Jul 2010 15:55:12 +0000 Subject: [PATCH] + tokenize the search query with Xapian::Query::parser_query() and not anymore with split() --- src/common/kiwix/searcher.cpp | 13 ++++--------- src/common/kiwix/searcher.h | 1 - 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/common/kiwix/searcher.cpp b/src/common/kiwix/searcher.cpp index 8b69c5d8..f59056a5 100644 --- a/src/common/kiwix/searcher.cpp +++ b/src/common/kiwix/searcher.cpp @@ -29,17 +29,12 @@ namespace kiwix { this->results.clear(); this->resultOffset = this->results.begin(); + /* Create the query */ + Xapian::QueryParser queryParser; + Xapian::Query query = queryParser.parse_query(removeAccents(search)); + /* Create the enquire object */ Xapian::Enquire enquire(this->readableDatabase); - - /* Create the query term vector */ - /* I have the doublequote " because bug ID: 2939690 */ - std::vector queryTerms = split(removeAccents(search), " #@%$0/\\_-*()[]{},;:\"'"); - - /* Create query object */ - Xapian::Query query(Xapian::Query::OP_OR, queryTerms.begin(), queryTerms.end()); - - /* Set the query in the enquire object */ enquire.set_query(query); if (verbose == true) { diff --git a/src/common/kiwix/searcher.h b/src/common/kiwix/searcher.h index b62c573d..ebbd4d40 100644 --- a/src/common/kiwix/searcher.h +++ b/src/common/kiwix/searcher.h @@ -11,7 +11,6 @@ #include #include #include -#include using namespace std;