mirror of https://github.com/djcb/mu.git
only use OP_WILDCARD for xapian >= 1.3.3
It's not available for earlier versions.
This commit is contained in:
parent
6290e4ad9a
commit
7a8d43dc5f
|
@ -159,7 +159,10 @@ AS_IF([test "x$XAPIAN_CONFIG" = "xno"],[
|
|||
*** is in your PATH.])],
|
||||
[xapian_version=$($XAPIAN_CONFIG --version | sed -e 's/.* //')])
|
||||
AS_CASE([$xapian_version],
|
||||
[1.[[2-9]].[[0-9]]*], [],
|
||||
[1.[[3-9]].[[3-9]]*],
|
||||
[AC_DEFINE([XAPIAN_HAVE_OP_WILDCARD],[1],[Xapian::Query::OP_WILDCARD?])],
|
||||
[1.[[2-9]].[[0-9]]*],
|
||||
[AC_MSG_WARN([*** xapian $xapian_version, no Query::Op::Wildcard])],
|
||||
[AC_MSG_ERROR([*** xapian version >= 1.2 needed,
|
||||
but version $xapian_version found.])])
|
||||
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
** 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
|
||||
#include <xapian.h>
|
||||
#include "parser/xapian.hh"
|
||||
|
||||
|
@ -52,12 +56,16 @@ xapian_query_op (const Mux::Tree& tree)
|
|||
static Xapian::Query
|
||||
maybe_wildcard (const Value* val, const std::string& str)
|
||||
{
|
||||
#ifndef XAPIAN_HAVE_OP_WILDCARD
|
||||
return Xapian::Query(val->prefix + str);
|
||||
#else
|
||||
const auto vlen = str.length();
|
||||
if (vlen <= 1 || str[vlen-1] != '*')
|
||||
return Xapian::Query(val->prefix + str);
|
||||
else
|
||||
return Xapian::Query(Xapian::Query::OP_WILDCARD,
|
||||
val->prefix + str.substr(0, vlen-1));
|
||||
#endif/*XAPIAN_HAVE_OP_WILDCARD*/
|
||||
}
|
||||
|
||||
static Xapian::Query
|
||||
|
|
Loading…
Reference in New Issue