mirror of https://github.com/kiwix/libkiwix.git
+ lowercase the search partern in search.[cpp|h]
This commit is contained in:
parent
dc9e92e1e6
commit
0f4d6eb371
|
@ -23,7 +23,7 @@ namespace kiwix {
|
|||
}
|
||||
|
||||
/* Search strings in the database */
|
||||
void Searcher::search(const string &search, const unsigned int resultsCount) {
|
||||
void Searcher::search(string search, const unsigned int resultsCount) {
|
||||
/* Reset the results */
|
||||
this->results.clear();
|
||||
this->resultOffset = this->results.begin();
|
||||
|
@ -31,6 +31,9 @@ namespace kiwix {
|
|||
/* Create the enquire object */
|
||||
Xapian::Enquire enquire(this->readableDatabase);
|
||||
|
||||
/* lowercase the search pattern */
|
||||
std::transform(search.begin(), search.end(), search.begin(), ::tolower);
|
||||
|
||||
/* Create the query term vector */
|
||||
std::vector<std::string> queryTerms = split(removeAccents(search.c_str()), " #@%$0/\\_-*()[]{},;:");
|
||||
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <locale>
|
||||
#include <cctype>
|
||||
#include <vector>
|
||||
#include <xapian.h>
|
||||
#include <unaccent.h>
|
||||
|
@ -31,7 +35,7 @@ namespace kiwix {
|
|||
std::vector<Result> results;
|
||||
std::vector<Result>::iterator resultOffset;
|
||||
|
||||
void search(const string &search, const unsigned int resultsCount);
|
||||
void search(string search, const unsigned int resultsCount);
|
||||
bool getNextResult(string &url, string &title, unsigned int &score);
|
||||
void closeDatabase();
|
||||
void reset();
|
||||
|
|
Loading…
Reference in New Issue