mirror of https://github.com/djcb/mu.git
store/fields: Use one MaxTermLength everywhere
One should be enough!
This commit is contained in:
parent
dc69505580
commit
7470a5f8ea
|
@ -22,9 +22,6 @@
|
||||||
|
|
||||||
using namespace Mu;
|
using namespace Mu;
|
||||||
|
|
||||||
// Xapian does not like terms much longer than this
|
|
||||||
constexpr auto MaxTermLength = 240;
|
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
Field::xapian_term(const std::string& s) const
|
Field::xapian_term(const std::string& s) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,6 +30,10 @@
|
||||||
|
|
||||||
namespace Mu {
|
namespace Mu {
|
||||||
|
|
||||||
|
// Xapian does not like terms much longer than this
|
||||||
|
constexpr auto MaxTermLength = 240;
|
||||||
|
// http://article.gmane.org/gmane.comp.search.xapian.general/3656 */
|
||||||
|
|
||||||
struct Field {
|
struct Field {
|
||||||
/**
|
/**
|
||||||
* Field Ids.
|
* Field Ids.
|
||||||
|
|
|
@ -572,7 +572,7 @@ Server::Private::contacts_handler(const Parameters& params)
|
||||||
static std::vector<Store::Id>
|
static std::vector<Store::Id>
|
||||||
docids_for_msgid(const Store& store, const std::string& msgid, size_t max = 100)
|
docids_for_msgid(const Store& store, const std::string& msgid, size_t max = 100)
|
||||||
{
|
{
|
||||||
if (msgid.size() > Store::MaxTermLength) {
|
if (msgid.size() > MaxTermLength) {
|
||||||
throw Error(Error::Code::InvalidArgument,
|
throw Error(Error::Code::InvalidArgument,
|
||||||
"invalid message-id '%s'", msgid.c_str());
|
"invalid message-id '%s'", msgid.c_str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,8 +43,6 @@ public:
|
||||||
using Id = Xapian::docid; /**< Id for a message in the store */
|
using Id = Xapian::docid; /**< Id for a message in the store */
|
||||||
static constexpr Id InvalidId = 0; /**< Invalid store id */
|
static constexpr Id InvalidId = 0; /**< Invalid store id */
|
||||||
|
|
||||||
static constexpr size_t MaxTermLength = 240; /**< Maximum length of a term,
|
|
||||||
http://article.gmane.org/gmane.comp.search.xapian.general/3656 */
|
|
||||||
/**
|
/**
|
||||||
* Construct a store for an existing document database
|
* Construct a store for an existing document database
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue