mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-27 21:39:37 +00:00
Merge pull request #954 from kiwix/search_remove_accent
Add a new test, showing accents is not properly handle in search endpoint.
This commit is contained in:
@ -2,6 +2,7 @@
|
|||||||
#define CPPHTTPLIB_ZLIB_SUPPORT 1
|
#define CPPHTTPLIB_ZLIB_SUPPORT 1
|
||||||
#include "./httplib.h"
|
#include "./httplib.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
#include "../src/tools/stringTools.h"
|
||||||
|
|
||||||
#define SERVER_PORT 8101
|
#define SERVER_PORT 8101
|
||||||
#include "server_testing_tools.h"
|
#include "server_testing_tools.h"
|
||||||
@ -716,7 +717,7 @@ struct TestData
|
|||||||
|
|
||||||
std::string getPattern() const
|
std::string getPattern() const
|
||||||
{
|
{
|
||||||
return extractQueryValue("pattern");
|
return kiwix::urlDecode(extractQueryValue("pattern"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getLang() const
|
std::string getLang() const
|
||||||
@ -1456,6 +1457,33 @@ TEST(ServerSearchTest, searchResults)
|
|||||||
{ "▶", 40, false },
|
{ "▶", 40, false },
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Be sure that searching with accented query return the same things than non accented query.
|
||||||
|
{
|
||||||
|
/* query */ "pattern=j%C3%A0zz"
|
||||||
|
"&books.filter.lang=eng"
|
||||||
|
"&books.filter.title=Ray%20Charles",
|
||||||
|
/* start */ -1,
|
||||||
|
/* resultsPerPage */ 5,
|
||||||
|
/* totalResultCount */ 44,
|
||||||
|
/* firstResultIndex */ 1,
|
||||||
|
/* results */ {
|
||||||
|
LARGE_SEARCH_RESULTS[0],
|
||||||
|
LARGE_SEARCH_RESULTS[1],
|
||||||
|
LARGE_SEARCH_RESULTS[2],
|
||||||
|
LARGE_SEARCH_RESULTS[3],
|
||||||
|
LARGE_SEARCH_RESULTS[4],
|
||||||
|
},
|
||||||
|
|
||||||
|
/* pagination */ {
|
||||||
|
{ "1", 0, true },
|
||||||
|
{ "2", 5, false },
|
||||||
|
{ "3", 10, false },
|
||||||
|
{ "4", 15, false },
|
||||||
|
{ "5", 20, false },
|
||||||
|
{ "▶", 40, false },
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
ZimFileServer zfs(SERVER_PORT, ZimFileServer::DEFAULT_OPTIONS,
|
ZimFileServer zfs(SERVER_PORT, ZimFileServer::DEFAULT_OPTIONS,
|
||||||
|
Reference in New Issue
Block a user