/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 2.0.5
 * 
 * This file is not intended to be easily readable and contains a number of 
 * coding conventions designed to improve portability and efficiency. Do not make
 * changes to this file unless you know what you are doing--modify the SWIG 
 * interface file instead. 
 * ----------------------------------------------------------------------------- */

#define SWIGRUBY
#define SWIG_DIRECTORS


#ifdef __cplusplus
/* SwigValueWrapper is described in swig.swg */
template<typename T> class SwigValueWrapper {
  struct SwigMovePointer {
    T *ptr;
    SwigMovePointer(T *p) : ptr(p) { }
    ~SwigMovePointer() { delete ptr; }
    SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
  } pointer;
  SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
  SwigValueWrapper(const SwigValueWrapper<T>& rhs);
public:
  SwigValueWrapper() : pointer(0) { }
  SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
  operator T&() const { return *pointer.ptr; }
  T *operator&() { return pointer.ptr; }
};

template <typename T> T SwigValueInit() {
  return T();
}
#endif

/* -----------------------------------------------------------------------------
 *  This section contains generic SWIG labels for method/variable
 *  declarations/attributes, and other compiler dependent labels.
 * ----------------------------------------------------------------------------- */

/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
#  define SWIGTEMPLATEDISAMBIGUATOR template
# elif defined(__HP_aCC)
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
#  define SWIGTEMPLATEDISAMBIGUATOR template
# else
#  define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif

/* inline attribute */
#ifndef SWIGINLINE
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
#   define SWIGINLINE inline
# else
#   define SWIGINLINE
# endif
#endif

/* attribute recognised by some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define SWIGUNUSED __attribute__ ((__unused__)) 
#   else
#     define SWIGUNUSED
#   endif
# elif defined(__ICC)
#   define SWIGUNUSED __attribute__ ((__unused__)) 
# else
#   define SWIGUNUSED 
# endif
#endif

#ifndef SWIG_MSC_UNSUPPRESS_4505
# if defined(_MSC_VER)
#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
# endif 
#endif

#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
#   define SWIGUNUSEDPARM(p)
# else
#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
# endif
#endif

/* internal SWIG method */
#ifndef SWIGINTERN
# define SWIGINTERN static SWIGUNUSED
#endif

/* internal inline SWIG method */
#ifndef SWIGINTERNINLINE
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
#endif

/* exporting methods */
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#  ifndef GCC_HASCLASSVISIBILITY
#    define GCC_HASCLASSVISIBILITY
#  endif
#endif

#ifndef SWIGEXPORT
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   if defined(STATIC_LINKED)
#     define SWIGEXPORT
#   else
#     define SWIGEXPORT __declspec(dllexport)
#   endif
# else
#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
#     define SWIGEXPORT __attribute__ ((visibility("default")))
#   else
#     define SWIGEXPORT
#   endif
# endif
#endif

/* calling conventions for Windows */
#ifndef SWIGSTDCALL
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   define SWIGSTDCALL __stdcall
# else
#   define SWIGSTDCALL
# endif 
#endif

/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif

/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
# define _SCL_SECURE_NO_DEPRECATE
#endif


/* -----------------------------------------------------------------------------
 *  This section contains generic SWIG labels for method/variable
 *  declarations/attributes, and other compiler dependent labels.
 * ----------------------------------------------------------------------------- */

/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
#  define SWIGTEMPLATEDISAMBIGUATOR template
# elif defined(__HP_aCC)
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
#  define SWIGTEMPLATEDISAMBIGUATOR template
# else
#  define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif

/* inline attribute */
#ifndef SWIGINLINE
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
#   define SWIGINLINE inline
# else
#   define SWIGINLINE
# endif
#endif

/* attribute recognised by some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define SWIGUNUSED __attribute__ ((__unused__)) 
#   else
#     define SWIGUNUSED
#   endif
# elif defined(__ICC)
#   define SWIGUNUSED __attribute__ ((__unused__)) 
# else
#   define SWIGUNUSED 
# endif
#endif

#ifndef SWIG_MSC_UNSUPPRESS_4505
# if defined(_MSC_VER)
#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
# endif 
#endif

#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
#   define SWIGUNUSEDPARM(p)
# else
#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
# endif
#endif

/* internal SWIG method */
#ifndef SWIGINTERN
# define SWIGINTERN static SWIGUNUSED
#endif

/* internal inline SWIG method */
#ifndef SWIGINTERNINLINE
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
#endif

/* exporting methods */
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#  ifndef GCC_HASCLASSVISIBILITY
#    define GCC_HASCLASSVISIBILITY
#  endif
#endif

#ifndef SWIGEXPORT
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   if defined(STATIC_LINKED)
#     define SWIGEXPORT
#   else
#     define SWIGEXPORT __declspec(dllexport)
#   endif
# else
#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
#     define SWIGEXPORT __attribute__ ((visibility("default")))
#   else
#     define SWIGEXPORT
#   endif
# endif
#endif

/* calling conventions for Windows */
#ifndef SWIGSTDCALL
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   define SWIGSTDCALL __stdcall
# else
#   define SWIGSTDCALL
# endif 
#endif

/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif

/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
# define _SCL_SECURE_NO_DEPRECATE
#endif


/* -----------------------------------------------------------------------------
 * swigrun.swg
 *
 * This file contains generic C API SWIG runtime support for pointer
 * type checking.
 * ----------------------------------------------------------------------------- */

/* This should only be incremented when either the layout of swig_type_info changes,
   or for whatever reason, the runtime changes incompatibly */
#define SWIG_RUNTIME_VERSION "4"

/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
# define SWIG_QUOTE_STRING(x) #x
# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
#else
# define SWIG_TYPE_TABLE_NAME
#endif

/*
  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
  creating a static or dynamic library from the SWIG runtime code.
  In 99.9% of the cases, SWIG just needs to declare them as 'static'.
  
  But only do this if strictly necessary, ie, if you have problems
  with your compiler or suchlike.
*/

#ifndef SWIGRUNTIME
# define SWIGRUNTIME SWIGINTERN
#endif

#ifndef SWIGRUNTIMEINLINE
# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
#endif

/*  Generic buffer size */
#ifndef SWIG_BUFFER_SIZE
# define SWIG_BUFFER_SIZE 1024
#endif

/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN        0x1
#define SWIG_CAST_NEW_MEMORY       0x2

/* Flags for new pointer objects */
#define SWIG_POINTER_OWN           0x1


/* 
   Flags/methods for returning states.
   
   The SWIG conversion methods, as ConvertPtr, return an integer 
   that tells if the conversion was successful or not. And if not,
   an error code can be returned (see swigerrors.swg for the codes).
   
   Use the following macros/flags to set or process the returning
   states.
   
   In old versions of SWIG, code such as the following was usually written:

     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
       // success code
     } else {
       //fail code
     }

   Now you can be more explicit:

    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
    if (SWIG_IsOK(res)) {
      // success code
    } else {
      // fail code
    }

   which is the same really, but now you can also do

    Type *ptr;
    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
    if (SWIG_IsOK(res)) {
      // success code
      if (SWIG_IsNewObj(res) {
        ...
	delete *ptr;
      } else {
        ...
      }
    } else {
      // fail code
    }
    
   I.e., now SWIG_ConvertPtr can return new objects and you can
   identify the case and take care of the deallocation. Of course that
   also requires SWIG_ConvertPtr to return new result values, such as

      int SWIG_ConvertPtr(obj, ptr,...) {         
        if (<obj is ok>) {			       
          if (<need new object>) {		       
            *ptr = <ptr to new allocated object>; 
            return SWIG_NEWOBJ;		       
          } else {				       
            *ptr = <ptr to old object>;	       
            return SWIG_OLDOBJ;		       
          } 				       
        } else {				       
          return SWIG_BADOBJ;		       
        }					       
      }

   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
   SWIG errors code.

   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
   allows to return the 'cast rank', for example, if you have this

       int food(double)
       int fooi(int);

   and you call
 
      food(1)   // cast rank '1'  (1 -> 1.0)
      fooi(1)   // cast rank '0'

   just use the SWIG_AddCast()/SWIG_CheckState()
*/

#define SWIG_OK                    (0) 
#define SWIG_ERROR                 (-1)
#define SWIG_IsOK(r)               (r >= 0)
#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  

/* The CastRankLimit says how many bits are used for the cast rank */
#define SWIG_CASTRANKLIMIT         (1 << 8)
/* The NewMask denotes the object was created (using new/malloc) */
#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
/* The TmpMask is for in/out typemaps that use temporal objects */
#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
/* Simple returning values */
#define SWIG_BADOBJ                (SWIG_ERROR)
#define SWIG_OLDOBJ                (SWIG_OK)
#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
/* Check, add and del mask methods */
#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))

/* Cast-Rank Mode */
#if defined(SWIG_CASTRANK_MODE)
#  ifndef SWIG_TypeRank
#    define SWIG_TypeRank             unsigned long
#  endif
#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
#    define SWIG_MAXCASTRANK          (2)
#  endif
#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
SWIGINTERNINLINE int SWIG_AddCast(int r) { 
  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
}
SWIGINTERNINLINE int SWIG_CheckState(int r) { 
  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
}
#else /* no cast-rank mode */
#  define SWIG_AddCast
#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
#endif


#include <string.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef void *(*swig_converter_func)(void *, int *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);

/* Structure to store information on one type */
typedef struct swig_type_info {
  const char             *name;			/* mangled name of this type */
  const char             *str;			/* human readable name of this type */
  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
  void                   *clientdata;		/* language specific type data */
  int                    owndata;		/* flag if the structure owns the clientdata */
} swig_type_info;

/* Structure to store a type and conversion function used for casting */
typedef struct swig_cast_info {
  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
  swig_converter_func     converter;		/* function to cast the void pointers */
  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
  struct swig_cast_info  *prev;			/* pointer to the previous cast */
} swig_cast_info;

/* Structure used to store module information
 * Each module generates one structure like this, and the runtime collects
 * all of these structures and stores them in a circularly linked list.*/
typedef struct swig_module_info {
  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
  size_t                 size;		        /* Number of types in this module */
  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
  swig_type_info         **type_initial;	/* Array of initially generated type structures */
  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
  void                    *clientdata;		/* Language specific module data */
} swig_module_info;

/* 
  Compare two type names skipping the space characters, therefore
  "char*" == "char *" and "Class<int>" == "Class<int >", etc.

  Return 0 when the two name types are equivalent, as in
  strncmp, but skipping ' '.
*/
SWIGRUNTIME int
SWIG_TypeNameComp(const char *f1, const char *l1,
		  const char *f2, const char *l2) {
  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
    while ((*f1 == ' ') && (f1 != l1)) ++f1;
    while ((*f2 == ' ') && (f2 != l2)) ++f2;
    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
  }
  return (int)((l1 - f1) - (l2 - f2));
}

/*
  Check type equivalence in a name list like <name1>|<name2>|...
  Return 0 if not equal, 1 if equal
*/
SWIGRUNTIME int
SWIG_TypeEquiv(const char *nb, const char *tb) {
  int equiv = 0;
  const char* te = tb + strlen(tb);
  const char* ne = nb;
  while (!equiv && *ne) {
    for (nb = ne; *ne; ++ne) {
      if (*ne == '|') break;
    }
    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
    if (*ne) ++ne;
  }
  return equiv;
}

/*
  Check type equivalence in a name list like <name1>|<name2>|...
  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
*/
SWIGRUNTIME int
SWIG_TypeCompare(const char *nb, const char *tb) {
  int equiv = 0;
  const char* te = tb + strlen(tb);
  const char* ne = nb;
  while (!equiv && *ne) {
    for (nb = ne; *ne; ++ne) {
      if (*ne == '|') break;
    }
    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
    if (*ne) ++ne;
  }
  return equiv;
}


/*
  Check the typename
*/
SWIGRUNTIME swig_cast_info *
SWIG_TypeCheck(const char *c, swig_type_info *ty) {
  if (ty) {
    swig_cast_info *iter = ty->cast;
    while (iter) {
      if (strcmp(iter->type->name, c) == 0) {
        if (iter == ty->cast)
          return iter;
        /* Move iter to the top of the linked list */
        iter->prev->next = iter->next;
        if (iter->next)
          iter->next->prev = iter->prev;
        iter->next = ty->cast;
        iter->prev = 0;
        if (ty->cast) ty->cast->prev = iter;
        ty->cast = iter;
        return iter;
      }
      iter = iter->next;
    }
  }
  return 0;
}

/* 
  Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
*/
SWIGRUNTIME swig_cast_info *
SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
  if (ty) {
    swig_cast_info *iter = ty->cast;
    while (iter) {
      if (iter->type == from) {
        if (iter == ty->cast)
          return iter;
        /* Move iter to the top of the linked list */
        iter->prev->next = iter->next;
        if (iter->next)
          iter->next->prev = iter->prev;
        iter->next = ty->cast;
        iter->prev = 0;
        if (ty->cast) ty->cast->prev = iter;
        ty->cast = iter;
        return iter;
      }
      iter = iter->next;
    }
  }
  return 0;
}

/*
  Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
}

/* 
   Dynamic pointer casting. Down an inheritance hierarchy
*/
SWIGRUNTIME swig_type_info *
SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
  swig_type_info *lastty = ty;
  if (!ty || !ty->dcast) return ty;
  while (ty && (ty->dcast)) {
    ty = (*ty->dcast)(ptr);
    if (ty) lastty = ty;
  }
  return lastty;
}

/*
  Return the name associated with this type
*/
SWIGRUNTIMEINLINE const char *
SWIG_TypeName(const swig_type_info *ty) {
  return ty->name;
}

/*
  Return the pretty name associated with this type,
  that is an unmangled type name in a form presentable to the user.
*/
SWIGRUNTIME const char *
SWIG_TypePrettyName(const swig_type_info *type) {
  /* The "str" field contains the equivalent pretty names of the
     type, separated by vertical-bar characters.  We choose
     to print the last name, as it is often (?) the most
     specific. */
  if (!type) return NULL;
  if (type->str != NULL) {
    const char *last_name = type->str;
    const char *s;
    for (s = type->str; *s; s++)
      if (*s == '|') last_name = s+1;
    return last_name;
  }
  else
    return type->name;
}

/* 
   Set the clientdata field for a type
*/
SWIGRUNTIME void
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
  swig_cast_info *cast = ti->cast;
  /* if (ti->clientdata == clientdata) return; */
  ti->clientdata = clientdata;
  
  while (cast) {
    if (!cast->converter) {
      swig_type_info *tc = cast->type;
      if (!tc->clientdata) {
	SWIG_TypeClientData(tc, clientdata);
      }
    }    
    cast = cast->next;
  }
}
SWIGRUNTIME void
SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
  SWIG_TypeClientData(ti, clientdata);
  ti->owndata = 1;
}
  
/*
  Search for a swig_type_info structure only by mangled name
  Search is a O(log #types)
  
  We start searching at module start, and finish searching when start == end.  
  Note: if start == end at the beginning of the function, we go all the way around
  the circular list.
*/
SWIGRUNTIME swig_type_info *
SWIG_MangledTypeQueryModule(swig_module_info *start, 
                            swig_module_info *end, 
		            const char *name) {
  swig_module_info *iter = start;
  do {
    if (iter->size) {
      register size_t l = 0;
      register size_t r = iter->size - 1;
      do {
	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
	register size_t i = (l + r) >> 1; 
	const char *iname = iter->types[i]->name;
	if (iname) {
	  register int compare = strcmp(name, iname);
	  if (compare == 0) {	    
	    return iter->types[i];
	  } else if (compare < 0) {
	    if (i) {
	      r = i - 1;
	    } else {
	      break;
	    }
	  } else if (compare > 0) {
	    l = i + 1;
	  }
	} else {
	  break; /* should never happen */
	}
      } while (l <= r);
    }
    iter = iter->next;
  } while (iter != end);
  return 0;
}

/*
  Search for a swig_type_info structure for either a mangled name or a human readable name.
  It first searches the mangled names of the types, which is a O(log #types)
  If a type is not found it then searches the human readable names, which is O(#types).
  
  We start searching at module start, and finish searching when start == end.  
  Note: if start == end at the beginning of the function, we go all the way around
  the circular list.
*/
SWIGRUNTIME swig_type_info *
SWIG_TypeQueryModule(swig_module_info *start, 
                     swig_module_info *end, 
		     const char *name) {
  /* STEP 1: Search the name field using binary search */
  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
  if (ret) {
    return ret;
  } else {
    /* STEP 2: If the type hasn't been found, do a complete search
       of the str field (the human readable name) */
    swig_module_info *iter = start;
    do {
      register size_t i = 0;
      for (; i < iter->size; ++i) {
	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
	  return iter->types[i];
      }
      iter = iter->next;
    } while (iter != end);
  }
  
  /* neither found a match */
  return 0;
}

/* 
   Pack binary data into a string
*/
SWIGRUNTIME char *
SWIG_PackData(char *c, void *ptr, size_t sz) {
  static const char hex[17] = "0123456789abcdef";
  register const unsigned char *u = (unsigned char *) ptr;
  register const unsigned char *eu =  u + sz;
  for (; u != eu; ++u) {
    register unsigned char uu = *u;
    *(c++) = hex[(uu & 0xf0) >> 4];
    *(c++) = hex[uu & 0xf];
  }
  return c;
}

/* 
   Unpack binary data from a string
*/
SWIGRUNTIME const char *
SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
  register unsigned char *u = (unsigned char *) ptr;
  register const unsigned char *eu = u + sz;
  for (; u != eu; ++u) {
    register char d = *(c++);
    register unsigned char uu;
    if ((d >= '0') && (d <= '9'))
      uu = ((d - '0') << 4);
    else if ((d >= 'a') && (d <= 'f'))
      uu = ((d - ('a'-10)) << 4);
    else 
      return (char *) 0;
    d = *(c++);
    if ((d >= '0') && (d <= '9'))
      uu |= (d - '0');
    else if ((d >= 'a') && (d <= 'f'))
      uu |= (d - ('a'-10));
    else 
      return (char *) 0;
    *u = uu;
  }
  return c;
}

/* 
   Pack 'void *' into a string buffer.
*/
SWIGRUNTIME char *
SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
  char *r = buff;
  if ((2*sizeof(void *) + 2) > bsz) return 0;
  *(r++) = '_';
  r = SWIG_PackData(r,&ptr,sizeof(void *));
  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
  strcpy(r,name);
  return buff;
}

SWIGRUNTIME const char *
SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
  if (*c != '_') {
    if (strcmp(c,"NULL") == 0) {
      *ptr = (void *) 0;
      return name;
    } else {
      return 0;
    }
  }
  return SWIG_UnpackData(++c,ptr,sizeof(void *));
}

SWIGRUNTIME char *
SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
  char *r = buff;
  size_t lname = (name ? strlen(name) : 0);
  if ((2*sz + 2 + lname) > bsz) return 0;
  *(r++) = '_';
  r = SWIG_PackData(r,ptr,sz);
  if (lname) {
    strncpy(r,name,lname+1);
  } else {
    *r = 0;
  }
  return buff;
}

SWIGRUNTIME const char *
SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
  if (*c != '_') {
    if (strcmp(c,"NULL") == 0) {
      memset(ptr,0,sz);
      return name;
    } else {
      return 0;
    }
  }
  return SWIG_UnpackData(++c,ptr,sz);
}

#ifdef __cplusplus
}
#endif

/*  Errors in SWIG */
#define  SWIG_UnknownError    	   -1 
#define  SWIG_IOError        	   -2 
#define  SWIG_RuntimeError   	   -3 
#define  SWIG_IndexError     	   -4 
#define  SWIG_TypeError      	   -5 
#define  SWIG_DivisionByZero 	   -6 
#define  SWIG_OverflowError  	   -7 
#define  SWIG_SyntaxError    	   -8 
#define  SWIG_ValueError     	   -9 
#define  SWIG_SystemError    	   -10
#define  SWIG_AttributeError 	   -11
#define  SWIG_MemoryError    	   -12 
#define  SWIG_NullReferenceError   -13



#include <ruby.h>

/* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which
 * breaks using rb_intern as an lvalue, as SWIG does.  We work around this
 * issue for now by disabling this.
 * https://sourceforge.net/tracker/?func=detail&aid=2859614&group_id=1645&atid=101645
 */
#ifdef rb_intern
# undef rb_intern
#endif

/* Remove global macros defined in Ruby's win32.h */
#ifdef write
# undef write
#endif
#ifdef read
# undef read
#endif
#ifdef bind
# undef bind
#endif
#ifdef close
# undef close
#endif
#ifdef connect
# undef connect
#endif


/* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
#ifndef NUM2LL
#define NUM2LL(x) NUM2LONG((x))
#endif
#ifndef LL2NUM
#define LL2NUM(x) INT2NUM((long) (x))
#endif
#ifndef ULL2NUM
#define ULL2NUM(x) UINT2NUM((unsigned long) (x))
#endif

/* Ruby 1.7 doesn't (yet) define NUM2ULL() */
#ifndef NUM2ULL
#ifdef HAVE_LONG_LONG
#define NUM2ULL(x) rb_num2ull((x))
#else
#define NUM2ULL(x) NUM2ULONG(x)
#endif
#endif

/* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */
/* Define these for older versions so we can just write code the new way */
#ifndef RSTRING_LEN
# define RSTRING_LEN(x) RSTRING(x)->len
#endif
#ifndef RSTRING_PTR
# define RSTRING_PTR(x) RSTRING(x)->ptr
#endif
#ifndef RSTRING_END
# define RSTRING_END(x) (RSTRING_PTR(x) + RSTRING_LEN(x))
#endif
#ifndef RARRAY_LEN
# define RARRAY_LEN(x) RARRAY(x)->len
#endif
#ifndef RARRAY_PTR
# define RARRAY_PTR(x) RARRAY(x)->ptr
#endif
#ifndef RFLOAT_VALUE
# define RFLOAT_VALUE(x) RFLOAT(x)->value
#endif
#ifndef DOUBLE2NUM
# define DOUBLE2NUM(x) rb_float_new(x)
#endif
#ifndef RHASH_TBL
# define RHASH_TBL(x) (RHASH(x)->tbl)
#endif
#ifndef RHASH_ITER_LEV
# define RHASH_ITER_LEV(x) (RHASH(x)->iter_lev)
#endif
#ifndef RHASH_IFNONE
# define RHASH_IFNONE(x) (RHASH(x)->ifnone)
#endif
#ifndef RHASH_SIZE
# define RHASH_SIZE(x) (RHASH(x)->tbl->num_entries)
#endif
#ifndef RHASH_EMPTY_P
# define RHASH_EMPTY_P(x) (RHASH_SIZE(x) == 0)
#endif
#ifndef RSTRUCT_LEN
# define RSTRUCT_LEN(x) RSTRUCT(x)->len
#endif
#ifndef RSTRUCT_PTR
# define RSTRUCT_PTR(x) RSTRUCT(x)->ptr
#endif



/*
 * Need to be very careful about how these macros are defined, especially
 * when compiling C++ code or C code with an ANSI C compiler.
 *
 * VALUEFUNC(f) is a macro used to typecast a C function that implements
 * a Ruby method so that it can be passed as an argument to API functions
 * like rb_define_method() and rb_define_singleton_method().
 *
 * VOIDFUNC(f) is a macro used to typecast a C function that implements
 * either the "mark" or "free" stuff for a Ruby Data object, so that it
 * can be passed as an argument to API functions like Data_Wrap_Struct()
 * and Data_Make_Struct().
 */
 
#ifdef __cplusplus
#  ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
#    define PROTECTFUNC(f) ((VALUE (*)()) f)
#    define VALUEFUNC(f) ((VALUE (*)()) f)
#    define VOIDFUNC(f)  ((void (*)()) f)
#  else
#    ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
#      define PROTECTFUNC(f) ((VALUE (*)()) f)
#      define VALUEFUNC(f) ((VALUE (*)()) f)
#      define VOIDFUNC(f)  ((RUBY_DATA_FUNC) f)
#    else /* These definitions should work for Ruby 1.7+ */
#      define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
#      define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
#      define VOIDFUNC(f)  ((RUBY_DATA_FUNC) f)
#    endif
#  endif
#else
#  define VALUEFUNC(f) (f)
#  define VOIDFUNC(f) (f)
#endif

/* Don't use for expressions have side effect */
#ifndef RB_STRING_VALUE
#define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
#endif
#ifndef StringValue
#define StringValue(s) RB_STRING_VALUE(s)
#endif
#ifndef StringValuePtr
#define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s))
#endif
#ifndef StringValueLen
#define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
#endif
#ifndef SafeStringValue
#define SafeStringValue(v) do {\
    StringValue(v);\
    rb_check_safe_str(v);\
} while (0)
#endif

#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
#define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
#define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
#endif

static VALUE _mSWIG = Qnil;

/* -----------------------------------------------------------------------------
 * error manipulation
 * ----------------------------------------------------------------------------- */


/* Define some additional error types */
#define SWIG_ObjectPreviouslyDeletedError  -100


/* Define custom exceptions for errors that do not map to existing Ruby
   exceptions.  Note this only works for C++ since a global cannot be
   initialized by a function in C.  For C, fallback to rb_eRuntimeError.*/

SWIGINTERN VALUE 
getNullReferenceError(void) {
  static int init = 0;
  static VALUE rb_eNullReferenceError ;
  if (!init) {
    init = 1;
    rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError);
  }
  return rb_eNullReferenceError;
} 

SWIGINTERN VALUE 
getObjectPreviouslyDeletedError(void) {
  static int init = 0;
  static VALUE rb_eObjectPreviouslyDeleted ;
  if (!init) {
    init = 1;
    rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError);
  }
  return rb_eObjectPreviouslyDeleted;
} 


SWIGINTERN VALUE
SWIG_Ruby_ErrorType(int SWIG_code) {
  VALUE type;
  switch (SWIG_code) {
  case SWIG_MemoryError:
    type = rb_eNoMemError;
    break;
  case SWIG_IOError:
    type = rb_eIOError;
    break;
  case SWIG_RuntimeError:
    type = rb_eRuntimeError;
    break;
  case SWIG_IndexError:
    type = rb_eIndexError;
    break;
  case SWIG_TypeError:
    type = rb_eTypeError;
    break;
  case SWIG_DivisionByZero:
    type = rb_eZeroDivError;
    break;
  case SWIG_OverflowError:
    type = rb_eRangeError;
    break;
  case SWIG_SyntaxError:
    type = rb_eSyntaxError;
    break;
  case SWIG_ValueError:
    type = rb_eArgError;
    break;
  case SWIG_SystemError:
    type = rb_eFatal;
    break;
  case SWIG_AttributeError:
    type = rb_eRuntimeError;
    break;
  case SWIG_NullReferenceError:
    type = getNullReferenceError();
    break;
  case SWIG_ObjectPreviouslyDeletedError:
    type = getObjectPreviouslyDeletedError();
    break;
  case SWIG_UnknownError:
    type = rb_eRuntimeError;
    break;
  default:
    type = rb_eRuntimeError;
  }
  return type;
}


/* This function is called when a user inputs a wrong argument to
   a method.
 */
SWIGINTERN 
const char* Ruby_Format_TypeError( const char* msg,
				   const char* type, 
				   const char* name, 
				   const int argn,
				   VALUE input )
{
  char buf[128];
  VALUE str;
  VALUE asStr;
  if ( msg && *msg )
    {
      str = rb_str_new2(msg);
    }
  else
    {
      str = rb_str_new(NULL, 0);
    }

  str = rb_str_cat2( str, "Expected argument " );
  sprintf( buf, "%d of type ", argn-1 );
  str = rb_str_cat2( str, buf );
  str = rb_str_cat2( str, type );
  str = rb_str_cat2( str, ", but got " );
  str = rb_str_cat2( str, rb_obj_classname(input) );
  str = rb_str_cat2( str, " " );
  asStr = rb_inspect(input);
  if ( RSTRING_LEN(asStr) > 30 )
    {
      str = rb_str_cat( str, StringValuePtr(asStr), 30 );
      str = rb_str_cat2( str, "..." );
    }
  else
    {
      str = rb_str_append( str, asStr );
    }

  if ( name )
    {
      str = rb_str_cat2( str, "\n\tin SWIG method '" );
      str = rb_str_cat2( str, name );
      str = rb_str_cat2( str, "'" );
    }

  return StringValuePtr( str );
}

/* This function is called when an overloaded method fails */
SWIGINTERN 
void Ruby_Format_OverloadedError(
				 const int argc,
				 const int maxargs,
				 const char* method, 
				 const char* prototypes 
				 )
{
  const char* msg = "Wrong # of arguments";
  if ( argc <= maxargs ) msg = "Wrong arguments";
  rb_raise(rb_eArgError,"%s for overloaded method '%s'.\n"  
	   "Possible C/C++ prototypes are:\n%s",
	   msg, method, prototypes);
}

/* -----------------------------------------------------------------------------
 * rubytracking.swg
 *
 * This file contains support for tracking mappings from 
 * Ruby objects to C++ objects.  This functionality is needed
 * to implement mark functions for Ruby's mark and sweep
 * garbage collector.
 * ----------------------------------------------------------------------------- */

#ifdef __cplusplus
extern "C" {
#endif

/* Ruby 1.8 actually assumes the first case. */
#if SIZEOF_VOIDP == SIZEOF_LONG
#  define SWIG2NUM(v) LONG2NUM((unsigned long)v)
#  define NUM2SWIG(x) (unsigned long)NUM2LONG(x)
#elif SIZEOF_VOIDP == SIZEOF_LONG_LONG
#  define SWIG2NUM(v) LL2NUM((unsigned long long)v)
#  define NUM2SWIG(x) (unsigned long long)NUM2LL(x)
#else
#  error sizeof(void*) is not the same as long or long long
#endif


/* Global Ruby hash table to store Trackings from C/C++
   structs to Ruby Objects. 
*/
static VALUE swig_ruby_trackings = Qnil;

/* Global variable that stores a reference to the ruby
   hash table delete function. */
static ID swig_ruby_hash_delete;

/* Setup a Ruby hash table to store Trackings */
SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
  /* Create a ruby hash table to store Trackings from C++ 
     objects to Ruby objects. */

  /* Try to see if some other .so has already created a 
     tracking hash table, which we keep hidden in an instance var
     in the SWIG module.
     This is done to allow multiple DSOs to share the same
     tracking table.
  */
  ID trackings_id = rb_intern( "@__trackings__" );
  VALUE verbose = rb_gv_get("VERBOSE");
  rb_gv_set("VERBOSE", Qfalse);
  swig_ruby_trackings = rb_ivar_get( _mSWIG, trackings_id );
  rb_gv_set("VERBOSE", verbose);

  /* No, it hasn't.  Create one ourselves */ 
  if ( swig_ruby_trackings == Qnil )
    {
      swig_ruby_trackings = rb_hash_new();
      rb_ivar_set( _mSWIG, trackings_id, swig_ruby_trackings );
    }

  /* Now store a reference to the hash table delete function
     so that we only have to look it up once.*/
  swig_ruby_hash_delete = rb_intern("delete");
}

/* Get a Ruby number to reference a pointer */
SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
  /* We cast the pointer to an unsigned long
     and then store a reference to it using
     a Ruby number object. */

  /* Convert the pointer to a Ruby number */
  return SWIG2NUM(ptr);
}

/* Get a Ruby number to reference an object */
SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
  /* We cast the object to an unsigned long
     and then store a reference to it using
     a Ruby number object. */

  /* Convert the Object to a Ruby number */
  return SWIG2NUM(object);
}

/* Get a Ruby object from a previously stored reference */
SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
  /* The provided Ruby number object is a reference
     to the Ruby object we want.*/

  /* Convert the Ruby number to a Ruby object */
  return NUM2SWIG(reference);
}

/* Add a Tracking from a C/C++ struct to a Ruby object */
SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
  /* In a Ruby hash table we store the pointer and
     the associated Ruby object.  The trick here is
     that we cannot store the Ruby object directly - if
     we do then it cannot be garbage collected.  So
     instead we typecast it as a unsigned long and
     convert it to a Ruby number object.*/

  /* Get a reference to the pointer as a Ruby number */
  VALUE key = SWIG_RubyPtrToReference(ptr);

  /* Get a reference to the Ruby object as a Ruby number */
  VALUE value = SWIG_RubyObjectToReference(object);

  /* Store the mapping to the global hash table. */
  rb_hash_aset(swig_ruby_trackings, key, value);
}

/* Get the Ruby object that owns the specified C/C++ struct */
SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
  /* Get a reference to the pointer as a Ruby number */
  VALUE key = SWIG_RubyPtrToReference(ptr);

  /* Now lookup the value stored in the global hash table */
  VALUE value = rb_hash_aref(swig_ruby_trackings, key);
	
  if (value == Qnil) {
    /* No object exists - return nil. */
    return Qnil;
  }
  else {
    /* Convert this value to Ruby object */
    return SWIG_RubyReferenceToObject(value);
  }
}

/* Remove a Tracking from a C/C++ struct to a Ruby object.  It
   is very important to remove objects once they are destroyed
   since the same memory address may be reused later to create
   a new object. */
SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
  /* Get a reference to the pointer as a Ruby number */
  VALUE key = SWIG_RubyPtrToReference(ptr);

  /* Delete the object from the hash table by calling Ruby's
     do this we need to call the Hash.delete method.*/
  rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key);
}

/* This is a helper method that unlinks a Ruby object from its
   underlying C++ object.  This is needed if the lifetime of the
   Ruby object is longer than the C++ object */
SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
  VALUE object = SWIG_RubyInstanceFor(ptr);

  if (object != Qnil) {
    DATA_PTR(object) = 0;
  }
}


#ifdef __cplusplus
}
#endif

/* -----------------------------------------------------------------------------
 * Ruby API portion that goes into the runtime
 * ----------------------------------------------------------------------------- */

#ifdef __cplusplus
extern "C" {
#endif

SWIGINTERN VALUE
SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
  if (NIL_P(target)) {
    target = o;
  } else {
    if (TYPE(target) != T_ARRAY) {
      VALUE o2 = target;
      target = rb_ary_new();
      rb_ary_push(target, o2);
    }
    rb_ary_push(target, o);
  }
  return target;
}

/* For ruby1.8.4 and earlier. */
#ifndef RUBY_INIT_STACK
   RUBY_EXTERN void Init_stack(VALUE* addr);
#  define RUBY_INIT_STACK \
   VALUE variable_in_this_stack_frame; \
   Init_stack(&variable_in_this_stack_frame);
#endif


#ifdef __cplusplus
}
#endif


/* -----------------------------------------------------------------------------
 * rubyrun.swg
 *
 * This file contains the runtime support for Ruby modules
 * and includes code for managing global variables and pointer
 * type checking.
 * ----------------------------------------------------------------------------- */

/* For backward compatibility only */
#define SWIG_POINTER_EXCEPTION  0

/* for raw pointers */
#define SWIG_ConvertPtr(obj, pptr, type, flags)         SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own)  SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own)
#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Ruby_NewPointerObj(ptr, type, flags)
#define SWIG_AcquirePtr(ptr, own)                       SWIG_Ruby_AcquirePtr(ptr, own)
#define swig_owntype                                    ruby_owntype

/* for raw packed data */
#define SWIG_ConvertPacked(obj, ptr, sz, ty)            SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
#define SWIG_NewPackedObj(ptr, sz, type)                SWIG_Ruby_NewPackedObj(ptr, sz, type)

/* for class or struct pointers */
#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)

/* for C or C++ function pointers */
#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)

/* for C++ member pointers, ie, member methods */
#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty)
#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_Ruby_NewPackedObj(ptr, sz, type)


/* Runtime API */

#define SWIG_GetModule(clientdata)                      SWIG_Ruby_GetModule()	
#define SWIG_SetModule(clientdata, pointer) 		SWIG_Ruby_SetModule(pointer)


/* Error manipulation */

#define SWIG_ErrorType(code)                            SWIG_Ruby_ErrorType(code)               
#define SWIG_Error(code, msg)            		rb_raise(SWIG_Ruby_ErrorType(code), "%s", msg)
#define SWIG_fail                        		goto fail				 


/* Ruby-specific SWIG API */

#define SWIG_InitRuntime()                              SWIG_Ruby_InitRuntime()              
#define SWIG_define_class(ty)                        	SWIG_Ruby_define_class(ty)
#define SWIG_NewClassInstance(value, ty)             	SWIG_Ruby_NewClassInstance(value, ty)
#define SWIG_MangleStr(value)                        	SWIG_Ruby_MangleStr(value)		  
#define SWIG_CheckConvert(value, ty)                 	SWIG_Ruby_CheckConvert(value, ty)	  

#include "assert.h"

/* -----------------------------------------------------------------------------
 * pointers/data manipulation
 * ----------------------------------------------------------------------------- */

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
  VALUE klass;
  VALUE mImpl;
  void  (*mark)(void *);
  void  (*destroy)(void *);
  int trackObjects;
} swig_class;


/* Global pointer used to keep some internal SWIG stuff */
static VALUE _cSWIG_Pointer = Qnil;
static VALUE swig_runtime_data_type_pointer = Qnil;

/* Global IDs used to keep some internal SWIG stuff */
static ID swig_arity_id = 0;
static ID swig_call_id  = 0;

/*
  If your swig extension is to be run within an embedded ruby and has
  director callbacks, you should set -DRUBY_EMBEDDED during compilation.  
  This will reset ruby's stack frame on each entry point from the main 
  program the first time a virtual director function is invoked (in a 
  non-recursive way).
  If this is not done, you run the risk of Ruby trashing the stack.
*/

#ifdef RUBY_EMBEDDED

#  define SWIG_INIT_STACK                            \
      if ( !swig_virtual_calls ) { RUBY_INIT_STACK } \
      ++swig_virtual_calls;
#  define SWIG_RELEASE_STACK --swig_virtual_calls;
#  define Ruby_DirectorTypeMismatchException(x) \
          rb_raise( rb_eTypeError, "%s", x ); return c_result;

      static unsigned int swig_virtual_calls = 0;

#else  /* normal non-embedded extension */

#  define SWIG_INIT_STACK
#  define SWIG_RELEASE_STACK
#  define Ruby_DirectorTypeMismatchException(x) \
          throw Swig::DirectorTypeMismatchException( x );

#endif  /* RUBY_EMBEDDED */


SWIGRUNTIME VALUE 
getExceptionClass(void) {
  static int init = 0;
  static VALUE rubyExceptionClass ;
  if (!init) {
    init = 1;
    rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception"));
  }
  return rubyExceptionClass;
} 

/* This code checks to see if the Ruby object being raised as part
   of an exception inherits from the Ruby class Exception.  If so,
   the object is simply returned.  If not, then a new Ruby exception
   object is created and that will be returned to Ruby.*/
SWIGRUNTIME VALUE
SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) {
  VALUE exceptionClass = getExceptionClass();
  if (rb_obj_is_kind_of(obj, exceptionClass)) {
    return obj;
  }  else {
    return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj));
  }
}

/* Initialize Ruby runtime support */
SWIGRUNTIME void
SWIG_Ruby_InitRuntime(void)
{
  if (_mSWIG == Qnil) {
    _mSWIG = rb_define_module("SWIG");
    swig_call_id  = rb_intern("call");
    swig_arity_id = rb_intern("arity");
  }
}

/* Define Ruby class for C type */
SWIGRUNTIME void
SWIG_Ruby_define_class(swig_type_info *type)
{
  VALUE klass;
  char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
  sprintf(klass_name, "TYPE%s", type->name);
  if (NIL_P(_cSWIG_Pointer)) {
    _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
    rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
  }
  klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
  free((void *) klass_name);
}

/* Create a new pointer object */
SWIGRUNTIME VALUE
SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
{
  int own =  flags & SWIG_POINTER_OWN; 
  int track;
  char *klass_name;
  swig_class *sklass;
  VALUE klass;
  VALUE obj;
  
  if (!ptr)
    return Qnil;
  
  if (type->clientdata) {
    sklass = (swig_class *) type->clientdata;
		
    /* Are we tracking this class and have we already returned this Ruby object? */
    track = sklass->trackObjects;
    if (track) {
      obj = SWIG_RubyInstanceFor(ptr);
      
      /* Check the object's type and make sure it has the correct type.
        It might not in cases where methods do things like 
        downcast methods. */
      if (obj != Qnil) {
        VALUE value = rb_iv_get(obj, "@__swigtype__");
        char* type_name = RSTRING_PTR(value);
				
        if (strcmp(type->name, type_name) == 0) {
          return obj;
        }
      }
    }

    /* Create a new Ruby object */
    obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark), 
			   ( own ? VOIDFUNC(sklass->destroy) : 
			     (track ? VOIDFUNC(SWIG_RubyRemoveTracking) : 0 )
			     ), ptr);

    /* If tracking is on for this class then track this object. */
    if (track) {
      SWIG_RubyAddTracking(ptr, obj);
    }
  } else {
    klass_name = (char *) malloc(4 + strlen(type->name) + 1);
    sprintf(klass_name, "TYPE%s", type->name);
    klass = rb_const_get(_mSWIG, rb_intern(klass_name));
    free((void *) klass_name);
    obj = Data_Wrap_Struct(klass, 0, 0, ptr);
  }
  rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
  
  return obj;
}

/* Create a new class instance (always owned) */
SWIGRUNTIME VALUE
SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
{
  VALUE obj;
  swig_class *sklass = (swig_class *) type->clientdata;
  obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
  rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
  return obj;
}

/* Get type mangle from class name */
SWIGRUNTIMEINLINE char *
SWIG_Ruby_MangleStr(VALUE obj)
{
  VALUE stype = rb_iv_get(obj, "@__swigtype__");
  return StringValuePtr(stype);
}

/* Acquire a pointer value */
typedef void (*ruby_owntype)(void*);

SWIGRUNTIME ruby_owntype
SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) {
  if (obj) {
    ruby_owntype oldown = RDATA(obj)->dfree;
    RDATA(obj)->dfree = own;
    return oldown;
  } else {
    return 0;
  }
}

/* Convert a pointer value */
SWIGRUNTIME int
SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own)
{
  char *c;
  swig_cast_info *tc;
  void *vptr = 0;

  /* Grab the pointer */
  if (NIL_P(obj)) {
    *ptr = 0;
    return SWIG_OK;
  } else {
    if (TYPE(obj) != T_DATA) {
      return SWIG_ERROR;
    }
    Data_Get_Struct(obj, void, vptr);
  }
  
  if (own) *own = RDATA(obj)->dfree;
    
  /* Check to see if the input object is giving up ownership
     of the underlying C struct or C++ object.  If so then we
     need to reset the destructor since the Ruby object no 
     longer owns the underlying C++ object.*/ 
  if (flags & SWIG_POINTER_DISOWN) {
    /* Is tracking on for this class? */
    int track = 0;
    if (ty && ty->clientdata) {
      swig_class *sklass = (swig_class *) ty->clientdata;
      track = sklass->trackObjects;
    }
		
    if (track) {
      /* We are tracking objects for this class.  Thus we change the destructor
       * to SWIG_RubyRemoveTracking.  This allows us to
       * remove the mapping from the C++ to Ruby object
       * when the Ruby object is garbage collected.  If we don't
       * do this, then it is possible we will return a reference 
       * to a Ruby object that no longer exists thereby crashing Ruby. */
      RDATA(obj)->dfree = SWIG_RubyRemoveTracking;
    } else {    
      RDATA(obj)->dfree = 0;
    }
  }

  /* Do type-checking if type info was provided */
  if (ty) {
    if (ty->clientdata) {
      if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
        if (vptr == 0) {
          /* The object has already been deleted */
          return SWIG_ObjectPreviouslyDeletedError;
        }
        *ptr = vptr;
        return SWIG_OK;
      }
    }
    if ((c = SWIG_MangleStr(obj)) == NULL) {
      return SWIG_ERROR;
    }
    tc = SWIG_TypeCheck(c, ty);
    if (!tc) {
      return SWIG_ERROR;
    } else {
      int newmemory = 0;
      *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
      assert(!newmemory); /* newmemory handling not yet implemented */
    }
  } else {
    *ptr = vptr;
  }
  
  return SWIG_OK;
}

/* Check convert */
SWIGRUNTIMEINLINE int
SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
{
  char *c = SWIG_MangleStr(obj);
  if (!c) return 0;
  return SWIG_TypeCheck(c,ty) != 0;
}

SWIGRUNTIME VALUE
SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
  char result[1024];
  char *r = result;
  if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
  *(r++) = '_';
  r = SWIG_PackData(r, ptr, sz);
  strcpy(r, type->name);
  return rb_str_new2(result);
}

/* Convert a packed value value */
SWIGRUNTIME int
SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
  swig_cast_info *tc;
  const char  *c;

  if (TYPE(obj) != T_STRING) goto type_error;
  c = StringValuePtr(obj);
  /* Pointer values must start with leading underscore */
  if (*c != '_') goto type_error;
  c++;
  c = SWIG_UnpackData(c, ptr, sz);
  if (ty) {
    tc = SWIG_TypeCheck(c, ty);
    if (!tc) goto type_error;
  }
  return SWIG_OK;

 type_error:
  return SWIG_ERROR;
}

SWIGRUNTIME swig_module_info *
SWIG_Ruby_GetModule(void)
{
  VALUE pointer;
  swig_module_info *ret = 0;
  VALUE verbose = rb_gv_get("VERBOSE");

 /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */
  rb_gv_set("VERBOSE", Qfalse);
  
  /* first check if pointer already created */
  pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
  if (pointer != Qnil) {
    Data_Get_Struct(pointer, swig_module_info, ret);
  }

  /* reinstate warnings */
  rb_gv_set("VERBOSE", verbose);
  return ret;
}

SWIGRUNTIME void 
SWIG_Ruby_SetModule(swig_module_info *pointer)
{
  /* register a new class */
  VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
  /* create and store the structure pointer to a global variable */
  swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
  rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
}

/* This function can be used to check whether a proc or method or similarly
   callable function has been passed.  Usually used in a %typecheck, like:

   %typecheck(c_callback_t, precedence=SWIG_TYPECHECK_POINTER) {
        $result = SWIG_Ruby_isCallable( $input );
   }
 */
SWIGINTERN
int SWIG_Ruby_isCallable( VALUE proc )
{
  if ( rb_respond_to( proc, swig_call_id ) == Qtrue )
    return 1;
  return 0;
}

/* This function can be used to check the arity (number of arguments)
   a proc or method can take.  Usually used in a %typecheck.
   Valid arities will be that equal to minimal or those < 0
   which indicate a variable number of parameters at the end.
 */
SWIGINTERN
int SWIG_Ruby_arity( VALUE proc, int minimal )
{
  if ( rb_respond_to( proc, swig_arity_id ) == Qtrue )
    {
      VALUE num = rb_funcall( proc, swig_arity_id, 0 );
      int arity = NUM2INT(num);
      if ( arity < 0 && (arity+1) < -minimal ) return 1;
      if ( arity == minimal ) return 1;
      return 1;
    }
  return 0;
}


#ifdef __cplusplus
}
#endif



#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 

#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 



  #define SWIG_exception(code, msg) do { SWIG_Error(code, msg);; } while(0) 

/* -----------------------------------------------------------------------------
 * director.swg
 *
 * This file contains support for director classes that proxy
 * method calls from C++ to Ruby extensions.
 * ----------------------------------------------------------------------------- */

/*
  Use -DSWIG_DIRECTOR_NOUEH if you prefer to avoid the use of the
  Undefined Exception Handler provided by swift
*/
#ifndef SWIG_DIRECTOR_NOUEH
#ifndef SWIG_DIRECTOR_UEH
#define SWIG_DIRECTOR_UEH
#endif
#endif

#ifdef __cplusplus

#include <string>
#include <iostream>
#include <map>

# define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG)

namespace Swig {
  /* memory handler */
  struct GCItem 
  {
    virtual ~GCItem()
    {
    }

    virtual ruby_owntype get_own() const
    {
      return 0;
    }
  };
  
  struct GCItem_var
  {
    GCItem_var(GCItem *item = 0) : _item(item)
    {
    }

    GCItem_var& operator=(GCItem *item)
    {
      GCItem *tmp = _item;
      _item = item;
      delete tmp;
      return *this;
    }
    
    ~GCItem_var() 
    {
      delete _item;
    }
    
    GCItem * operator->() const
    {
      return _item;
    }
    
  private:
    GCItem *_item;
  };


  template <typename Type>
  struct GCItem_T : GCItem
  {
    GCItem_T(Type *ptr) : _ptr(ptr)
    {
    }
    
    virtual ~GCItem_T() 
    {
      delete _ptr;
    }
    
  private:
    Type *_ptr;
  };

  struct GCItem_Object : GCItem
  {
    GCItem_Object(ruby_owntype own) : _own(own)
    {
    }
    
    virtual ~GCItem_Object() 
    {
    }

    ruby_owntype get_own() const
    {
      return _own;
    }
    
  private:
    ruby_owntype _own;
  };


  template <typename Type>
  struct GCArray_T : GCItem
  {
    GCArray_T(Type *ptr) : _ptr(ptr)
    {
    }
    
    virtual ~GCArray_T() 
    {
      delete[] _ptr;
    }
    
  private:
    Type *_ptr;
  };


  /* body args */
  struct body_args {
    VALUE recv;
    ID id;
    int argc;
    VALUE *argv;
  };
  
  /* Base class for director exceptions */
  class DirectorException {
  protected:
    VALUE swig_error;
    std::string swig_msg;
  protected:
    DirectorException(VALUE error)
      : swig_error(error)
    {
    }
    
    DirectorException(VALUE error, const char* hdr, const char* msg ="") 
      : swig_error(error), swig_msg(hdr) {
      if (strlen(msg)) {
	swig_msg += " ";
	swig_msg += msg;
      }
      if (swig_msg.size()) {
	VALUE str = rb_str_new(swig_msg.data(), swig_msg.size());
	swig_error = rb_exc_new3(error, str);
      } else {
	swig_error = error;
      }
    }
  public:
    VALUE getType() const  { 
      return CLASS_OF(swig_error); 
    }
    VALUE getError() const {
      return swig_error;
    }
    const std::string& getMessage() const 
    {
      return swig_msg;
    }
    
    virtual ~DirectorException() {}
  };
  
  /* unknown exception handler  */

  class UnknownExceptionHandler 
  {
#ifdef SWIG_DIRECTOR_UEH
    static void handler() {
      try {
	throw;
      } catch (DirectorException& e) {
	std::cerr << "SWIG Director exception caught:" << std::endl
		  << e.getMessage() << std::endl;
      } catch (std::exception& e) {
	std::cerr << "std::exception caught: "<< e.what() << std::endl;
      } catch (...) {
	std::cerr << "Unknown exception caught." << std::endl;
      }      
      std::cerr << std::endl
		<< "Ruby interpreter traceback:" << std::endl;
      std::cerr << std::endl;      
      std::cerr << "This exception was caught by the SWIG unexpected exception handler." << std::endl
		<< "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl
		<< std::endl
		<< "Exception is being re-thrown, program will like abort/terminate." << std::endl;
      throw;
    }
    
  public:    
    std::unexpected_handler old;
    UnknownExceptionHandler(std::unexpected_handler nh = handler)
    {
      old = std::set_unexpected(nh);
    }

    ~UnknownExceptionHandler()
    {
      std::set_unexpected(old);
    }
#endif
  };


  /* Type mismatch in the return value from a Ruby method call */
  class DirectorTypeMismatchException : public Swig::DirectorException {
  public:
    DirectorTypeMismatchException(VALUE error, const char *msg="")
      : Swig::DirectorException(error, "SWIG director type mismatch", msg) 
    {
    }

    DirectorTypeMismatchException(const char *msg="")
      : Swig::DirectorException(rb_eTypeError, "SWIG director type mismatch", msg) 
    {
    }

    static void raise(VALUE error, const char *msg) {
      throw DirectorTypeMismatchException(error, msg);
    }

    static void raise(const char *msg) {
      throw DirectorTypeMismatchException(msg);
    }
  };

  /* Any Ruby exception that occurs during a director method call */
  class DirectorMethodException : public Swig::DirectorException {
  public:
    DirectorMethodException(VALUE error) 
      : Swig::DirectorException(error) {
    }

    DirectorMethodException(const char* msg = "") 
      : Swig::DirectorException(rb_eRuntimeError, "SWIG director method error.", msg) {
    }
    
    static void raise(VALUE error)
    {
      throw DirectorMethodException(error);
    }    
  };

  /* Attempted to call a pure virtual method via a director method */
  class DirectorPureVirtualException : public Swig::DirectorException
  {
  public:
    DirectorPureVirtualException(const char* msg = "") 
      : DirectorException(rb_eRuntimeError, "SWIG director pure virtual method called", msg)
    { 
    }

    static void raise(const char *msg) 
    {
      throw DirectorPureVirtualException(msg);
    }
  };

  /* Simple thread abstraction for pthreads on win32 */
#ifdef __THREAD__
# define __PTHREAD__
# if defined(_WIN32) || defined(__WIN32__)
#  define pthread_mutex_lock EnterCriticalSection
#  define pthread_mutex_unlock LeaveCriticalSection
#  define pthread_mutex_t CRITICAL_SECTION
#  define SWIG_MUTEX_INIT(var) var
# else
#  include <pthread.h>
#  define SWIG_MUTEX_INIT(var) var = PTHREAD_MUTEX_INITIALIZER 
# endif
#endif

#ifdef  __PTHREAD__
  struct Guard
  {
    pthread_mutex_t *_mutex;
    
    Guard(pthread_mutex_t &mutex) : _mutex(&mutex)
    {
      pthread_mutex_lock(_mutex);
    }
    
    ~Guard()
    {
      pthread_mutex_unlock(_mutex);
    }
  };
# define SWIG_GUARD(mutex) Guard _guard(mutex)
#else
# define SWIG_GUARD(mutex) 
#endif

  /* director base class */
  class Director {
  private:
    /* pointer to the wrapped Ruby object */
    VALUE swig_self;
    /* flag indicating whether the object is owned by Ruby or c++ */
    mutable bool swig_disown_flag;

  public:
    /* wrap a Ruby object, optionally taking ownership */
    Director(VALUE self) : swig_self(self), swig_disown_flag(false) {
    }

    /* discard our reference at destruction */
    virtual ~Director() {
    }

    /* return a pointer to the wrapped Ruby object */
    VALUE swig_get_self() const { 
      return swig_self; 
    }

    /* acquire ownership of the wrapped Ruby object (the sense of "disown"
     * is from Ruby) */
    void swig_disown() const { 
      if (!swig_disown_flag) { 
        swig_disown_flag = true;
      } 
    }

  /* ownership management */
  private:
    typedef std::map<void*, GCItem_var> swig_ownership_map;
    mutable swig_ownership_map swig_owner;
#ifdef __PTHREAD__
    static pthread_mutex_t swig_mutex_own;
#endif

  public:
    template <typename Type>
    void swig_acquire_ownership_array(Type *vptr)  const
    {
      if (vptr) {
	SWIG_GUARD(swig_mutex_own);
	swig_owner[vptr] = new GCArray_T<Type>(vptr);
      }
    }
    
    template <typename Type>
    void swig_acquire_ownership(Type *vptr)  const
    {
      if (vptr) {	
	SWIG_GUARD(swig_mutex_own);
	swig_owner[vptr] = new GCItem_T<Type>(vptr);
      }
    }

    void swig_acquire_ownership_obj(void *vptr, ruby_owntype own) const
    {
      if (vptr && own) {
	SWIG_GUARD(swig_mutex_own);
	swig_owner[vptr] = new GCItem_Object(own);
      }
    }
    
    ruby_owntype swig_release_ownership(void *vptr) const
    {
      ruby_owntype own = 0;
      if (vptr) {
	SWIG_GUARD(swig_mutex_own);
	swig_ownership_map::iterator iter = swig_owner.find(vptr);
	if (iter != swig_owner.end()) {
	  own = iter->second->get_own();
	  swig_owner.erase(iter);
	}
      }
      return own;
    }
  };
}

#endif /* __cplusplus */



/* -------- TYPES TABLE (BEGIN) -------- */

#define SWIGTYPE_p_Xapian__BM25Weight swig_types[0]
#define SWIGTYPE_p_Xapian__BoolWeight swig_types[1]
#define SWIGTYPE_p_Xapian__Compactor swig_types[2]
#define SWIGTYPE_p_Xapian__Database swig_types[3]
#define SWIGTYPE_p_Xapian__DateValueRangeProcessor swig_types[4]
#define SWIGTYPE_p_Xapian__DecreasingValueWeightPostingSource swig_types[5]
#define SWIGTYPE_p_Xapian__Document swig_types[6]
#define SWIGTYPE_p_Xapian__ESet swig_types[7]
#define SWIGTYPE_p_Xapian__ESetIterator swig_types[8]
#define SWIGTYPE_p_Xapian__Enquire swig_types[9]
#define SWIGTYPE_p_Xapian__ExpandDecider swig_types[10]
#define SWIGTYPE_p_Xapian__FixedWeightPostingSource swig_types[11]
#define SWIGTYPE_p_Xapian__KeyMaker swig_types[12]
#define SWIGTYPE_p_Xapian__MSet swig_types[13]
#define SWIGTYPE_p_Xapian__MSetIterator swig_types[14]
#define SWIGTYPE_p_Xapian__MatchDecider swig_types[15]
#define SWIGTYPE_p_Xapian__MatchSpy swig_types[16]
#define SWIGTYPE_p_Xapian__MultiValueKeyMaker swig_types[17]
#define SWIGTYPE_p_Xapian__MultiValueSorter swig_types[18]
#define SWIGTYPE_p_Xapian__NumberValueRangeProcessor swig_types[19]
#define SWIGTYPE_p_Xapian__PositionIterator swig_types[20]
#define SWIGTYPE_p_Xapian__PostingIterator swig_types[21]
#define SWIGTYPE_p_Xapian__PostingSource swig_types[22]
#define SWIGTYPE_p_Xapian__Query swig_types[23]
#define SWIGTYPE_p_Xapian__QueryParser swig_types[24]
#define SWIGTYPE_p_Xapian__RSet swig_types[25]
#define SWIGTYPE_p_Xapian__Registry swig_types[26]
#define SWIGTYPE_p_Xapian__SimpleStopper swig_types[27]
#define SWIGTYPE_p_Xapian__Sorter swig_types[28]
#define SWIGTYPE_p_Xapian__Stem swig_types[29]
#define SWIGTYPE_p_Xapian__StemImplementation swig_types[30]
#define SWIGTYPE_p_Xapian__Stopper swig_types[31]
#define SWIGTYPE_p_Xapian__StringValueRangeProcessor swig_types[32]
#define SWIGTYPE_p_Xapian__TermGenerator swig_types[33]
#define SWIGTYPE_p_Xapian__TermIterator swig_types[34]
#define SWIGTYPE_p_Xapian__TradWeight swig_types[35]
#define SWIGTYPE_p_Xapian__ValueCountMatchSpy swig_types[36]
#define SWIGTYPE_p_Xapian__ValueIterator swig_types[37]
#define SWIGTYPE_p_Xapian__ValueMapPostingSource swig_types[38]
#define SWIGTYPE_p_Xapian__ValuePostingSource swig_types[39]
#define SWIGTYPE_p_Xapian__ValueRangeProcessor swig_types[40]
#define SWIGTYPE_p_Xapian__ValueSetMatchDecider swig_types[41]
#define SWIGTYPE_p_Xapian__ValueWeightPostingSource swig_types[42]
#define SWIGTYPE_p_Xapian__Weight swig_types[43]
#define SWIGTYPE_p_Xapian__WritableDatabase swig_types[44]
#define SWIGTYPE_p_char swig_types[45]
#define SWIGTYPE_p_compaction_level swig_types[46]
#define SWIGTYPE_p_docid_order swig_types[47]
#define SWIGTYPE_p_double swig_types[48]
#define SWIGTYPE_p_feature_flag swig_types[49]
#define SWIGTYPE_p_first_type swig_types[50]
#define SWIGTYPE_p_int swig_types[51]
#define SWIGTYPE_p_op swig_types[52]
#define SWIGTYPE_p_second_type swig_types[53]
#define SWIGTYPE_p_std__string swig_types[54]
#define SWIGTYPE_p_stem_strategy swig_types[55]
#define SWIGTYPE_p_swig__ConstIterator swig_types[56]
#define SWIGTYPE_p_swig__GC_VALUE swig_types[57]
#define SWIGTYPE_p_swig__Iterator swig_types[58]
#define SWIGTYPE_p_unsigned_int swig_types[59]
#define SWIGTYPE_p_void swig_types[60]
static swig_type_info *swig_types[62];
static swig_module_info swig_module = {swig_types, 61, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)

/* -------- TYPES TABLE (END) -------- */

#define SWIG_init    Init__xapian
#define SWIG_name    "Xapian"

static VALUE mXapian;

#define SWIG_RUBY_THREAD_BEGIN_BLOCK
#define SWIG_RUBY_THREAD_END_BLOCK


#define SWIGVERSION 0x020005 
#define SWIG_VERSION SWIGVERSION


#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) 
#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) 


#include <stdexcept>


/* xapian.i: the Xapian scripting interface.
 *
 * Copyright 1999,2000,2001 BrightStation PLC
 * Copyright 2001,2002 Ananova Ltd
 * Copyright 2002,2003,2005 James Aylett
 * Copyright 2002,2003,2004,2005,2006,2007,2008,2009,2010,2011 Olly Betts
 * Copyright 2007 Lemur Consulting Ltd
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
 * USA
 */


/** @file xapian-head.i
 * @brief Header for SWIG interface file for Xapian.
 */
/* Copyright (C) 2005,2006,2007,2008,2009,2011 Olly Betts
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
 * USA
 */

// Disable any deprecation warnings for Xapian methods/functions/classes.
#define XAPIAN_DEPRECATED(D) D
#define XAPIAN_DEPRECATED_CLASS

#include <xapian.h>

#include <string>
#include <vector>

using namespace std;

// If a backend has been disabled in xapian-core (manually or automatically) we
// include a stub definition here so the bindings can still be built.
namespace Xapian {
#ifndef XAPIAN_HAS_BRASS_BACKEND
    namespace Brass {
	static Database open(const string &) {
	    throw FeatureUnavailableError("Brass backend not supported");
	}
	static WritableDatabase open(const string &, int, int = 8192) {
	    throw FeatureUnavailableError("Brass backend not supported");
	}
    }
#endif

#ifndef XAPIAN_HAS_CHERT_BACKEND
    namespace Chert {
	static Database open(const string &) {
	    throw FeatureUnavailableError("Chert backend not supported");
	}
	static WritableDatabase open(const string &, int, int = 8192) {
	    throw FeatureUnavailableError("Chert backend not supported");
	}
    }
#endif

#ifndef XAPIAN_HAS_FLINT_BACKEND
    namespace Flint {
	static Database open(const string &) {
	    throw FeatureUnavailableError("Flint backend not supported");
	}
	static WritableDatabase open(const string &, int, int = 8192) {
	    throw FeatureUnavailableError("Flint backend not supported");
	}
    }
#endif

#ifndef XAPIAN_HAS_INMEMORY_BACKEND
    namespace InMemory {
	static WritableDatabase open() {
	    throw FeatureUnavailableError("InMemory backend not supported");
	}
    }
#endif

#ifndef XAPIAN_HAS_REMOTE_BACKEND
    namespace Remote {
	static Database open(const string &, unsigned int, timeout = 0, timeout = 0) {
	    throw FeatureUnavailableError("Remote backend not supported");
	}

	static WritableDatabase open_writable(const string &, unsigned int, timeout = 0, timeout = 0) {
	    throw FeatureUnavailableError("Remote backend not supported");
	}

	static Database open(const string &, const string &, timeout = 0) {
	    throw FeatureUnavailableError("Remote backend not supported");
	}

	static WritableDatabase open_writable(const string &, const string &, timeout = 0) {
	    throw FeatureUnavailableError("Remote backend not supported");
	}
    }
#endif
}


#include <stdexcept>


namespace swig {
  class GC_VALUE {
  protected:
    // Hash of all GC_VALUE's currently in use
    static VALUE _hash;

    VALUE  _obj;

    static ID hash_id;
    static ID   lt_id;
    static ID   gt_id;
    static ID   eq_id;
    static ID   le_id;
    static ID   ge_id;

    static ID  pos_id;
    static ID  neg_id;
    static ID  inv_id;

    static ID  add_id;
    static ID  sub_id;
    static ID  mul_id;
    static ID  div_id;
    static ID  mod_id;

    static ID  and_id;
    static ID   or_id;
    static ID  xor_id;

    static ID  lshift_id;
    static ID  rshift_id;

    struct OpArgs
    {
      VALUE src;
      ID    id;
      int   nargs;
      VALUE target;
    };


  public:
    static void initialize()
    {
      if ( _hash == Qnil ) 
	{ 
	  _hash = rb_hash_new();
	  rb_gc_register_address( &_hash );
	}
    }

    // this function is never called.  Provided for symmetry only.
    static void cleanup()
    {
      rb_gc_unregister_address( &_hash );
    }

    GC_VALUE() : _obj( Qnil )
    {
    }

    GC_VALUE(const GC_VALUE& item) : _obj(item._obj)
    {
      GC_register();
    }
    
    GC_VALUE(VALUE obj) :_obj(obj)
    {
      GC_register();
    }
    
    ~GC_VALUE() 
    {
      GC_unregister();
    }
    
    GC_VALUE & operator=(const GC_VALUE& item) 
    {
      GC_unregister();
      _obj = item._obj;
      GC_register();
      return *this;
    }

    void GC_register()
    {
      if ( FIXNUM_P(_obj) || SPECIAL_CONST_P(_obj) || SYMBOL_P(_obj) ) 
	return;
      VALUE val = rb_hash_aref( _hash, _obj );
      unsigned n = FIXNUM_P(val) ? NUM2UINT(val) : 0;
      ++n;
      rb_hash_aset( _hash, _obj, INT2NUM(n) );
    }

    void GC_unregister()
    {
      if ( FIXNUM_P(_obj) || SPECIAL_CONST_P(_obj) || SYMBOL_P(_obj) ) 
	return;
      // this test should not be needed but I've noticed some very erratic
      // behavior of none being unregistered in some very rare situations.
      if ( BUILTIN_TYPE(_obj) == T_NONE ) return;

      VALUE val = rb_hash_aref( _hash, _obj );
      unsigned n = FIXNUM_P(val) ? NUM2UINT(val) : 1;
      --n;
      if ( n )
	rb_hash_aset( _hash, _obj, INT2NUM(n) );
      else
	rb_hash_delete( _hash, _obj );
    }
    
    operator VALUE() const
    {
      return _obj;
    }

    VALUE inspect() const
    {
      return rb_inspect(_obj);
    }

    VALUE to_s() const
    {
      return rb_inspect(_obj);
    }

    static VALUE swig_protect_funcall( VALUE p )
    {
      OpArgs* args = (OpArgs*) p;
      return rb_funcall( args->src, args->id, args->nargs, args->target );
    }


#define GC_VALUE_CMP( op_id, op, cmp, cmpval ) \
    bool op( const GC_VALUE& other ) const \
    { \
      if ( FIXNUM_P(_obj) && FIXNUM_P(other._obj) ) \
      { \
	return _obj cmp other._obj; \
      } \
      bool  res = false; \
      VALUE ret = Qnil; \
      SWIG_RUBY_THREAD_BEGIN_BLOCK; \
      if ( rb_respond_to( _obj, op_id ) == Qtrue ) \
	{ \
	  int status; \
	  OpArgs  args; \
          args.src    = _obj; \
	  args.id     = op_id; \
	  args.nargs  = 1; \
	  args.target = VALUE(other); \
	  ret = rb_protect( PROTECTFUNC(swig_protect_funcall), \
                            VALUE(&args), &status ); \
	} \
      if ( ret == Qnil ) { \
	VALUE a = rb_funcall(         _obj, hash_id, 0 ); \
	VALUE b = rb_funcall( VALUE(other), hash_id, 0 ); \
	res = a cmp b; \
      } \
      else \
	{ \
	  res = RTEST( ret ); \
	} \
      SWIG_RUBY_THREAD_END_BLOCK; \
      return res; \
    }


    GC_VALUE_CMP( eq_id, operator==, ==, == 0 )
    GC_VALUE_CMP( lt_id, operator<,  < , <  0 )
    GC_VALUE_CMP( le_id, operator<=, <=, <= 0 )
    GC_VALUE_CMP( gt_id, operator>,  > , >  0 )
    GC_VALUE_CMP( ge_id, operator>=, >=, >= 0 )
#undef GC_VALUE_CMP

    bool operator!=( const GC_VALUE& other )
    {
      return !(this->operator==(other));
    }

#define GC_VALUE_UNARY( proc_id, op ) \
    GC_VALUE op() const \
    { \
      VALUE ret = Qnil; \
      SWIG_RUBY_THREAD_BEGIN_BLOCK; \
      int status; \
      OpArgs  args; \
      args.src    = _obj; \
      args.id     = proc_id; \
      args.nargs  = 0; \
      args.target = Qnil; \
      ret = rb_protect( PROTECTFUNC(swig_protect_funcall), VALUE(&args), \
			&status ); \
      SWIG_RUBY_THREAD_END_BLOCK; \
      return ret; \
    }

    GC_VALUE_UNARY( pos_id, operator+ )
    GC_VALUE_UNARY( neg_id, operator- )
    GC_VALUE_UNARY( inv_id, operator~ )
#undef GC_VALUE_BINARY

#define GC_VALUE_BINARY( proc_id, op ) \
    GC_VALUE op( const GC_VALUE& other ) const \
    { \
      VALUE ret = Qnil; \
      SWIG_RUBY_THREAD_BEGIN_BLOCK; \
      int status; \
      OpArgs  args; \
      args.src    = _obj; \
      args.id     = proc_id; \
      args.nargs  = 1; \
      args.target = VALUE(other); \
      ret = rb_protect( PROTECTFUNC(swig_protect_funcall), VALUE(&args), \
			&status ); \
      SWIG_RUBY_THREAD_END_BLOCK; \
      return GC_VALUE(ret); \
    }

    GC_VALUE_BINARY( add_id, operator+ );
    GC_VALUE_BINARY( sub_id, operator- );
    GC_VALUE_BINARY( mul_id, operator* );
    GC_VALUE_BINARY( div_id, operator/ );
    GC_VALUE_BINARY( mod_id, operator% );
    
    GC_VALUE_BINARY( and_id, operator& );
    GC_VALUE_BINARY( xor_id, operator^ );
    GC_VALUE_BINARY(  or_id, operator| );

    GC_VALUE_BINARY( lshift_id, operator<< );
    GC_VALUE_BINARY( rshift_id, operator>> );
#undef GC_VALUE_BINARY

  };

  ID  GC_VALUE::hash_id = rb_intern("hash");
  ID  GC_VALUE::lt_id = rb_intern("<");
  ID  GC_VALUE::gt_id = rb_intern(">");
  ID  GC_VALUE::eq_id = rb_intern("==");
  ID  GC_VALUE::le_id = rb_intern("<=");
  ID  GC_VALUE::ge_id = rb_intern(">=");

  ID  GC_VALUE::pos_id = rb_intern("+@");
  ID  GC_VALUE::neg_id = rb_intern("-@");
  ID  GC_VALUE::inv_id = rb_intern("~");

  ID  GC_VALUE::add_id = rb_intern("+");
  ID  GC_VALUE::sub_id = rb_intern("-");
  ID  GC_VALUE::mul_id = rb_intern("*");
  ID  GC_VALUE::div_id = rb_intern("/");
  ID  GC_VALUE::mod_id = rb_intern("%");

  ID  GC_VALUE::and_id = rb_intern("&");
  ID  GC_VALUE::or_id  = rb_intern("|");
  ID  GC_VALUE::xor_id = rb_intern("^");

  ID  GC_VALUE::lshift_id = rb_intern("<<");
  ID  GC_VALUE::rshift_id = rb_intern(">>");

  VALUE GC_VALUE::_hash = Qnil;

  typedef GC_VALUE LANGUAGE_OBJ;

} // namespace swig



#if defined(__GNUC__)
#  if __GNUC__ == 2 && __GNUC_MINOR <= 96
#     define SWIG_STD_NOMODERN_STL
#  endif
#endif


#include <string>
#include <stdexcept>
#include <stddef.h>


#include <string>


#include <iostream>

  
namespace swig {
  struct stop_iteration {
  };

  /** 
   * Abstract base class used to represent all iterators of STL containers.
   */
  struct ConstIterator {
  public:
    typedef ConstIterator self_type;

  protected:
    GC_VALUE _seq;

  protected:
    ConstIterator(VALUE seq) : _seq(seq)
    {
    }

    // Random access iterator methods, but not required in Ruby
    virtual ptrdiff_t distance(const ConstIterator &x) const
    {
      throw std::invalid_argument("distance not supported");
    }

    virtual bool equal (const ConstIterator &x) const
    {
      throw std::invalid_argument("equal not supported");
    }

    virtual self_type* advance(ptrdiff_t n)
    {
      throw std::invalid_argument("advance not supported");
    }
      
  public:
    virtual ~ConstIterator() {}

    // Access iterator method, required by Ruby
    virtual VALUE value() const {
      throw std::invalid_argument("value not supported");
      return Qnil;
    };

    virtual VALUE setValue( const VALUE& v ) {
      throw std::invalid_argument("value= not supported");
      return Qnil;
    }

    virtual self_type* next( size_t n = 1 )
    {
      return this->advance( n );
    }

    virtual self_type* previous( size_t n = 1 )
    {
      ptrdiff_t nn = n;
      return this->advance( -nn );
    }

    virtual VALUE to_s() const {
      throw std::invalid_argument("to_s not supported");
      return Qnil;
    }

    virtual VALUE inspect() const {
      throw std::invalid_argument("inspect not supported");
      return Qnil;
    }
    
    virtual ConstIterator *dup() const
    {
      throw std::invalid_argument("dup not supported");
      return NULL;
    }

    //
    // C++ common/needed methods.  We emulate a bidirectional
    // operator, to be compatible with all the STL.
    // The iterator traits will then tell the STL what type of
    // iterator we really are.
    //
    ConstIterator() : _seq( Qnil )
    {
    }

    ConstIterator( const self_type& b ) : _seq( b._seq )
    {
    }

    self_type& operator=( const self_type& b )
    {
      _seq = b._seq;
      return *this;
    }

    bool operator == (const ConstIterator& x)  const
    {
      return equal(x);
    }
      
    bool operator != (const ConstIterator& x) const
    {
      return ! operator==(x);
    }
      
    // Pre-decrement operator
    self_type& operator--()
    {
      return *previous();
    }

    // Pre-increment operator
    self_type& operator++()
    {
      return *next();
    }

    // Post-decrement operator
    self_type operator--(int)
    {
      self_type r = *this;
      previous();
      return r;
    }

    // Post-increment operator
    self_type operator++(int)
    {
      self_type r = *this;
      next();
      return r;
    }

    ConstIterator& operator += (ptrdiff_t n)
    {
      return *advance(n);
    }

    ConstIterator& operator -= (ptrdiff_t n)
    {
      return *advance(-n);
    }

    ConstIterator* operator + (ptrdiff_t n) const
    {
      return dup()->advance(n);
    }

    ConstIterator* operator - (ptrdiff_t n) const
    {
      return dup()->advance(-n);
    }
      
    ptrdiff_t operator - (const ConstIterator& x) const
    {
      return x.distance(*this);
    }
      
    static swig_type_info* descriptor() {
      static int init = 0;
      static swig_type_info* desc = 0;
      if (!init) {
	desc = SWIG_TypeQuery("swig::ConstIterator *");
	init = 1;
      }	
      return desc;
    }
  };


  /**
   * Abstract base class used to represent all non-const iterators of STL containers.
   * 
   */
  struct Iterator : public ConstIterator {
  public:
    typedef Iterator self_type;

  protected:
    Iterator(VALUE seq) : ConstIterator(seq)
    {
    }

    virtual self_type* advance(ptrdiff_t n)
    {
      throw std::invalid_argument("operation not supported");
    }

  public:
    static swig_type_info* descriptor() {
      static int init = 0;
      static swig_type_info* desc = 0;
      if (!init) {
	desc = SWIG_TypeQuery("swig::Iterator *");
	init = 1;
      }	
      return desc;
    }
    
    virtual Iterator *dup() const
    {
      throw std::invalid_argument("dup not supported");
      return NULL;
    }
      
    virtual self_type* next( size_t n = 1 )
    {
      return this->advance( n );
    }

    virtual self_type* previous( size_t n = 1 )
    {
      ptrdiff_t nn = n;
      return this->advance( -nn );
    }

    bool operator == (const ConstIterator& x)  const
    {
      return equal(x);
    }
      
    bool operator != (const Iterator& x) const
    {
      return ! operator==(x);
    }
      
    Iterator& operator += (ptrdiff_t n)
    {
      return *advance(n);
    }

    Iterator& operator -= (ptrdiff_t n)
    {
      return *advance(-n);
    }
      
    Iterator* operator + (ptrdiff_t n) const
    {
      return dup()->advance(n);
    }

    Iterator* operator - (ptrdiff_t n) const
    {
      return dup()->advance(-n);
    }
      
    ptrdiff_t operator - (const Iterator& x) const
    {
      return x.distance(*this);
    }
  };

}


SWIGINTERN VALUE
SWIG_ruby_failed(void)
{
  return Qnil;
} 


/*@SWIG:/data/home/olly/tmp/xapian-svn-snapshot/tags/1.2.12/xapian/swig/Lib/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
{
  VALUE obj = args[0];
  VALUE type = TYPE(obj);
  unsigned long *res = (unsigned long *)(args[1]);
  *res = type == T_FIXNUM ? NUM2ULONG(obj) : rb_big2ulong(obj);
  return obj;
}
/*@SWIG@*/

SWIGINTERN int
SWIG_AsVal_unsigned_SS_long (VALUE obj, unsigned long *val) 
{
  VALUE type = TYPE(obj);
  if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
    unsigned long v;
    VALUE a[2];
    a[0] = obj;
    a[1] = (VALUE)(&v);
    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
      if (val) *val = v;
      return SWIG_OK;
    }
  }
  return SWIG_TypeError;
}


SWIGINTERNINLINE int
SWIG_AsVal_size_t (VALUE obj, size_t *val)
{
  unsigned long v;
  int res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0);
  if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v);
  return res;
}


SWIGINTERNINLINE VALUE
SWIG_From_bool  (bool value)
{
  return value ? Qtrue : Qfalse;
}


/*@SWIG:/data/home/olly/tmp/xapian-svn-snapshot/tags/1.2.12/xapian/swig/Lib/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
{
  VALUE obj = args[0];
  VALUE type = TYPE(obj);
  long *res = (long *)(args[1]);
  *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj);
  return obj;
}
/*@SWIG@*/

SWIGINTERN int
SWIG_AsVal_long (VALUE obj, long* val)
{
  VALUE type = TYPE(obj);
  if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
    long v;
    VALUE a[2];
    a[0] = obj;
    a[1] = (VALUE)(&v);
    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
      if (val) *val = v;
      return SWIG_OK;
    }
  }
  return SWIG_TypeError;
}


SWIGINTERNINLINE int
SWIG_AsVal_ptrdiff_t (VALUE obj, ptrdiff_t *val)
{
  long v;
  int res = SWIG_AsVal_long (obj, val ? &v : 0);
  if (SWIG_IsOK(res) && val) *val = static_cast< ptrdiff_t >(v);
  return res;
}


#include <limits.h>
#if !defined(SWIG_NO_LLONG_MAX)
# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
#   define LLONG_MAX __LONG_LONG_MAX__
#   define LLONG_MIN (-LLONG_MAX - 1LL)
#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
# endif
#endif


  #define SWIG_From_long   LONG2NUM 


SWIGINTERNINLINE VALUE
SWIG_From_ptrdiff_t  (ptrdiff_t value)
{    
  return SWIG_From_long  (static_cast< long >(value));
}


#include <stdexcept>


#include <algorithm>


#include <vector>


#include <utility>


#include <map>
#include <algorithm>
#include <stdexcept>


#ifdef __cplusplus
extern "C" {
#endif

// Ruby 1.9 changed the file name of this header
#ifdef HAVE_RUBY_IO_H
#include "ruby/io.h"
#else
#include "rubyio.h"
#endif

#ifdef __cplusplus
}
#endif


#ifdef __cplusplus
extern "C" {
#endif
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
struct timeval rb_time_timeval(VALUE);
#endif
#ifdef __cplusplus
}
#endif


/* ruby/util.i: custom Ruby typemaps for xapian-bindings
 *
 * Original version by Paul Legato (plegato@nks.net), 4/17/06.
 * Based on the php4 and python util.i files.
 *
 * Copyright (C) 2006 Networked Knowledge Systems, Inc.
 * Copyright (C) 2006,2007,2008,2009,2010 Olly Betts
 * Copyright (C) 2010 Richard Boulton
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
 * USA
 *
 */



#ifndef XapianException
# define XapianException(TYPE, MSG) SWIG_exception((TYPE), (MSG).c_str())
#endif

static int XapianExceptionHandler(string & msg) {
    try {
	// Rethrow so we can look at the exception if it was a Xapian::Error.
	throw;
    } catch (const Xapian::Error &e) {
	msg = e.get_type();
	msg += ": ";
	msg += e.get_msg();
	try {
	    // Re-rethrow the previous exception so we can handle the type in a
	    // fine-grained way, but only in one place to avoid bloating the
	    // file.
	    throw;
	} catch (const Xapian::InvalidArgumentError &e) {
	    return SWIG_ValueError;
	} catch (const Xapian::RangeError &e) {
	    return SWIG_IndexError;
	} catch (const Xapian::DatabaseError &) {
	    return SWIG_IOError;
	} catch (const Xapian::NetworkError &) {
	    return SWIG_IOError;
	} catch (const Xapian::InternalError &) {
	    return SWIG_RuntimeError;
	} catch (const Xapian::RuntimeError &) {
	    return SWIG_RuntimeError;
	} catch (...) {
	    return SWIG_UnknownError;
	}
    } catch (...) {
	msg = "unknown error in Xapian";
    }
    return SWIG_UnknownError;
}


SWIGINTERNINLINE VALUE
SWIG_From_unsigned_SS_long  (unsigned long value)
{
  return ULONG2NUM(value); 
}


SWIGINTERNINLINE VALUE
SWIG_From_unsigned_SS_int  (unsigned int value)
{    
  return SWIG_From_unsigned_SS_long  (value);
}


SWIGINTERN swig_type_info*
SWIG_pchar_descriptor(void)
{
  static int init = 0;
  static swig_type_info* info = 0;
  if (!init) {
    info = SWIG_TypeQuery("_p_char");
    init = 1;
  }
  return info;
}


SWIGINTERNINLINE VALUE 
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
  if (carray) {
    if (size > LONG_MAX) {
      swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
      return pchar_descriptor ? 
	SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : Qnil;
    } else {
      return rb_str_new(carray, static_cast< long >(size));
    }
  } else {
    return Qnil;
  }
}


SWIGINTERNINLINE VALUE 
SWIG_FromCharPtr(const char *cptr)
{ 
  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
}


SWIGINTERNINLINE VALUE
SWIG_From_int  (int value)
{    
  return SWIG_From_long  (value);
}

SWIGINTERN Xapian::termpos Xapian_PositionIterator_get_termpos(Xapian::PositionIterator const *self){
	    return *(*self);
	}
SWIGINTERN void Xapian_PositionIterator_next(Xapian::PositionIterator *self){ ++(*self); }
SWIGINTERN bool Xapian_PositionIterator_equals(Xapian::PositionIterator const *self,Xapian::PositionIterator const &other){
	    return (*self) == other;
	}

SWIGINTERN int
SWIG_AsVal_unsigned_SS_int (VALUE obj, unsigned int *val)
{
  unsigned long v;
  int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
  if (SWIG_IsOK(res)) {
    if ((v > UINT_MAX)) {
      return SWIG_OverflowError;
    } else {
      if (val) *val = static_cast< unsigned int >(v);
    }
  }  
  return res;
}


SWIGINTERNINLINE VALUE
SWIG_From_std_string  (const std::string& s)
{
  return SWIG_FromCharPtrAndSize(s.data(), s.size());
}

SWIGINTERN Xapian::docid Xapian_PostingIterator_get_docid(Xapian::PostingIterator const *self){
	return *(*self);
    }
SWIGINTERN void Xapian_PostingIterator_next(Xapian::PostingIterator *self){ ++(*self); }
SWIGINTERN bool Xapian_PostingIterator_equals(Xapian::PostingIterator const *self,Xapian::PostingIterator const &other){
	return (*self) == other;
    }
SWIGINTERN std::string Xapian_TermIterator_get_term(Xapian::TermIterator const *self){
	    return *(*self);
	}
SWIGINTERN void Xapian_TermIterator_next(Xapian::TermIterator *self){ ++(*self); }
SWIGINTERN bool Xapian_TermIterator_equals(Xapian::TermIterator const *self,Xapian::TermIterator const &other){
	    return (*self) == other;
	}

SWIGINTERN int
SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
{
  if (TYPE(obj) == T_STRING) {
    #if defined(StringValuePtr)
    char *cstr = StringValuePtr(obj); 
    #else
    char *cstr = STR2CSTR(obj);
    #endif
    size_t size = RSTRING_LEN(obj) + 1;
    if (cptr)  {
      if (alloc) {
	if (*alloc == SWIG_NEWOBJ) {
	  *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
	} else {
	  *cptr = cstr;
	  *alloc = SWIG_OLDOBJ;
	}
      }
    }
    if (psize) *psize = size;
    return SWIG_OK;
  } else {
    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
    if (pchar_descriptor) {
      void* vptr = 0;
      if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
	if (cptr) *cptr = (char *)vptr;
	if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
	if (alloc) *alloc = SWIG_OLDOBJ;
	return SWIG_OK;
      }
    }
  }  
  return SWIG_TypeError;
}


SWIGINTERN int
SWIG_AsPtr_std_string (VALUE obj, std::string **val) 
{
  char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ;
  if (SWIG_IsOK((SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc)))) {
    if (buf) {
      if (val) *val = new std::string(buf, size - 1);
      if (alloc == SWIG_NEWOBJ) delete[] buf;
      return SWIG_NEWOBJ;
    } else {
      if (val) *val = 0;
      return SWIG_OLDOBJ;
    }
  } else {
    static int init = 0;
    static swig_type_info* descriptor = 0;
    if (!init) {
      descriptor = SWIG_TypeQuery("std::string" " *");
      init = 1;
    }
    if (descriptor) {
      std::string *vptr;
      int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0);
      if (SWIG_IsOK(res) && val) *val = vptr;
      return res;
    }
  }
  return SWIG_ERROR;
}

SWIGINTERN std::string Xapian_ValueIterator_get_value(Xapian::ValueIterator const *self){
	    return *(*self);
	}
SWIGINTERN void Xapian_ValueIterator_next(Xapian::ValueIterator *self){ ++(*self); }
SWIGINTERN bool Xapian_ValueIterator_equals(Xapian::ValueIterator const *self,Xapian::ValueIterator const &other){
	    return (*self) == other;
	}

/*@SWIG:/data/home/olly/tmp/xapian-svn-snapshot/tags/1.2.12/xapian/swig/Lib/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE *args)
{
  VALUE obj = args[0];
  VALUE type = TYPE(obj);
  double *res = (double *)(args[1]);
  *res = NUM2DBL(obj);
  return obj;
}
/*@SWIG@*/

SWIGINTERN int
SWIG_AsVal_double (VALUE obj, double *val)
{
  VALUE type = TYPE(obj);
  if ((type == T_FLOAT) || (type == T_FIXNUM) || (type == T_BIGNUM)) {
    double v;
    VALUE a[2];
    a[0] = obj;
    a[1] = (VALUE)(&v);
    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2DBL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
      if (val) *val = v;
      return SWIG_OK;
    }
  }
  return SWIG_TypeError;
}


  #define SWIG_From_double   rb_float_new 


SWIGINTERN int
SWIG_AsVal_int (VALUE obj, int *val)
{
  long v;
  int res = SWIG_AsVal_long (obj, &v);
  if (SWIG_IsOK(res)) {
    if ((v < INT_MIN || v > INT_MAX)) {
      return SWIG_OverflowError;
    } else {
      if (val) *val = static_cast< int >(v);
    }
  }  
  return res;
}


SWIGINTERN int
SWIG_AsVal_bool (VALUE obj, bool *val)
{
  if (obj == Qtrue) {
    if (val) *val = true;
    return SWIG_OK;
  } else if (obj == Qfalse) {
    if (val) *val = false;
    return SWIG_OK;
  } else {
    int res = 0;
    if (SWIG_AsVal_int (obj, &res) == SWIG_OK) {    
      if (val) *val = res ? true : false;
      return SWIG_OK;
    }
  }  
  return SWIG_TypeError;
}

SWIGINTERN Xapian::MSetIterator Xapian_MSet_get_hit(Xapian::MSet const *self,Xapian::doccount i){
	    return ((*self)[i]);
	}
SWIGINTERN int Xapian_MSet_get_document_percentage(Xapian::MSet const *self,Xapian::doccount i){
	    return (*self).convert_to_percent( ((*self)[i]) );
	}
SWIGINTERN Xapian::Document const Xapian_MSet_get_document(Xapian::MSet const *self,Xapian::doccount i){
	    return ((*self)[i]).get_document();
	}
SWIGINTERN Xapian::docid Xapian_MSet_get_docid(Xapian::MSet const *self,Xapian::doccount i){
	    return *((*self)[i]);
	}
SWIGINTERN Xapian::docid Xapian_MSetIterator_get_docid(Xapian::MSetIterator const *self){
	    return *(*self);
	}
SWIGINTERN void Xapian_MSetIterator_next(Xapian::MSetIterator *self){ ++(*self); }
SWIGINTERN void Xapian_MSetIterator_prev(Xapian::MSetIterator *self){ --(*self); }
SWIGINTERN bool Xapian_MSetIterator_equals(Xapian::MSetIterator const *self,Xapian::MSetIterator const &other){
	    return (*self) == other;
	}
SWIGINTERN std::string Xapian_ESetIterator_get_term(Xapian::ESetIterator const *self){
	    return *(*self);
	}
SWIGINTERN void Xapian_ESetIterator_next(Xapian::ESetIterator *self){ ++(*self); }
SWIGINTERN void Xapian_ESetIterator_prev(Xapian::ESetIterator *self){ --(*self); }
SWIGINTERN bool Xapian_ESetIterator_equals(Xapian::ESetIterator const *self,Xapian::ESetIterator const &other){
	    return (*self) == other;
	}

SWIGINTERNINLINE VALUE
SWIG_From_size_t  (size_t value)
{    
  return SWIG_From_unsigned_SS_long  (static_cast< unsigned long >(value));
}

SWIGINTERN Xapian::Query *new_Xapian_Query__SWIG_13(Xapian::Query::op op,std::vector< Xapian::Query > const &subqs,Xapian::termcount param=0){
		return new Xapian::Query(op, subqs.begin(), subqs.end(), param);
	    }

/* ruby/extra.i: custom Ruby SWIG stuff to go after xapian.i
 *
 * Copyright (C) 2011 Olly Betts
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
 * USA
 */

/* ---------------------------------------------------
 * C++ director class helpers
 * --------------------------------------------------- */



/* ---------------------------------------------------
 * C++ director class methods
 * --------------------------------------------------- */

#include "xapian_wrap.h"

SwigDirector_PostingSource::SwigDirector_PostingSource(VALUE self): Xapian::PostingSource(), Swig::Director(self) {
  
}



SwigDirector_PostingSource::~SwigDirector_PostingSource() {
}

Xapian::doccount SwigDirector_PostingSource::get_termfreq_min() const {
  Xapian::doccount c_result ;
  VALUE result;
  
  result = rb_funcall(swig_get_self(), rb_intern("get_termfreq_min"), 0, NULL);
  unsigned int swig_val;
  int swig_res = SWIG_AsVal_unsigned_SS_int(result, &swig_val);
  if (!SWIG_IsOK(swig_res)) {
    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(swig_res)), "in output value of type '""Xapian::doccount""'");
  }
  c_result = static_cast< Xapian::doccount >(swig_val);
  return (Xapian::doccount) c_result;
}


Xapian::doccount SwigDirector_PostingSource::get_termfreq_est() const {
  Xapian::doccount c_result ;
  VALUE result;
  
  result = rb_funcall(swig_get_self(), rb_intern("get_termfreq_est"), 0, NULL);
  unsigned int swig_val;
  int swig_res = SWIG_AsVal_unsigned_SS_int(result, &swig_val);
  if (!SWIG_IsOK(swig_res)) {
    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(swig_res)), "in output value of type '""Xapian::doccount""'");
  }
  c_result = static_cast< Xapian::doccount >(swig_val);
  return (Xapian::doccount) c_result;
}


Xapian::doccount SwigDirector_PostingSource::get_termfreq_max() const {
  Xapian::doccount c_result ;
  VALUE result;
  
  result = rb_funcall(swig_get_self(), rb_intern("get_termfreq_max"), 0, NULL);
  unsigned int swig_val;
  int swig_res = SWIG_AsVal_unsigned_SS_int(result, &swig_val);
  if (!SWIG_IsOK(swig_res)) {
    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(swig_res)), "in output value of type '""Xapian::doccount""'");
  }
  c_result = static_cast< Xapian::doccount >(swig_val);
  return (Xapian::doccount) c_result;
}


Xapian::weight SwigDirector_PostingSource::get_weight() const {
  Xapian::weight c_result ;
  VALUE result;
  
  result = rb_funcall(swig_get_self(), rb_intern("weight"), 0, NULL);
  double swig_val;
  int swig_res = SWIG_AsVal_double(result, &swig_val);
  if (!SWIG_IsOK(swig_res)) {
    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(swig_res)), "in output value of type '""Xapian::weight""'");
  }
  c_result = static_cast< Xapian::weight >(swig_val);
  return (Xapian::weight) c_result;
}


Xapian::docid SwigDirector_PostingSource::get_docid() const {
  Xapian::docid c_result ;
  VALUE result;
  
  result = rb_funcall(swig_get_self(), rb_intern("docid"), 0, NULL);
  unsigned int swig_val;
  int swig_res = SWIG_AsVal_unsigned_SS_int(result, &swig_val);
  if (!SWIG_IsOK(swig_res)) {
    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(swig_res)), "in output value of type '""Xapian::docid""'");
  }
  c_result = static_cast< Xapian::docid >(swig_val);
  return (Xapian::docid) c_result;
}


void SwigDirector_PostingSource::next(Xapian::weight min_wt) {
  VALUE obj0 = Qnil ;
  VALUE result;
  
  obj0 = SWIG_From_double(static_cast< double >(min_wt));
  result = rb_funcall(swig_get_self(), rb_intern("next"), 1,obj0);
}


void SwigDirector_PostingSource::skip_to(Xapian::docid did, Xapian::weight min_wt) {
  VALUE obj0 = Qnil ;
  VALUE obj1 = Qnil ;
  VALUE result;
  
  obj0 = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(did));
  obj1 = SWIG_From_double(static_cast< double >(min_wt));
  result = rb_funcall(swig_get_self(), rb_intern("skip_to"), 2,obj0,obj1);
}


bool SwigDirector_PostingSource::check(Xapian::docid did, Xapian::weight min_wt) {
  bool c_result ;
  VALUE obj0 = Qnil ;
  VALUE obj1 = Qnil ;
  VALUE result;
  
  obj0 = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(did));
  obj1 = SWIG_From_double(static_cast< double >(min_wt));
  result = rb_funcall(swig_get_self(), rb_intern("check"), 2,obj0,obj1);
  bool swig_val;
  int swig_res = SWIG_AsVal_bool(result, &swig_val);
  if (!SWIG_IsOK(swig_res)) {
    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(swig_res)), "in output value of type '""bool""'");
  }
  c_result = static_cast< bool >(swig_val);
  return (bool) c_result;
}


bool SwigDirector_PostingSource::at_end() const {
  bool c_result ;
  VALUE result;
  
  result = rb_funcall(swig_get_self(), rb_intern("at_end"), 0, NULL);
  bool swig_val;
  int swig_res = SWIG_AsVal_bool(result, &swig_val);
  if (!SWIG_IsOK(swig_res)) {
    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(swig_res)), "in output value of type '""bool""'");
  }
  c_result = static_cast< bool >(swig_val);
  return (bool) c_result;
}


Xapian::PostingSource *SwigDirector_PostingSource::clone() const {
  return Xapian::PostingSource::clone();
}


std::string SwigDirector_PostingSource::name() const {
  std::string c_result ;
  VALUE result;
  
  result = rb_funcall(swig_get_self(), rb_intern("name"), 0, NULL);
  std::string *swig_optr = 0;
  int swig_ores = SWIG_AsPtr_std_string(result, &swig_optr);
  if (!SWIG_IsOK(swig_ores) || !swig_optr) {
    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError((swig_optr ? swig_ores : SWIG_TypeError))), "in output value of type '""std::string""'");
  }
  c_result = *swig_optr;
  if (SWIG_IsNewObj(swig_ores)) delete swig_optr;
  return (std::string) c_result;
}


std::string SwigDirector_PostingSource::serialise() const {
  return Xapian::PostingSource::serialise();
}


Xapian::PostingSource *SwigDirector_PostingSource::unserialise(std::string const &s) const {
  return Xapian::PostingSource::unserialise(s);
}


void SwigDirector_PostingSource::init(Xapian::Database const &db) {
  VALUE obj0 = Qnil ;
  VALUE result;
  
  obj0 = SWIG_NewPointerObj(SWIG_as_voidptr(&db), SWIGTYPE_p_Xapian__Database,  0 );
  result = rb_funcall(swig_get_self(), rb_intern("init"), 1,obj0);
}


std::string SwigDirector_PostingSource::get_description() const {
  std::string c_result ;
  VALUE result;
  
  result = rb_funcall(swig_get_self(), rb_intern("description"), 0, NULL);
  std::string *swig_optr = 0;
  int swig_ores = SWIG_AsPtr_std_string(result, &swig_optr);
  if (!SWIG_IsOK(swig_ores) || !swig_optr) {
    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError((swig_optr ? swig_ores : SWIG_TypeError))), "in output value of type '""std::string""'");
  }
  c_result = *swig_optr;
  if (SWIG_IsNewObj(swig_ores)) delete swig_optr;
  return (std::string) c_result;
}


SwigDirector_MatchDecider::SwigDirector_MatchDecider(VALUE self): Xapian::MatchDecider(), Swig::Director(self) {
  
}



bool SwigDirector_MatchDecider::operator ()(Xapian::Document const &doc) const {
  bool c_result ;
  VALUE obj0 = Qnil ;
  VALUE result;
  
  obj0 = SWIG_NewPointerObj(SWIG_as_voidptr(&doc), SWIGTYPE_p_Xapian__Document,  0 );
  result = rb_funcall(swig_get_self(), rb_intern("__call__"), 1,obj0);
  bool swig_val;
  int swig_res = SWIG_AsVal_bool(result, &swig_val);
  if (!SWIG_IsOK(swig_res)) {
    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(swig_res)), "in output value of type '""bool""'");
  }
  c_result = static_cast< bool >(swig_val);
  return (bool) c_result;
}


SwigDirector_MatchDecider::~SwigDirector_MatchDecider() {
}

SwigDirector_ExpandDecider::SwigDirector_ExpandDecider(VALUE self): Xapian::ExpandDecider(), Swig::Director(self) {
  
}



bool SwigDirector_ExpandDecider::operator ()(std::string const &term) const {
  bool c_result ;
  VALUE obj0 = Qnil ;
  VALUE result;
  
  obj0 = SWIG_From_std_string(static_cast< std::string >(term));
  result = rb_funcall(swig_get_self(), rb_intern("__call__"), 1,obj0);
  bool swig_val;
  int swig_res = SWIG_AsVal_bool(result, &swig_val);
  if (!SWIG_IsOK(swig_res)) {
    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(swig_res)), "in output value of type '""bool""'");
  }
  c_result = static_cast< bool >(swig_val);
  return (bool) c_result;
}


SwigDirector_ExpandDecider::~SwigDirector_ExpandDecider() {
}

SwigDirector_MatchSpy::SwigDirector_MatchSpy(VALUE self): Xapian::MatchSpy(), Swig::Director(self) {
  
}



SwigDirector_MatchSpy::~SwigDirector_MatchSpy() {
}

void SwigDirector_MatchSpy::operator ()(Xapian::Document const &doc, Xapian::weight wt) {
  VALUE obj0 = Qnil ;
  VALUE obj1 = Qnil ;
  VALUE result;
  
  obj0 = SWIG_NewPointerObj(SWIG_as_voidptr(&doc), SWIGTYPE_p_Xapian__Document,  0 );
  obj1 = SWIG_From_double(static_cast< double >(wt));
  result = rb_funcall(swig_get_self(), rb_intern("__call__"), 2,obj0,obj1);
}


Xapian::MatchSpy *SwigDirector_MatchSpy::clone() const {
  return Xapian::MatchSpy::clone();
}


std::string SwigDirector_MatchSpy::name() const {
  std::string c_result ;
  VALUE result;
  
  result = rb_funcall(swig_get_self(), rb_intern("name"), 0, NULL);
  std::string *swig_optr = 0;
  int swig_ores = SWIG_AsPtr_std_string(result, &swig_optr);
  if (!SWIG_IsOK(swig_ores) || !swig_optr) {
    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError((swig_optr ? swig_ores : SWIG_TypeError))), "in output value of type '""std::string""'");
  }
  c_result = *swig_optr;
  if (SWIG_IsNewObj(swig_ores)) delete swig_optr;
  return (std::string) c_result;
}


std::string SwigDirector_MatchSpy::serialise() const {
  return Xapian::MatchSpy::serialise();
}


Xapian::MatchSpy *SwigDirector_MatchSpy::unserialise(std::string const &s, Xapian::Registry const &context) const {
  return Xapian::MatchSpy::unserialise(s,context);
}


std::string SwigDirector_MatchSpy::serialise_results() const {
  return Xapian::MatchSpy::serialise_results();
}


void SwigDirector_MatchSpy::merge_results(std::string const &s) {
  VALUE obj0 = Qnil ;
  VALUE result;
  
  obj0 = SWIG_From_std_string(static_cast< std::string >(s));
  result = rb_funcall(swig_get_self(), rb_intern("merge_results"), 1,obj0);
}


std::string SwigDirector_MatchSpy::get_description() const {
  std::string c_result ;
  VALUE result;
  
  result = rb_funcall(swig_get_self(), rb_intern("description"), 0, NULL);
  std::string *swig_optr = 0;
  int swig_ores = SWIG_AsPtr_std_string(result, &swig_optr);
  if (!SWIG_IsOK(swig_ores) || !swig_optr) {
    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError((swig_optr ? swig_ores : SWIG_TypeError))), "in output value of type '""std::string""'");
  }
  c_result = *swig_optr;
  if (SWIG_IsNewObj(swig_ores)) delete swig_optr;
  return (std::string) c_result;
}


SwigDirector_Stopper::SwigDirector_Stopper(VALUE self): Xapian::Stopper(), Swig::Director(self) {
  
}



bool SwigDirector_Stopper::operator ()(std::string const &term) const {
  bool c_result ;
  VALUE obj0 = Qnil ;
  VALUE result;
  
  obj0 = SWIG_From_std_string(static_cast< std::string >(term));
  result = rb_funcall(swig_get_self(), rb_intern("__call__"), 1,obj0);
  bool swig_val;
  int swig_res = SWIG_AsVal_bool(result, &swig_val);
  if (!SWIG_IsOK(swig_res)) {
    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(swig_res)), "in output value of type '""bool""'");
  }
  c_result = static_cast< bool >(swig_val);
  return (bool) c_result;
}


SwigDirector_Stopper::~SwigDirector_Stopper() {
}

std::string SwigDirector_Stopper::get_description() const {
  std::string c_result ;
  VALUE result;
  
  result = rb_funcall(swig_get_self(), rb_intern("description"), 0, NULL);
  std::string *swig_optr = 0;
  int swig_ores = SWIG_AsPtr_std_string(result, &swig_optr);
  if (!SWIG_IsOK(swig_ores) || !swig_optr) {
    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError((swig_optr ? swig_ores : SWIG_TypeError))), "in output value of type '""std::string""'");
  }
  c_result = *swig_optr;
  if (SWIG_IsNewObj(swig_ores)) delete swig_optr;
  return (std::string) c_result;
}


SwigDirector_ValueRangeProcessor::SwigDirector_ValueRangeProcessor(VALUE self): Xapian::ValueRangeProcessor(), Swig::Director(self) {
  
}



SwigDirector_ValueRangeProcessor::~SwigDirector_ValueRangeProcessor() {
}

Xapian::valueno SwigDirector_ValueRangeProcessor::operator ()(std::string &begin, std::string &end) {
  Xapian::valueno c_result ;
  VALUE obj0 = Qnil ;
  VALUE obj1 = Qnil ;
  VALUE result;
  
  obj0 = SWIG_NewPointerObj(SWIG_as_voidptr(&begin), SWIGTYPE_p_std__string,  0 );
  obj1 = SWIG_NewPointerObj(SWIG_as_voidptr(&end), SWIGTYPE_p_std__string,  0 );
  result = rb_funcall(swig_get_self(), rb_intern("__call__"), 2,obj0,obj1);
  unsigned int swig_val;
  int swig_res = SWIG_AsVal_unsigned_SS_int(result, &swig_val);
  if (!SWIG_IsOK(swig_res)) {
    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(swig_res)), "in output value of type '""Xapian::valueno""'");
  }
  c_result = static_cast< Xapian::valueno >(swig_val);
  return (Xapian::valueno) c_result;
}


SwigDirector_StemImplementation::SwigDirector_StemImplementation(VALUE self): Xapian::StemImplementation(), Swig::Director(self) {
  
}



SwigDirector_StemImplementation::~SwigDirector_StemImplementation() {
}

std::string SwigDirector_StemImplementation::operator ()(std::string const &word) {
  std::string c_result ;
  VALUE obj0 = Qnil ;
  VALUE result;
  
  obj0 = SWIG_From_std_string(static_cast< std::string >(word));
  result = rb_funcall(swig_get_self(), rb_intern("__call__"), 1,obj0);
  std::string *swig_optr = 0;
  int swig_ores = SWIG_AsPtr_std_string(result, &swig_optr);
  if (!SWIG_IsOK(swig_ores) || !swig_optr) {
    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError((swig_optr ? swig_ores : SWIG_TypeError))), "in output value of type '""std::string""'");
  }
  c_result = *swig_optr;
  if (SWIG_IsNewObj(swig_ores)) delete swig_optr;
  return (std::string) c_result;
}


std::string SwigDirector_StemImplementation::get_description() const {
  std::string c_result ;
  VALUE result;
  
  result = rb_funcall(swig_get_self(), rb_intern("description"), 0, NULL);
  std::string *swig_optr = 0;
  int swig_ores = SWIG_AsPtr_std_string(result, &swig_optr);
  if (!SWIG_IsOK(swig_ores) || !swig_optr) {
    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError((swig_optr ? swig_ores : SWIG_TypeError))), "in output value of type '""std::string""'");
  }
  c_result = *swig_optr;
  if (SWIG_IsNewObj(swig_ores)) delete swig_optr;
  return (std::string) c_result;
}


SwigDirector_KeyMaker::SwigDirector_KeyMaker(VALUE self): Xapian::KeyMaker(), Swig::Director(self) {
  
}



std::string SwigDirector_KeyMaker::operator ()(Xapian::Document const &doc) const {
  std::string c_result ;
  VALUE obj0 = Qnil ;
  VALUE result;
  
  obj0 = SWIG_NewPointerObj(SWIG_as_voidptr(&doc), SWIGTYPE_p_Xapian__Document,  0 );
  result = rb_funcall(swig_get_self(), rb_intern("__call__"), 1,obj0);
  std::string *swig_optr = 0;
  int swig_ores = SWIG_AsPtr_std_string(result, &swig_optr);
  if (!SWIG_IsOK(swig_ores) || !swig_optr) {
    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError((swig_optr ? swig_ores : SWIG_TypeError))), "in output value of type '""std::string""'");
  }
  c_result = *swig_optr;
  if (SWIG_IsNewObj(swig_ores)) delete swig_optr;
  return (std::string) c_result;
}


SwigDirector_KeyMaker::~SwigDirector_KeyMaker() {
}

SwigDirector_Compactor::SwigDirector_Compactor(VALUE self): Xapian::Compactor(), Swig::Director(self) {
  
}



SwigDirector_Compactor::~SwigDirector_Compactor() {
}

void SwigDirector_Compactor::set_status(std::string const &table, std::string const &status) {
  VALUE obj0 = Qnil ;
  VALUE obj1 = Qnil ;
  VALUE result;
  
  obj0 = SWIG_From_std_string(static_cast< std::string >(table));
  obj1 = SWIG_From_std_string(static_cast< std::string >(status));
  result = rb_funcall(swig_get_self(), rb_intern("set_status"), 2,obj0,obj1);
}


std::string SwigDirector_Compactor::resolve_duplicate_metadata(std::string const &key, size_t num_tags, std::string const tags[]) {
  std::string c_result ;
  VALUE obj0 = Qnil ;
  VALUE obj1 = Qnil ;
  VALUE result;
  
  obj0 = SWIG_From_std_string(static_cast< std::string >(key));
  {
    obj1 = rb_ary_new();
    for (size_t i = 0; i != num_tags; ++i) {
      VALUE str = rb_str_new(tags[i].data(), tags[i].size());
      rb_ary_push(obj1, str);
    }
  }
  result = rb_funcall(swig_get_self(), rb_intern("resolve_duplicate_metadata"), 2,obj0,obj1);
  std::string *swig_optr = 0;
  int swig_ores = SWIG_AsPtr_std_string(result, &swig_optr);
  if (!SWIG_IsOK(swig_ores) || !swig_optr) {
    Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError((swig_optr ? swig_ores : SWIG_TypeError))), "in output value of type '""std::string""'");
  }
  c_result = *swig_optr;
  if (SWIG_IsNewObj(swig_ores)) delete swig_optr;
  return (std::string) c_result;
}


swig_class SwigClassGC_VALUE;


/*
  Document-method: Xapian::GC_VALUE.inspect

  call-seq:
    inspect -> VALUE

Inspect class and its contents.
*/
SWIGINTERN VALUE
_wrap_GC_VALUE_inspect(int argc, VALUE *argv, VALUE self) {
  swig::GC_VALUE *arg1 = (swig::GC_VALUE *) 0 ;
  swig::GC_VALUE r1 ;
  VALUE result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  r1 = self; arg1 = &r1;
  result = (VALUE)((swig::GC_VALUE const *)arg1)->inspect();
  vresult = result;
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::GC_VALUE.to_s

  call-seq:
    to_s -> VALUE

Convert class to a String representation.
*/
SWIGINTERN VALUE
_wrap_GC_VALUE_to_s(int argc, VALUE *argv, VALUE self) {
  swig::GC_VALUE *arg1 = (swig::GC_VALUE *) 0 ;
  swig::GC_VALUE r1 ;
  VALUE result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  r1 = self; arg1 = &r1;
  result = (VALUE)((swig::GC_VALUE const *)arg1)->to_s();
  vresult = result;
  return vresult;
fail:
  return Qnil;
}


swig_class SwigClassConstIterator;

SWIGINTERN void
free_swig_ConstIterator(swig::ConstIterator *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_ConstIterator_value(int argc, VALUE *argv, VALUE self) {
  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","value", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  try {
    result = (VALUE)((swig::ConstIterator const *)arg1)->value();
  }
  catch(swig::stop_iteration &_e) {
    {
      (void)_e;
      SWIG_Ruby_ExceptionType(NULL, Qnil);
      SWIG_fail;
    }
  }
  
  vresult = result;
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::ConstIterator.dup

  call-seq:
    dup -> ConstIterator

Create a duplicate of the class and unfreeze it if needed.
*/
SWIGINTERN VALUE
_wrap_ConstIterator_dup(int argc, VALUE *argv, VALUE self) {
  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::ConstIterator *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","dup", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  result = (swig::ConstIterator *)((swig::ConstIterator const *)arg1)->dup();
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::ConstIterator.inspect

  call-seq:
    inspect -> VALUE

Inspect class and its contents.
*/
SWIGINTERN VALUE
_wrap_ConstIterator_inspect(int argc, VALUE *argv, VALUE self) {
  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","inspect", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  result = (VALUE)((swig::ConstIterator const *)arg1)->inspect();
  vresult = result;
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::ConstIterator.to_s

  call-seq:
    to_s -> VALUE

Convert class to a String representation.
*/
SWIGINTERN VALUE
_wrap_ConstIterator_to_s(int argc, VALUE *argv, VALUE self) {
  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","to_s", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  result = (VALUE)((swig::ConstIterator const *)arg1)->to_s();
  vresult = result;
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ConstIterator_next__SWIG_0(int argc, VALUE *argv, VALUE self) {
  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  size_t arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  swig::ConstIterator *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator *","next", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","next", 2, argv[0] ));
  } 
  arg2 = static_cast< size_t >(val2);
  result = (swig::ConstIterator *)(arg1)->next(arg2);
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ConstIterator_next__SWIG_1(int argc, VALUE *argv, VALUE self) {
  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::ConstIterator *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator *","next", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  try {
    result = (swig::ConstIterator *)(arg1)->next();
  }
  catch(swig::stop_iteration &_e) {
    {
      (void)_e;
      SWIG_Ruby_ExceptionType(NULL, Qnil);
      SWIG_fail;
    }
  }
  
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_ConstIterator_next(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_ConstIterator_next__SWIG_1(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_size_t(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_ConstIterator_next__SWIG_0(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "ConstIterator.next", 
    "    swig::ConstIterator * ConstIterator.next(size_t n)\n"
    "    swig::ConstIterator * ConstIterator.next()\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ConstIterator_previous__SWIG_0(int argc, VALUE *argv, VALUE self) {
  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  size_t arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  swig::ConstIterator *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator *","previous", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","previous", 2, argv[0] ));
  } 
  arg2 = static_cast< size_t >(val2);
  result = (swig::ConstIterator *)(arg1)->previous(arg2);
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ConstIterator_previous__SWIG_1(int argc, VALUE *argv, VALUE self) {
  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::ConstIterator *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator *","previous", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  try {
    result = (swig::ConstIterator *)(arg1)->previous();
  }
  catch(swig::stop_iteration &_e) {
    {
      (void)_e;
      SWIG_Ruby_ExceptionType(NULL, Qnil);
      SWIG_fail;
    }
  }
  
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_ConstIterator_previous(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_ConstIterator_previous__SWIG_1(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_size_t(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_ConstIterator_previous__SWIG_0(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "ConstIterator.previous", 
    "    swig::ConstIterator * ConstIterator.previous(size_t n)\n"
    "    swig::ConstIterator * ConstIterator.previous()\n");
  
  return Qnil;
}



/*
  Document-method: Xapian::ConstIterator.==

  call-seq:
    ==(x) -> bool

Equality comparison operator.
*/
SWIGINTERN VALUE
_wrap_ConstIterator___eq__(int argc, VALUE *argv, VALUE self) {
  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  swig::ConstIterator *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","operator ==", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_swig__ConstIterator,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "swig::ConstIterator const &","operator ==", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "swig::ConstIterator const &","operator ==", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< swig::ConstIterator * >(argp2);
  result = (bool)((swig::ConstIterator const *)arg1)->operator ==((swig::ConstIterator const &)*arg2);
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::ConstIterator.+

  call-seq:
    +(n) -> ConstIterator

Add operator.
*/
SWIGINTERN VALUE
_wrap_ConstIterator___add__(int argc, VALUE *argv, VALUE self) {
  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  ptrdiff_t arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  swig::ConstIterator *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","operator +", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "ptrdiff_t","operator +", 2, argv[0] ));
  } 
  arg2 = static_cast< ptrdiff_t >(val2);
  try {
    result = (swig::ConstIterator *)((swig::ConstIterator const *)arg1)->operator +(arg2);
  }
  catch(swig::stop_iteration &_e) {
    {
      (void)_e;
      SWIG_Ruby_ExceptionType(NULL, Qnil);
      SWIG_fail;
    }
  }
  
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::ConstIterator.-

  call-seq:
    -(n) -> ConstIterator
    -(x) -> ptrdiff_t

Substraction operator.
*/
SWIGINTERN VALUE
_wrap_ConstIterator___sub____SWIG_0(int argc, VALUE *argv, VALUE self) {
  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  ptrdiff_t arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  swig::ConstIterator *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","operator -", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "ptrdiff_t","operator -", 2, argv[0] ));
  } 
  arg2 = static_cast< ptrdiff_t >(val2);
  try {
    result = (swig::ConstIterator *)((swig::ConstIterator const *)arg1)->operator -(arg2);
  }
  catch(swig::stop_iteration &_e) {
    {
      (void)_e;
      SWIG_Ruby_ExceptionType(NULL, Qnil);
      SWIG_fail;
    }
  }
  
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__ConstIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ConstIterator___sub____SWIG_1(int argc, VALUE *argv, VALUE self) {
  swig::ConstIterator *arg1 = (swig::ConstIterator *) 0 ;
  swig::ConstIterator *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  ptrdiff_t result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__ConstIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::ConstIterator const *","operator -", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::ConstIterator * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_swig__ConstIterator,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "swig::ConstIterator const &","operator -", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "swig::ConstIterator const &","operator -", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< swig::ConstIterator * >(argp2);
  result = ((swig::ConstIterator const *)arg1)->operator -((swig::ConstIterator const &)*arg2);
  vresult = SWIG_From_ptrdiff_t(static_cast< ptrdiff_t >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_ConstIterator___sub__(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_swig__ConstIterator, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_ConstIterator___sub____SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__ConstIterator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_ConstIterator___sub____SWIG_0(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "__sub__.new", 
    "    __sub__.new(ptrdiff_t n)\n"
    "    __sub__.new(swig::ConstIterator const &x)\n");
  
  return Qnil;
}


swig_class SwigClassIterator;

SWIGINTERN VALUE
_wrap_Iterator_valuee___(int argc, VALUE *argv, VALUE self) {
  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  VALUE *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE temp2 ;
  VALUE result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator *","setValue", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  temp2 = static_cast< VALUE >(argv[0]);
  arg2 = &temp2;
  result = (VALUE)(arg1)->setValue((VALUE const &)*arg2);
  vresult = result;
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::Iterator.dup

  call-seq:
    dup -> Iterator

Create a duplicate of the class and unfreeze it if needed.
*/
SWIGINTERN VALUE
_wrap_Iterator_dup(int argc, VALUE *argv, VALUE self) {
  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::Iterator *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","dup", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  result = (swig::Iterator *)((swig::Iterator const *)arg1)->dup();
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Iterator_next__SWIG_0(int argc, VALUE *argv, VALUE self) {
  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  size_t arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  swig::Iterator *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator *","next", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","next", 2, argv[0] ));
  } 
  arg2 = static_cast< size_t >(val2);
  result = (swig::Iterator *)(arg1)->next(arg2);
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Iterator_next__SWIG_1(int argc, VALUE *argv, VALUE self) {
  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::Iterator *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator *","next", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  try {
    result = (swig::Iterator *)(arg1)->next();
  }
  catch(swig::stop_iteration &_e) {
    {
      (void)_e;
      SWIG_Ruby_ExceptionType(NULL, Qnil);
      SWIG_fail;
    }
  }
  
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_Iterator_next(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_Iterator_next__SWIG_1(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_size_t(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_Iterator_next__SWIG_0(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "Iterator.next", 
    "    swig::Iterator * Iterator.next(size_t n)\n"
    "    swig::Iterator * Iterator.next()\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Iterator_previous__SWIG_0(int argc, VALUE *argv, VALUE self) {
  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  size_t arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  swig::Iterator *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator *","previous", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","previous", 2, argv[0] ));
  } 
  arg2 = static_cast< size_t >(val2);
  result = (swig::Iterator *)(arg1)->previous(arg2);
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Iterator_previous__SWIG_1(int argc, VALUE *argv, VALUE self) {
  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::Iterator *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator *","previous", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  try {
    result = (swig::Iterator *)(arg1)->previous();
  }
  catch(swig::stop_iteration &_e) {
    {
      (void)_e;
      SWIG_Ruby_ExceptionType(NULL, Qnil);
      SWIG_fail;
    }
  }
  
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_Iterator_previous(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_Iterator_previous__SWIG_1(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_size_t(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_Iterator_previous__SWIG_0(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "Iterator.previous", 
    "    swig::Iterator * Iterator.previous(size_t n)\n"
    "    swig::Iterator * Iterator.previous()\n");
  
  return Qnil;
}



/*
  Document-method: Xapian::Iterator.inspect

  call-seq:
    inspect -> VALUE

Inspect class and its contents.
*/
SWIGINTERN VALUE
_wrap_Iterator_inspect(int argc, VALUE *argv, VALUE self) {
  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","inspect", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  result = (VALUE)((swig::Iterator const *)arg1)->inspect();
  vresult = result;
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::Iterator.to_s

  call-seq:
    to_s -> VALUE

Convert class to a String representation.
*/
SWIGINTERN VALUE
_wrap_Iterator_to_s(int argc, VALUE *argv, VALUE self) {
  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","to_s", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  result = (VALUE)((swig::Iterator const *)arg1)->to_s();
  vresult = result;
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::Iterator.==

  call-seq:
    ==(x) -> bool

Equality comparison operator.
*/
SWIGINTERN VALUE
_wrap_Iterator___eq__(int argc, VALUE *argv, VALUE self) {
  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  swig::Iterator *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","operator ==", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_swig__Iterator,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "swig::Iterator const &","operator ==", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "swig::Iterator const &","operator ==", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< swig::Iterator * >(argp2);
  result = (bool)((swig::Iterator const *)arg1)->operator ==((swig::Iterator const &)*arg2);
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::Iterator.+

  call-seq:
    +(n) -> Iterator

Add operator.
*/
SWIGINTERN VALUE
_wrap_Iterator___add__(int argc, VALUE *argv, VALUE self) {
  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  ptrdiff_t arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  swig::Iterator *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","operator +", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "ptrdiff_t","operator +", 2, argv[0] ));
  } 
  arg2 = static_cast< ptrdiff_t >(val2);
  try {
    result = (swig::Iterator *)((swig::Iterator const *)arg1)->operator +(arg2);
  }
  catch(swig::stop_iteration &_e) {
    {
      (void)_e;
      SWIG_Ruby_ExceptionType(NULL, Qnil);
      SWIG_fail;
    }
  }
  
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::Iterator.-

  call-seq:
    -(n) -> Iterator
    -(x) -> ptrdiff_t

Substraction operator.
*/
SWIGINTERN VALUE
_wrap_Iterator___sub____SWIG_0(int argc, VALUE *argv, VALUE self) {
  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  ptrdiff_t arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  swig::Iterator *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","operator -", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "ptrdiff_t","operator -", 2, argv[0] ));
  } 
  arg2 = static_cast< ptrdiff_t >(val2);
  try {
    result = (swig::Iterator *)((swig::Iterator const *)arg1)->operator -(arg2);
  }
  catch(swig::stop_iteration &_e) {
    {
      (void)_e;
      SWIG_Ruby_ExceptionType(NULL, Qnil);
      SWIG_fail;
    }
  }
  
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__Iterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Iterator___sub____SWIG_1(int argc, VALUE *argv, VALUE self) {
  swig::Iterator *arg1 = (swig::Iterator *) 0 ;
  swig::Iterator *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  ptrdiff_t result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_swig__Iterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "swig::Iterator const *","operator -", 1, self )); 
  }
  arg1 = reinterpret_cast< swig::Iterator * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_swig__Iterator,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "swig::Iterator const &","operator -", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "swig::Iterator const &","operator -", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< swig::Iterator * >(argp2);
  result = ((swig::Iterator const *)arg1)->operator -((swig::Iterator const &)*arg2);
  vresult = SWIG_From_ptrdiff_t(static_cast< ptrdiff_t >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_Iterator___sub__(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_swig__Iterator, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_Iterator___sub____SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__Iterator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_Iterator___sub____SWIG_0(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "__sub__.new", 
    "    __sub__.new(ptrdiff_t n)\n"
    "    __sub__.new(swig::Iterator const &x)\n");
  
  return Qnil;
}


SWIGINTERN void
free_swig_Iterator(swig::Iterator *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_BAD_VALUENO_get(VALUE self) {
  VALUE _val;
  
  _val = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(Xapian::BAD_VALUENO));
  return _val;
}


SWIGINTERN VALUE
_wrap_version_string(int argc, VALUE *argv, VALUE self) {
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  result = (char *)Xapian::version_string();
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_major_version(int argc, VALUE *argv, VALUE self) {
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  result = (int)Xapian::major_version();
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_minor_version(int argc, VALUE *argv, VALUE self) {
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  result = (int)Xapian::minor_version();
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_revision(int argc, VALUE *argv, VALUE self) {
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  result = (int)Xapian::revision();
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


swig_class SwigClassPositionIterator;

SWIGINTERN VALUE
_wrap_new_PositionIterator__SWIG_0(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::PositionIterator";
  Xapian::PositionIterator *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::PositionIterator *)new Xapian::PositionIterator();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_PositionIterator_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_PositionIterator_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__PositionIterator);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_PositionIterator__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::PositionIterator *arg1 = 0 ;
  void *argp1 ;
  int res1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::PositionIterator";
  Xapian::PositionIterator *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_Xapian__PositionIterator,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PositionIterator const &","Xapian::PositionIterator", 1, argv[0] )); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::PositionIterator const &","Xapian::PositionIterator", 1, argv[0])); 
  }
  arg1 = reinterpret_cast< Xapian::PositionIterator * >(argp1);
  {
    try {
      result = (Xapian::PositionIterator *)new Xapian::PositionIterator((Xapian::PositionIterator const &)*arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_PositionIterator(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[1];
  int ii;
  
  argc = nargs;
  if (argc > 1) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 0) {
    return _wrap_new_PositionIterator__SWIG_0(nargs, args, self);
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__PositionIterator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_new_PositionIterator__SWIG_1(nargs, args, self);
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 1, "PositionIterator.new", 
    "    PositionIterator.new()\n"
    "    PositionIterator.new(Xapian::PositionIterator const &other)\n");
  
  return Qnil;
}


SWIGINTERN void
free_Xapian_PositionIterator(Xapian::PositionIterator *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_PositionIterator_termpos(int argc, VALUE *argv, VALUE self) {
  Xapian::PositionIterator *arg1 = (Xapian::PositionIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::termpos result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PositionIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PositionIterator const *","get_termpos", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PositionIterator * >(argp1);
  {
    try {
      result = (Xapian::termpos)Xapian_PositionIterator_get_termpos((Xapian::PositionIterator const *)arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PositionIterator_next(int argc, VALUE *argv, VALUE self) {
  Xapian::PositionIterator *arg1 = (Xapian::PositionIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PositionIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PositionIterator *","next", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PositionIterator * >(argp1);
  {
    try {
      Xapian_PositionIterator_next(arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PositionIterator_equals(int argc, VALUE *argv, VALUE self) {
  Xapian::PositionIterator *arg1 = (Xapian::PositionIterator *) 0 ;
  Xapian::PositionIterator *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PositionIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PositionIterator const *","equals", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PositionIterator * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__PositionIterator,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::PositionIterator const &","equals", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::PositionIterator const &","equals", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::PositionIterator * >(argp2);
  {
    try {
      result = (bool)Xapian_PositionIterator_equals((Xapian::PositionIterator const *)arg1,(Xapian::PositionIterator const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PositionIterator_skip_to(int argc, VALUE *argv, VALUE self) {
  Xapian::PositionIterator *arg1 = (Xapian::PositionIterator *) 0 ;
  Xapian::termpos arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PositionIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PositionIterator *","skip_to", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PositionIterator * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::termpos","skip_to", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::termpos >(val2);
  {
    try {
      (arg1)->skip_to(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PositionIterator_description(int argc, VALUE *argv, VALUE self) {
  Xapian::PositionIterator *arg1 = (Xapian::PositionIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PositionIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PositionIterator const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PositionIterator * >(argp1);
  {
    try {
      result = ((Xapian::PositionIterator const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


swig_class SwigClassPostingIterator;

SWIGINTERN VALUE
_wrap_new_PostingIterator__SWIG_0(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::PostingIterator";
  Xapian::PostingIterator *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::PostingIterator *)new Xapian::PostingIterator();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_PostingIterator(Xapian::PostingIterator *arg1) {
    delete arg1;
}

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_PostingIterator_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_PostingIterator_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__PostingIterator);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_PostingIterator__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingIterator *arg1 = 0 ;
  void *argp1 ;
  int res1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::PostingIterator";
  Xapian::PostingIterator *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_Xapian__PostingIterator,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingIterator const &","Xapian::PostingIterator", 1, argv[0] )); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::PostingIterator const &","Xapian::PostingIterator", 1, argv[0])); 
  }
  arg1 = reinterpret_cast< Xapian::PostingIterator * >(argp1);
  {
    try {
      result = (Xapian::PostingIterator *)new Xapian::PostingIterator((Xapian::PostingIterator const &)*arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_PostingIterator(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[1];
  int ii;
  
  argc = nargs;
  if (argc > 1) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 0) {
    return _wrap_new_PostingIterator__SWIG_0(nargs, args, self);
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__PostingIterator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_new_PostingIterator__SWIG_1(nargs, args, self);
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 1, "PostingIterator.new", 
    "    PostingIterator.new()\n"
    "    PostingIterator.new(Xapian::PostingIterator const &other)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PostingIterator_skip_to(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingIterator *arg1 = (Xapian::PostingIterator *) 0 ;
  Xapian::docid arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingIterator *","skip_to", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingIterator * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","skip_to", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  {
    try {
      (arg1)->skip_to(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PostingIterator_doclength(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingIterator *arg1 = (Xapian::PostingIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::termcount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingIterator const *","get_doclength", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingIterator * >(argp1);
  {
    try {
      result = (Xapian::termcount)((Xapian::PostingIterator const *)arg1)->get_doclength();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PostingIterator_wdf(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingIterator *arg1 = (Xapian::PostingIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::termcount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingIterator const *","get_wdf", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingIterator * >(argp1);
  {
    try {
      result = (Xapian::termcount)((Xapian::PostingIterator const *)arg1)->get_wdf();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PostingIterator__dangerous_positionlist_begin(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingIterator *arg1 = (Xapian::PostingIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::PositionIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingIterator const *","positionlist_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingIterator * >(argp1);
  {
    try {
      result = ((Xapian::PostingIterator const *)arg1)->positionlist_begin();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::PositionIterator(static_cast< const Xapian::PositionIterator& >(result))), SWIGTYPE_p_Xapian__PositionIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PostingIterator__dangerous_positionlist_end(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingIterator *arg1 = (Xapian::PostingIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::PositionIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingIterator const *","positionlist_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingIterator * >(argp1);
  {
    try {
      result = ((Xapian::PostingIterator const *)arg1)->positionlist_end();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::PositionIterator(static_cast< const Xapian::PositionIterator& >(result))), SWIGTYPE_p_Xapian__PositionIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PostingIterator_description(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingIterator *arg1 = (Xapian::PostingIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingIterator const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingIterator * >(argp1);
  {
    try {
      result = ((Xapian::PostingIterator const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PostingIterator_docid(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingIterator *arg1 = (Xapian::PostingIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::docid result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingIterator const *","get_docid", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingIterator * >(argp1);
  {
    try {
      result = (Xapian::docid)Xapian_PostingIterator_get_docid((Xapian::PostingIterator const *)arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PostingIterator_next(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingIterator *arg1 = (Xapian::PostingIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingIterator *","next", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingIterator * >(argp1);
  {
    try {
      Xapian_PostingIterator_next(arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PostingIterator_equals(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingIterator *arg1 = (Xapian::PostingIterator *) 0 ;
  Xapian::PostingIterator *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingIterator const *","equals", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingIterator * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__PostingIterator,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::PostingIterator const &","equals", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::PostingIterator const &","equals", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::PostingIterator * >(argp2);
  {
    try {
      result = (bool)Xapian_PostingIterator_equals((Xapian::PostingIterator const *)arg1,(Xapian::PostingIterator const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::Xapian.==

  call-seq:
    ==(a, b) -> bool

Equality comparison operator.
*/
SWIGINTERN VALUE
_wrap___eq__(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingIterator *arg1 = 0 ;
  Xapian::PostingIterator *arg2 = 0 ;
  void *argp1 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_Xapian__PostingIterator,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingIterator const &","Xapian::operator ==", 1, argv[0] )); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::PostingIterator const &","Xapian::operator ==", 1, argv[0])); 
  }
  arg1 = reinterpret_cast< Xapian::PostingIterator * >(argp1);
  res2 = SWIG_ConvertPtr(argv[1], &argp2, SWIGTYPE_p_Xapian__PostingIterator,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::PostingIterator const &","Xapian::operator ==", 2, argv[1] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::PostingIterator const &","Xapian::operator ==", 2, argv[1])); 
  }
  arg2 = reinterpret_cast< Xapian::PostingIterator * >(argp2);
  {
    try {
      result = (bool)Xapian::operator ==((Xapian::PostingIterator const &)*arg1,(Xapian::PostingIterator const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


swig_class SwigClassTermIterator;

SWIGINTERN VALUE
_wrap_new_TermIterator__SWIG_0(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::TermIterator";
  Xapian::TermIterator *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::TermIterator *)new Xapian::TermIterator();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_TermIterator_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_TermIterator_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__TermIterator);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_TermIterator__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::TermIterator *arg1 = 0 ;
  void *argp1 ;
  int res1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::TermIterator";
  Xapian::TermIterator *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_Xapian__TermIterator,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermIterator const &","Xapian::TermIterator", 1, argv[0] )); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::TermIterator const &","Xapian::TermIterator", 1, argv[0])); 
  }
  arg1 = reinterpret_cast< Xapian::TermIterator * >(argp1);
  {
    try {
      result = (Xapian::TermIterator *)new Xapian::TermIterator((Xapian::TermIterator const &)*arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_TermIterator(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[1];
  int ii;
  
  argc = nargs;
  if (argc > 1) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 0) {
    return _wrap_new_TermIterator__SWIG_0(nargs, args, self);
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__TermIterator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_new_TermIterator__SWIG_1(nargs, args, self);
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 1, "TermIterator.new", 
    "    TermIterator.new()\n"
    "    TermIterator.new(Xapian::TermIterator const &other)\n");
  
  return Qnil;
}


SWIGINTERN void
free_Xapian_TermIterator(Xapian::TermIterator *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_TermIterator_term(int argc, VALUE *argv, VALUE self) {
  Xapian::TermIterator *arg1 = (Xapian::TermIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermIterator const *","get_term", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermIterator * >(argp1);
  {
    try {
      result = Xapian_TermIterator_get_term((Xapian::TermIterator const *)arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermIterator_next(int argc, VALUE *argv, VALUE self) {
  Xapian::TermIterator *arg1 = (Xapian::TermIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermIterator *","next", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermIterator * >(argp1);
  {
    try {
      Xapian_TermIterator_next(arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermIterator_equals(int argc, VALUE *argv, VALUE self) {
  Xapian::TermIterator *arg1 = (Xapian::TermIterator *) 0 ;
  Xapian::TermIterator *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermIterator const *","equals", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermIterator * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__TermIterator,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::TermIterator const &","equals", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::TermIterator const &","equals", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::TermIterator * >(argp2);
  {
    try {
      result = (bool)Xapian_TermIterator_equals((Xapian::TermIterator const *)arg1,(Xapian::TermIterator const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermIterator_skip_to(int argc, VALUE *argv, VALUE self) {
  Xapian::TermIterator *arg1 = (Xapian::TermIterator *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermIterator *","skip_to", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermIterator * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","skip_to", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","skip_to", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      (arg1)->skip_to((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermIterator_wdf(int argc, VALUE *argv, VALUE self) {
  Xapian::TermIterator *arg1 = (Xapian::TermIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::termcount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermIterator const *","get_wdf", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermIterator * >(argp1);
  {
    try {
      result = (Xapian::termcount)((Xapian::TermIterator const *)arg1)->get_wdf();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermIterator_termfreq(int argc, VALUE *argv, VALUE self) {
  Xapian::TermIterator *arg1 = (Xapian::TermIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermIterator const *","get_termfreq", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermIterator * >(argp1);
  {
    try {
      result = (Xapian::doccount)((Xapian::TermIterator const *)arg1)->get_termfreq();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermIterator_positionlist_count(int argc, VALUE *argv, VALUE self) {
  Xapian::TermIterator *arg1 = (Xapian::TermIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::termcount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermIterator const *","positionlist_count", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermIterator * >(argp1);
  {
    try {
      result = (Xapian::termcount)((Xapian::TermIterator const *)arg1)->positionlist_count();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermIterator__dangerous_positionlist_begin(int argc, VALUE *argv, VALUE self) {
  Xapian::TermIterator *arg1 = (Xapian::TermIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::PositionIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermIterator *","positionlist_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermIterator * >(argp1);
  {
    try {
      result = (arg1)->positionlist_begin();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::PositionIterator(static_cast< const Xapian::PositionIterator& >(result))), SWIGTYPE_p_Xapian__PositionIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermIterator__dangerous_positionlist_end(int argc, VALUE *argv, VALUE self) {
  Xapian::TermIterator *arg1 = (Xapian::TermIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::PositionIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermIterator *","positionlist_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermIterator * >(argp1);
  {
    try {
      result = (arg1)->positionlist_end();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::PositionIterator(static_cast< const Xapian::PositionIterator& >(result))), SWIGTYPE_p_Xapian__PositionIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermIterator_description(int argc, VALUE *argv, VALUE self) {
  Xapian::TermIterator *arg1 = (Xapian::TermIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermIterator const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermIterator * >(argp1);
  {
    try {
      result = ((Xapian::TermIterator const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


swig_class SwigClassValueIterator;

SWIGINTERN VALUE
_wrap_new_ValueIterator__SWIG_0(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::ValueIterator";
  Xapian::ValueIterator *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::ValueIterator *)new Xapian::ValueIterator();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_ValueIterator_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_ValueIterator_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__ValueIterator);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_ValueIterator__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueIterator *arg1 = 0 ;
  void *argp1 ;
  int res1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::ValueIterator";
  Xapian::ValueIterator *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_Xapian__ValueIterator,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueIterator const &","Xapian::ValueIterator", 1, argv[0] )); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::ValueIterator const &","Xapian::ValueIterator", 1, argv[0])); 
  }
  arg1 = reinterpret_cast< Xapian::ValueIterator * >(argp1);
  {
    try {
      result = (Xapian::ValueIterator *)new Xapian::ValueIterator((Xapian::ValueIterator const &)*arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_ValueIterator(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[1];
  int ii;
  
  argc = nargs;
  if (argc > 1) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 0) {
    return _wrap_new_ValueIterator__SWIG_0(nargs, args, self);
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__ValueIterator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_new_ValueIterator__SWIG_1(nargs, args, self);
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 1, "ValueIterator.new", 
    "    ValueIterator.new()\n"
    "    ValueIterator.new(Xapian::ValueIterator const &other)\n");
  
  return Qnil;
}


SWIGINTERN void
free_Xapian_ValueIterator(Xapian::ValueIterator *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_ValueIterator_value(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueIterator *arg1 = (Xapian::ValueIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueIterator const *","get_value", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueIterator * >(argp1);
  {
    try {
      result = Xapian_ValueIterator_get_value((Xapian::ValueIterator const *)arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueIterator_next(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueIterator *arg1 = (Xapian::ValueIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueIterator *","next", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueIterator * >(argp1);
  {
    try {
      Xapian_ValueIterator_next(arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueIterator_equals(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueIterator *arg1 = (Xapian::ValueIterator *) 0 ;
  Xapian::ValueIterator *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueIterator const *","equals", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueIterator * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__ValueIterator,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::ValueIterator const &","equals", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::ValueIterator const &","equals", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::ValueIterator * >(argp2);
  {
    try {
      result = (bool)Xapian_ValueIterator_equals((Xapian::ValueIterator const *)arg1,(Xapian::ValueIterator const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueIterator_docid(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueIterator *arg1 = (Xapian::ValueIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::docid result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueIterator const *","get_docid", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueIterator * >(argp1);
  {
    try {
      result = (Xapian::docid)((Xapian::ValueIterator const *)arg1)->get_docid();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueIterator_valueno(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueIterator *arg1 = (Xapian::ValueIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::valueno result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueIterator const *","get_valueno", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueIterator * >(argp1);
  {
    try {
      result = (Xapian::valueno)((Xapian::ValueIterator const *)arg1)->get_valueno();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueIterator_skip_to(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueIterator *arg1 = (Xapian::ValueIterator *) 0 ;
  Xapian::docid arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueIterator *","skip_to", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueIterator * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","skip_to", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  {
    try {
      (arg1)->skip_to(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueIterator_check(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueIterator *arg1 = (Xapian::ValueIterator *) 0 ;
  Xapian::docid arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueIterator *","check", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueIterator * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","check", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  {
    try {
      result = (bool)(arg1)->check(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueIterator_description(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueIterator *arg1 = (Xapian::ValueIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueIterator const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueIterator * >(argp1);
  {
    try {
      result = ((Xapian::ValueIterator const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


swig_class SwigClassDocument;

SWIGINTERN VALUE
_wrap_new_Document__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = 0 ;
  void *argp1 ;
  int res1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::Document";
  Xapian::Document *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_Xapian__Document,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document const &","Xapian::Document", 1, argv[0] )); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Document const &","Xapian::Document", 1, argv[0])); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    try {
      result = (Xapian::Document *)new Xapian::Document((Xapian::Document const &)*arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_Document_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_Document_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__Document);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_Document__SWIG_1(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::Document";
  Xapian::Document *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::Document *)new Xapian::Document();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_Document(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[1];
  int ii;
  
  argc = nargs;
  if (argc > 1) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 0) {
    return _wrap_new_Document__SWIG_1(nargs, args, self);
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Document, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_new_Document__SWIG_0(nargs, args, self);
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 1, "Document.new", 
    "    Document.new(Xapian::Document const &other)\n"
    "    Document.new()\n");
  
  return Qnil;
}


SWIGINTERN void
free_Xapian_Document(Xapian::Document *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_Document_value(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  Xapian::valueno arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document const *","get_value", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","get_value", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  {
    try {
      result = ((Xapian::Document const *)arg1)->get_value(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document_add_value(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  Xapian::valueno arg2 ;
  std::string *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document *","add_value", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","add_value", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::string const &","add_value", 3, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","add_value", 3, argv[1])); 
    }
    arg3 = ptr;
  }
  {
    try {
      (arg1)->add_value(arg2,(std::string const &)*arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res3)) delete arg3;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document_remove_value(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  Xapian::valueno arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document *","remove_value", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","remove_value", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  {
    try {
      (arg1)->remove_value(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document_clear_values(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document *","clear_values", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    try {
      (arg1)->clear_values();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document_data(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document const *","get_data", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    try {
      result = ((Xapian::Document const *)arg1)->get_data();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document_datae___(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document *","set_data", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","set_data", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","set_data", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      (arg1)->set_data((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document_add_posting__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  std::string *arg2 = 0 ;
  Xapian::termpos arg3 ;
  Xapian::termcount arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document *","add_posting", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","add_posting", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","add_posting", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::termpos","add_posting", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::termpos >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "Xapian::termcount","add_posting", 4, argv[2] ));
  } 
  arg4 = static_cast< Xapian::termcount >(val4);
  {
    try {
      (arg1)->add_posting((std::string const &)*arg2,arg3,arg4);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document_add_posting__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  std::string *arg2 = 0 ;
  Xapian::termpos arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document *","add_posting", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","add_posting", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","add_posting", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::termpos","add_posting", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::termpos >(val3);
  {
    try {
      (arg1)->add_posting((std::string const &)*arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE _wrap_Document_add_posting(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[5];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 5) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Document, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_Document_add_posting__SWIG_1(nargs, args, self);
        }
      }
    }
  }
  if (argc == 4) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Document, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          {
            int res = SWIG_AsVal_unsigned_SS_int(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
          if (_v) {
            return _wrap_Document_add_posting__SWIG_0(nargs, args, self);
          }
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 5, "Document.add_posting", 
    "    void Document.add_posting(std::string const &tname, Xapian::termpos tpos, Xapian::termcount wdfinc)\n"
    "    void Document.add_posting(std::string const &tname, Xapian::termpos tpos)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document_add_term__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  std::string *arg2 = 0 ;
  Xapian::termcount arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document *","add_term", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","add_term", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","add_term", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::termcount","add_term", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::termcount >(val3);
  {
    try {
      (arg1)->add_term((std::string const &)*arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document_add_term__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document *","add_term", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","add_term", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","add_term", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      (arg1)->add_term((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE _wrap_Document_add_term(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[4];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 4) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Document, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_Document_add_term__SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Document, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_Document_add_term__SWIG_0(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 4, "Document.add_term", 
    "    void Document.add_term(std::string const &tname, Xapian::termcount wdfinc)\n"
    "    void Document.add_term(std::string const &tname)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document_add_boolean_term(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document *","add_boolean_term", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","add_boolean_term", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","add_boolean_term", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      (arg1)->add_boolean_term((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document_remove_posting__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  std::string *arg2 = 0 ;
  Xapian::termpos arg3 ;
  Xapian::termcount arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document *","remove_posting", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","remove_posting", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","remove_posting", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::termpos","remove_posting", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::termpos >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "Xapian::termcount","remove_posting", 4, argv[2] ));
  } 
  arg4 = static_cast< Xapian::termcount >(val4);
  {
    try {
      (arg1)->remove_posting((std::string const &)*arg2,arg3,arg4);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document_remove_posting__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  std::string *arg2 = 0 ;
  Xapian::termpos arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document *","remove_posting", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","remove_posting", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","remove_posting", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::termpos","remove_posting", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::termpos >(val3);
  {
    try {
      (arg1)->remove_posting((std::string const &)*arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE _wrap_Document_remove_posting(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[5];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 5) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Document, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_Document_remove_posting__SWIG_1(nargs, args, self);
        }
      }
    }
  }
  if (argc == 4) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Document, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          {
            int res = SWIG_AsVal_unsigned_SS_int(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
          if (_v) {
            return _wrap_Document_remove_posting__SWIG_0(nargs, args, self);
          }
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 5, "Document.remove_posting", 
    "    void Document.remove_posting(std::string const &tname, Xapian::termpos tpos, Xapian::termcount wdfdec)\n"
    "    void Document.remove_posting(std::string const &tname, Xapian::termpos tpos)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document_remove_term(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document *","remove_term", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","remove_term", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","remove_term", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      (arg1)->remove_term((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document_clear_terms(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document *","clear_terms", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    try {
      (arg1)->clear_terms();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document_termlist_count(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::termcount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document const *","termlist_count", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    try {
      result = (Xapian::termcount)((Xapian::Document const *)arg1)->termlist_count();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document__dangerous_termlist_begin(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document const *","termlist_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    try {
      result = ((Xapian::Document const *)arg1)->termlist_begin();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document__dangerous_termlist_end(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document const *","termlist_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    try {
      result = ((Xapian::Document const *)arg1)->termlist_end();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document_values_count(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::termcount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document const *","values_count", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    try {
      result = (Xapian::termcount)((Xapian::Document const *)arg1)->values_count();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document__dangerous_values_begin(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::ValueIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document const *","values_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    try {
      result = ((Xapian::Document const *)arg1)->values_begin();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::ValueIterator(static_cast< const Xapian::ValueIterator& >(result))), SWIGTYPE_p_Xapian__ValueIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document__dangerous_values_end(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::ValueIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document const *","values_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    try {
      result = ((Xapian::Document const *)arg1)->values_end();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::ValueIterator(static_cast< const Xapian::ValueIterator& >(result))), SWIGTYPE_p_Xapian__ValueIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document_docid(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::docid result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document const *","get_docid", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    try {
      result = (Xapian::docid)((Xapian::Document const *)arg1)->get_docid();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document_serialise(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document const *","serialise", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    try {
      result = ((Xapian::Document const *)arg1)->serialise();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document_unserialise(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  Xapian::Document result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Document::unserialise", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Document::unserialise", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  {
    try {
      result = Xapian::Document::unserialise((std::string const &)*arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::Document(static_cast< const Xapian::Document& >(result))), SWIGTYPE_p_Xapian__Document, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Document_description(int argc, VALUE *argv, VALUE self) {
  Xapian::Document *arg1 = (Xapian::Document *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Document, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Document const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Document * >(argp1);
  {
    try {
      result = ((Xapian::Document const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


swig_class SwigClassPostingSource;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_PostingSource_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_PostingSource_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__PostingSource);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_PostingSource(int argc, VALUE *argv, VALUE self) {
  VALUE arg1 = (VALUE) 0 ;
  const char *classname SWIGUNUSED = "Xapian::PostingSource";
  Xapian::PostingSource *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  arg1 = self;
  {
    try {
      if ( strcmp(rb_obj_classname(self), classname) != 0 ) {
        /* subclassed */
        result = (Xapian::PostingSource *)new SwigDirector_PostingSource(arg1); 
      } else {
        rb_raise(rb_eNameError,"accessing abstract class or protected constructor"); 
        return Qnil;
      }
      
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_PostingSource(Xapian::PostingSource *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_PostingSource_get_termfreq_min(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingSource *arg1 = (Xapian::PostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Swig::Director *director = 0;
  bool upcall = false;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingSource const *","get_termfreq_min", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingSource * >(argp1);
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          Swig::DirectorPureVirtualException::raise("Xapian::PostingSource::get_termfreq_min");
        } else {
          result = (Xapian::doccount)((Xapian::PostingSource const *)arg1)->get_termfreq_min();
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PostingSource_get_termfreq_est(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingSource *arg1 = (Xapian::PostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Swig::Director *director = 0;
  bool upcall = false;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingSource const *","get_termfreq_est", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingSource * >(argp1);
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          Swig::DirectorPureVirtualException::raise("Xapian::PostingSource::get_termfreq_est");
        } else {
          result = (Xapian::doccount)((Xapian::PostingSource const *)arg1)->get_termfreq_est();
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PostingSource_get_termfreq_max(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingSource *arg1 = (Xapian::PostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Swig::Director *director = 0;
  bool upcall = false;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingSource const *","get_termfreq_max", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingSource * >(argp1);
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          Swig::DirectorPureVirtualException::raise("Xapian::PostingSource::get_termfreq_max");
        } else {
          result = (Xapian::doccount)((Xapian::PostingSource const *)arg1)->get_termfreq_max();
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PostingSource_get_maxweight(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingSource *arg1 = (Xapian::PostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingSource const *","get_maxweight", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingSource * >(argp1);
  {
    try {
      result = (Xapian::weight)((Xapian::PostingSource const *)arg1)->get_maxweight();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PostingSource_weight(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingSource *arg1 = (Xapian::PostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Swig::Director *director = 0;
  bool upcall = false;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingSource const *","get_weight", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingSource * >(argp1);
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          result = (Xapian::weight)((Xapian::PostingSource const *)arg1)->Xapian::PostingSource::get_weight();
        } else {
          result = (Xapian::weight)((Xapian::PostingSource const *)arg1)->get_weight();
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PostingSource_docid(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingSource *arg1 = (Xapian::PostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Swig::Director *director = 0;
  bool upcall = false;
  Xapian::docid result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingSource const *","get_docid", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingSource * >(argp1);
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          Swig::DirectorPureVirtualException::raise("Xapian::PostingSource::get_docid");
        } else {
          result = (Xapian::docid)((Xapian::PostingSource const *)arg1)->get_docid();
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PostingSource_next(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingSource *arg1 = (Xapian::PostingSource *) 0 ;
  Xapian::weight arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  Swig::Director *director = 0;
  bool upcall = false;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingSource *","next", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingSource * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::weight","next", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::weight >(val2);
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          Swig::DirectorPureVirtualException::raise("Xapian::PostingSource::next");
        } else {
          (arg1)->next(arg2);
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PostingSource_skip_to(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingSource *arg1 = (Xapian::PostingSource *) 0 ;
  Xapian::docid arg2 ;
  Xapian::weight arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  Swig::Director *director = 0;
  bool upcall = false;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingSource *","skip_to", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingSource * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","skip_to", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::weight","skip_to", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::weight >(val3);
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          (arg1)->Xapian::PostingSource::skip_to(arg2,arg3);
        } else {
          (arg1)->skip_to(arg2,arg3);
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PostingSource_check(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingSource *arg1 = (Xapian::PostingSource *) 0 ;
  Xapian::docid arg2 ;
  Xapian::weight arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  Swig::Director *director = 0;
  bool upcall = false;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingSource *","check", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingSource * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","check", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::weight","check", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::weight >(val3);
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          result = (bool)(arg1)->Xapian::PostingSource::check(arg2,arg3);
        } else {
          result = (bool)(arg1)->check(arg2,arg3);
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PostingSource_at_end(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingSource *arg1 = (Xapian::PostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Swig::Director *director = 0;
  bool upcall = false;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingSource const *","at_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingSource * >(argp1);
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          Swig::DirectorPureVirtualException::raise("Xapian::PostingSource::at_end");
        } else {
          result = (bool)((Xapian::PostingSource const *)arg1)->at_end();
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PostingSource_name(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingSource *arg1 = (Xapian::PostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Swig::Director *director = 0;
  bool upcall = false;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingSource const *","name", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingSource * >(argp1);
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          result = ((Xapian::PostingSource const *)arg1)->Xapian::PostingSource::name();
        } else {
          result = ((Xapian::PostingSource const *)arg1)->name();
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PostingSource_init(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingSource *arg1 = (Xapian::PostingSource *) 0 ;
  Xapian::Database *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  Swig::Director *director = 0;
  bool upcall = false;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingSource *","init", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingSource * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Database,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Database const &","init", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Database const &","init", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Database * >(argp2);
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          Swig::DirectorPureVirtualException::raise("Xapian::PostingSource::init");
        } else {
          (arg1)->init((Xapian::Database const &)*arg2);
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_PostingSource_description(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingSource *arg1 = (Xapian::PostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Swig::Director *director = 0;
  bool upcall = false;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__PostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingSource const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingSource * >(argp1);
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          result = ((Xapian::PostingSource const *)arg1)->Xapian::PostingSource::get_description();
        } else {
          result = ((Xapian::PostingSource const *)arg1)->get_description();
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_disown_PostingSource(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingSource *arg1 = (Xapian::PostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_Xapian__PostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingSource *","disown_PostingSource", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingSource * >(argp1);
  {
    Swig::Director *director = SWIG_DIRECTOR_CAST(arg1);
    if (director) director->swig_disown();
  }
  
  return Qnil;
fail:
  return Qnil;
}


swig_class SwigClassValuePostingSource;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_ValuePostingSource_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_ValuePostingSource_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__ValuePostingSource);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_ValuePostingSource(int argc, VALUE *argv, VALUE self) {
  Xapian::valueno arg1 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::ValuePostingSource";
  Xapian::ValuePostingSource *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::ValuePostingSource", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::valueno >(val1);
  {
    try {
      result = (Xapian::ValuePostingSource *)new Xapian::ValuePostingSource(arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValuePostingSource_get_termfreq_min(int argc, VALUE *argv, VALUE self) {
  Xapian::ValuePostingSource *arg1 = (Xapian::ValuePostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValuePostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValuePostingSource const *","get_termfreq_min", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValuePostingSource * >(argp1);
  {
    try {
      result = (Xapian::doccount)((Xapian::ValuePostingSource const *)arg1)->get_termfreq_min();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValuePostingSource_get_termfreq_est(int argc, VALUE *argv, VALUE self) {
  Xapian::ValuePostingSource *arg1 = (Xapian::ValuePostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValuePostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValuePostingSource const *","get_termfreq_est", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValuePostingSource * >(argp1);
  {
    try {
      result = (Xapian::doccount)((Xapian::ValuePostingSource const *)arg1)->get_termfreq_est();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValuePostingSource_get_termfreq_max(int argc, VALUE *argv, VALUE self) {
  Xapian::ValuePostingSource *arg1 = (Xapian::ValuePostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValuePostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValuePostingSource const *","get_termfreq_max", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValuePostingSource * >(argp1);
  {
    try {
      result = (Xapian::doccount)((Xapian::ValuePostingSource const *)arg1)->get_termfreq_max();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValuePostingSource_next(int argc, VALUE *argv, VALUE self) {
  Xapian::ValuePostingSource *arg1 = (Xapian::ValuePostingSource *) 0 ;
  Xapian::weight arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValuePostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValuePostingSource *","next", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValuePostingSource * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::weight","next", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::weight >(val2);
  {
    try {
      (arg1)->next(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValuePostingSource_skip_to(int argc, VALUE *argv, VALUE self) {
  Xapian::ValuePostingSource *arg1 = (Xapian::ValuePostingSource *) 0 ;
  Xapian::docid arg2 ;
  Xapian::weight arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValuePostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValuePostingSource *","skip_to", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValuePostingSource * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","skip_to", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::weight","skip_to", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::weight >(val3);
  {
    try {
      (arg1)->skip_to(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValuePostingSource_check(int argc, VALUE *argv, VALUE self) {
  Xapian::ValuePostingSource *arg1 = (Xapian::ValuePostingSource *) 0 ;
  Xapian::docid arg2 ;
  Xapian::weight arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValuePostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValuePostingSource *","check", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValuePostingSource * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","check", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::weight","check", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::weight >(val3);
  {
    try {
      result = (bool)(arg1)->check(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValuePostingSource_at_end(int argc, VALUE *argv, VALUE self) {
  Xapian::ValuePostingSource *arg1 = (Xapian::ValuePostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValuePostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValuePostingSource const *","at_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValuePostingSource * >(argp1);
  {
    try {
      result = (bool)((Xapian::ValuePostingSource const *)arg1)->at_end();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValuePostingSource_docid(int argc, VALUE *argv, VALUE self) {
  Xapian::ValuePostingSource *arg1 = (Xapian::ValuePostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::docid result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValuePostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValuePostingSource const *","get_docid", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValuePostingSource * >(argp1);
  {
    try {
      result = (Xapian::docid)((Xapian::ValuePostingSource const *)arg1)->get_docid();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValuePostingSource_init(int argc, VALUE *argv, VALUE self) {
  Xapian::ValuePostingSource *arg1 = (Xapian::ValuePostingSource *) 0 ;
  Xapian::Database *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValuePostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValuePostingSource *","init", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValuePostingSource * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Database,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Database const &","init", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Database const &","init", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Database * >(argp2);
  {
    try {
      (arg1)->init((Xapian::Database const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_ValuePostingSource(Xapian::ValuePostingSource *arg1) {
    delete arg1;
}

swig_class SwigClassValueWeightPostingSource;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_ValueWeightPostingSource_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_ValueWeightPostingSource_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__ValueWeightPostingSource);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_ValueWeightPostingSource(int argc, VALUE *argv, VALUE self) {
  Xapian::valueno arg1 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::ValueWeightPostingSource";
  Xapian::ValueWeightPostingSource *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::ValueWeightPostingSource", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::valueno >(val1);
  {
    try {
      result = (Xapian::ValueWeightPostingSource *)new Xapian::ValueWeightPostingSource(arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueWeightPostingSource_weight(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueWeightPostingSource *arg1 = (Xapian::ValueWeightPostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueWeightPostingSource const *","get_weight", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueWeightPostingSource * >(argp1);
  {
    try {
      result = (Xapian::weight)((Xapian::ValueWeightPostingSource const *)arg1)->get_weight();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueWeightPostingSource_name(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueWeightPostingSource *arg1 = (Xapian::ValueWeightPostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueWeightPostingSource const *","name", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueWeightPostingSource * >(argp1);
  {
    try {
      result = ((Xapian::ValueWeightPostingSource const *)arg1)->name();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueWeightPostingSource_init(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueWeightPostingSource *arg1 = (Xapian::ValueWeightPostingSource *) 0 ;
  Xapian::Database *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueWeightPostingSource *","init", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueWeightPostingSource * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Database,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Database const &","init", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Database const &","init", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Database * >(argp2);
  {
    try {
      (arg1)->init((Xapian::Database const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueWeightPostingSource_description(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueWeightPostingSource *arg1 = (Xapian::ValueWeightPostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueWeightPostingSource const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueWeightPostingSource * >(argp1);
  {
    try {
      result = ((Xapian::ValueWeightPostingSource const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_ValueWeightPostingSource(Xapian::ValueWeightPostingSource *arg1) {
    delete arg1;
}

swig_class SwigClassDecreasingValueWeightPostingSource;

SWIGINTERN VALUE
_wrap_new_DecreasingValueWeightPostingSource__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::valueno arg1 ;
  Xapian::docid arg2 ;
  Xapian::docid arg3 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::DecreasingValueWeightPostingSource";
  Xapian::DecreasingValueWeightPostingSource *result = 0 ;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::DecreasingValueWeightPostingSource", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::valueno >(val1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","Xapian::DecreasingValueWeightPostingSource", 2, argv[1] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::docid","Xapian::DecreasingValueWeightPostingSource", 3, argv[2] ));
  } 
  arg3 = static_cast< Xapian::docid >(val3);
  {
    try {
      result = (Xapian::DecreasingValueWeightPostingSource *)new Xapian::DecreasingValueWeightPostingSource(arg1,arg2,arg3);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_new_DecreasingValueWeightPostingSource__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::valueno arg1 ;
  Xapian::docid arg2 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::DecreasingValueWeightPostingSource";
  Xapian::DecreasingValueWeightPostingSource *result = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::DecreasingValueWeightPostingSource", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::valueno >(val1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","Xapian::DecreasingValueWeightPostingSource", 2, argv[1] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  {
    try {
      result = (Xapian::DecreasingValueWeightPostingSource *)new Xapian::DecreasingValueWeightPostingSource(arg1,arg2);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_DecreasingValueWeightPostingSource_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_DecreasingValueWeightPostingSource_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__DecreasingValueWeightPostingSource);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_DecreasingValueWeightPostingSource__SWIG_2(int argc, VALUE *argv, VALUE self) {
  Xapian::valueno arg1 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::DecreasingValueWeightPostingSource";
  Xapian::DecreasingValueWeightPostingSource *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::DecreasingValueWeightPostingSource", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::valueno >(val1);
  {
    try {
      result = (Xapian::DecreasingValueWeightPostingSource *)new Xapian::DecreasingValueWeightPostingSource(arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_DecreasingValueWeightPostingSource(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs;
  if (argc > 3) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 1) {
    int _v;
    {
      int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      return _wrap_new_DecreasingValueWeightPostingSource__SWIG_2(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    {
      int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_new_DecreasingValueWeightPostingSource__SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    {
      int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_new_DecreasingValueWeightPostingSource__SWIG_0(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "DecreasingValueWeightPostingSource.new", 
    "    DecreasingValueWeightPostingSource.new(Xapian::valueno slot_, Xapian::docid range_start_, Xapian::docid range_end_)\n"
    "    DecreasingValueWeightPostingSource.new(Xapian::valueno slot_, Xapian::docid range_start_)\n"
    "    DecreasingValueWeightPostingSource.new(Xapian::valueno slot_)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_DecreasingValueWeightPostingSource_weight(int argc, VALUE *argv, VALUE self) {
  Xapian::DecreasingValueWeightPostingSource *arg1 = (Xapian::DecreasingValueWeightPostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__DecreasingValueWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::DecreasingValueWeightPostingSource const *","get_weight", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::DecreasingValueWeightPostingSource * >(argp1);
  {
    try {
      result = (Xapian::weight)((Xapian::DecreasingValueWeightPostingSource const *)arg1)->get_weight();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_DecreasingValueWeightPostingSource_name(int argc, VALUE *argv, VALUE self) {
  Xapian::DecreasingValueWeightPostingSource *arg1 = (Xapian::DecreasingValueWeightPostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__DecreasingValueWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::DecreasingValueWeightPostingSource const *","name", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::DecreasingValueWeightPostingSource * >(argp1);
  {
    try {
      result = ((Xapian::DecreasingValueWeightPostingSource const *)arg1)->name();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_DecreasingValueWeightPostingSource_init(int argc, VALUE *argv, VALUE self) {
  Xapian::DecreasingValueWeightPostingSource *arg1 = (Xapian::DecreasingValueWeightPostingSource *) 0 ;
  Xapian::Database *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__DecreasingValueWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::DecreasingValueWeightPostingSource *","init", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::DecreasingValueWeightPostingSource * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Database,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Database const &","init", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Database const &","init", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Database * >(argp2);
  {
    try {
      (arg1)->init((Xapian::Database const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_DecreasingValueWeightPostingSource_next(int argc, VALUE *argv, VALUE self) {
  Xapian::DecreasingValueWeightPostingSource *arg1 = (Xapian::DecreasingValueWeightPostingSource *) 0 ;
  Xapian::weight arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__DecreasingValueWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::DecreasingValueWeightPostingSource *","next", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::DecreasingValueWeightPostingSource * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::weight","next", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::weight >(val2);
  {
    try {
      (arg1)->next(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_DecreasingValueWeightPostingSource_skip_to(int argc, VALUE *argv, VALUE self) {
  Xapian::DecreasingValueWeightPostingSource *arg1 = (Xapian::DecreasingValueWeightPostingSource *) 0 ;
  Xapian::docid arg2 ;
  Xapian::weight arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__DecreasingValueWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::DecreasingValueWeightPostingSource *","skip_to", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::DecreasingValueWeightPostingSource * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","skip_to", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::weight","skip_to", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::weight >(val3);
  {
    try {
      (arg1)->skip_to(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_DecreasingValueWeightPostingSource_check(int argc, VALUE *argv, VALUE self) {
  Xapian::DecreasingValueWeightPostingSource *arg1 = (Xapian::DecreasingValueWeightPostingSource *) 0 ;
  Xapian::docid arg2 ;
  Xapian::weight arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__DecreasingValueWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::DecreasingValueWeightPostingSource *","check", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::DecreasingValueWeightPostingSource * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","check", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::weight","check", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::weight >(val3);
  {
    try {
      result = (bool)(arg1)->check(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_DecreasingValueWeightPostingSource_description(int argc, VALUE *argv, VALUE self) {
  Xapian::DecreasingValueWeightPostingSource *arg1 = (Xapian::DecreasingValueWeightPostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__DecreasingValueWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::DecreasingValueWeightPostingSource const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::DecreasingValueWeightPostingSource * >(argp1);
  {
    try {
      result = ((Xapian::DecreasingValueWeightPostingSource const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_DecreasingValueWeightPostingSource(Xapian::DecreasingValueWeightPostingSource *arg1) {
    delete arg1;
}

swig_class SwigClassValueMapPostingSource;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_ValueMapPostingSource_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_ValueMapPostingSource_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__ValueMapPostingSource);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_ValueMapPostingSource(int argc, VALUE *argv, VALUE self) {
  Xapian::valueno arg1 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::ValueMapPostingSource";
  Xapian::ValueMapPostingSource *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::ValueMapPostingSource", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::valueno >(val1);
  {
    try {
      result = (Xapian::ValueMapPostingSource *)new Xapian::ValueMapPostingSource(arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueMapPostingSource_add_mapping(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueMapPostingSource *arg1 = (Xapian::ValueMapPostingSource *) 0 ;
  std::string *arg2 = 0 ;
  double arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  double val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueMapPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueMapPostingSource *","add_mapping", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueMapPostingSource * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","add_mapping", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","add_mapping", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","add_mapping", 3, argv[1] ));
  } 
  arg3 = static_cast< double >(val3);
  {
    try {
      (arg1)->add_mapping((std::string const &)*arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueMapPostingSource_clear_mappings(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueMapPostingSource *arg1 = (Xapian::ValueMapPostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueMapPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueMapPostingSource *","clear_mappings", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueMapPostingSource * >(argp1);
  {
    try {
      (arg1)->clear_mappings();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueMapPostingSource_set_default_weight(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueMapPostingSource *arg1 = (Xapian::ValueMapPostingSource *) 0 ;
  double arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueMapPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueMapPostingSource *","set_default_weight", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueMapPostingSource * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","set_default_weight", 2, argv[0] ));
  } 
  arg2 = static_cast< double >(val2);
  {
    try {
      (arg1)->set_default_weight(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueMapPostingSource_weight(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueMapPostingSource *arg1 = (Xapian::ValueMapPostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueMapPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueMapPostingSource const *","get_weight", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueMapPostingSource * >(argp1);
  {
    try {
      result = (Xapian::weight)((Xapian::ValueMapPostingSource const *)arg1)->get_weight();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueMapPostingSource_name(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueMapPostingSource *arg1 = (Xapian::ValueMapPostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueMapPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueMapPostingSource const *","name", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueMapPostingSource * >(argp1);
  {
    try {
      result = ((Xapian::ValueMapPostingSource const *)arg1)->name();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueMapPostingSource_init(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueMapPostingSource *arg1 = (Xapian::ValueMapPostingSource *) 0 ;
  Xapian::Database *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueMapPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueMapPostingSource *","init", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueMapPostingSource * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Database,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Database const &","init", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Database const &","init", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Database * >(argp2);
  {
    try {
      (arg1)->init((Xapian::Database const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueMapPostingSource_description(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueMapPostingSource *arg1 = (Xapian::ValueMapPostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueMapPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueMapPostingSource const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueMapPostingSource * >(argp1);
  {
    try {
      result = ((Xapian::ValueMapPostingSource const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_ValueMapPostingSource(Xapian::ValueMapPostingSource *arg1) {
    delete arg1;
}

swig_class SwigClassFixedWeightPostingSource;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_FixedWeightPostingSource_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_FixedWeightPostingSource_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__FixedWeightPostingSource);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_FixedWeightPostingSource(int argc, VALUE *argv, VALUE self) {
  Xapian::weight arg1 ;
  double val1 ;
  int ecode1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::FixedWeightPostingSource";
  Xapian::FixedWeightPostingSource *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_double(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::weight","Xapian::FixedWeightPostingSource", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::weight >(val1);
  {
    try {
      result = (Xapian::FixedWeightPostingSource *)new Xapian::FixedWeightPostingSource(arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_FixedWeightPostingSource_get_termfreq_min(int argc, VALUE *argv, VALUE self) {
  Xapian::FixedWeightPostingSource *arg1 = (Xapian::FixedWeightPostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__FixedWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::FixedWeightPostingSource const *","get_termfreq_min", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::FixedWeightPostingSource * >(argp1);
  {
    try {
      result = (Xapian::doccount)((Xapian::FixedWeightPostingSource const *)arg1)->get_termfreq_min();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_FixedWeightPostingSource_get_termfreq_est(int argc, VALUE *argv, VALUE self) {
  Xapian::FixedWeightPostingSource *arg1 = (Xapian::FixedWeightPostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__FixedWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::FixedWeightPostingSource const *","get_termfreq_est", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::FixedWeightPostingSource * >(argp1);
  {
    try {
      result = (Xapian::doccount)((Xapian::FixedWeightPostingSource const *)arg1)->get_termfreq_est();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_FixedWeightPostingSource_get_termfreq_max(int argc, VALUE *argv, VALUE self) {
  Xapian::FixedWeightPostingSource *arg1 = (Xapian::FixedWeightPostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__FixedWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::FixedWeightPostingSource const *","get_termfreq_max", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::FixedWeightPostingSource * >(argp1);
  {
    try {
      result = (Xapian::doccount)((Xapian::FixedWeightPostingSource const *)arg1)->get_termfreq_max();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_FixedWeightPostingSource_weight(int argc, VALUE *argv, VALUE self) {
  Xapian::FixedWeightPostingSource *arg1 = (Xapian::FixedWeightPostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__FixedWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::FixedWeightPostingSource const *","get_weight", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::FixedWeightPostingSource * >(argp1);
  {
    try {
      result = (Xapian::weight)((Xapian::FixedWeightPostingSource const *)arg1)->get_weight();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_FixedWeightPostingSource_next(int argc, VALUE *argv, VALUE self) {
  Xapian::FixedWeightPostingSource *arg1 = (Xapian::FixedWeightPostingSource *) 0 ;
  Xapian::weight arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__FixedWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::FixedWeightPostingSource *","next", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::FixedWeightPostingSource * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::weight","next", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::weight >(val2);
  {
    try {
      (arg1)->next(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_FixedWeightPostingSource_skip_to(int argc, VALUE *argv, VALUE self) {
  Xapian::FixedWeightPostingSource *arg1 = (Xapian::FixedWeightPostingSource *) 0 ;
  Xapian::docid arg2 ;
  Xapian::weight arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__FixedWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::FixedWeightPostingSource *","skip_to", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::FixedWeightPostingSource * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","skip_to", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::weight","skip_to", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::weight >(val3);
  {
    try {
      (arg1)->skip_to(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_FixedWeightPostingSource_check(int argc, VALUE *argv, VALUE self) {
  Xapian::FixedWeightPostingSource *arg1 = (Xapian::FixedWeightPostingSource *) 0 ;
  Xapian::docid arg2 ;
  Xapian::weight arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__FixedWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::FixedWeightPostingSource *","check", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::FixedWeightPostingSource * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","check", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::weight","check", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::weight >(val3);
  {
    try {
      result = (bool)(arg1)->check(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_FixedWeightPostingSource_at_end(int argc, VALUE *argv, VALUE self) {
  Xapian::FixedWeightPostingSource *arg1 = (Xapian::FixedWeightPostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__FixedWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::FixedWeightPostingSource const *","at_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::FixedWeightPostingSource * >(argp1);
  {
    try {
      result = (bool)((Xapian::FixedWeightPostingSource const *)arg1)->at_end();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_FixedWeightPostingSource_docid(int argc, VALUE *argv, VALUE self) {
  Xapian::FixedWeightPostingSource *arg1 = (Xapian::FixedWeightPostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::docid result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__FixedWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::FixedWeightPostingSource const *","get_docid", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::FixedWeightPostingSource * >(argp1);
  {
    try {
      result = (Xapian::docid)((Xapian::FixedWeightPostingSource const *)arg1)->get_docid();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_FixedWeightPostingSource_name(int argc, VALUE *argv, VALUE self) {
  Xapian::FixedWeightPostingSource *arg1 = (Xapian::FixedWeightPostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__FixedWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::FixedWeightPostingSource const *","name", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::FixedWeightPostingSource * >(argp1);
  {
    try {
      result = ((Xapian::FixedWeightPostingSource const *)arg1)->name();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_FixedWeightPostingSource_init(int argc, VALUE *argv, VALUE self) {
  Xapian::FixedWeightPostingSource *arg1 = (Xapian::FixedWeightPostingSource *) 0 ;
  Xapian::Database *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__FixedWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::FixedWeightPostingSource *","init", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::FixedWeightPostingSource * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Database,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Database const &","init", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Database const &","init", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Database * >(argp2);
  {
    try {
      (arg1)->init((Xapian::Database const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_FixedWeightPostingSource_description(int argc, VALUE *argv, VALUE self) {
  Xapian::FixedWeightPostingSource *arg1 = (Xapian::FixedWeightPostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__FixedWeightPostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::FixedWeightPostingSource const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::FixedWeightPostingSource * >(argp1);
  {
    try {
      result = ((Xapian::FixedWeightPostingSource const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_FixedWeightPostingSource(Xapian::FixedWeightPostingSource *arg1) {
    delete arg1;
}

swig_class SwigClassMSet;

SWIGINTERN VALUE
_wrap_new_MSet__SWIG_0(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::MSet";
  Xapian::MSet *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::MSet *)new Xapian::MSet();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_MSet_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_MSet_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__MSet);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_MSet__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = 0 ;
  void *argp1 ;
  int res1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::MSet";
  Xapian::MSet *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_Xapian__MSet,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const &","Xapian::MSet", 1, argv[0] )); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::MSet const &","Xapian::MSet", 1, argv[0])); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  {
    try {
      result = (Xapian::MSet *)new Xapian::MSet((Xapian::MSet const &)*arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_MSet(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[1];
  int ii;
  
  argc = nargs;
  if (argc > 1) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 0) {
    return _wrap_new_MSet__SWIG_0(nargs, args, self);
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__MSet, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_new_MSet__SWIG_1(nargs, args, self);
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 1, "MSet.new", 
    "    MSet.new()\n"
    "    MSet.new(Xapian::MSet const &other)\n");
  
  return Qnil;
}


SWIGINTERN void
free_Xapian_MSet(Xapian::MSet *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_MSet_fetch__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  Xapian::MSetIterator *arg2 = 0 ;
  Xapian::MSetIterator *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","fetch", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__MSetIterator,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::MSetIterator &","fetch", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::MSetIterator &","fetch", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::MSetIterator * >(argp2);
  res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_Xapian__MSetIterator,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "Xapian::MSetIterator &","fetch", 3, argv[1] )); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::MSetIterator &","fetch", 3, argv[1])); 
  }
  arg3 = reinterpret_cast< Xapian::MSetIterator * >(argp3);
  {
    try {
      ((Xapian::MSet const *)arg1)->fetch(*arg2,*arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSet_fetch__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  Xapian::MSetIterator *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","fetch", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__MSetIterator,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::MSetIterator &","fetch", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::MSetIterator &","fetch", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::MSetIterator * >(argp2);
  {
    try {
      ((Xapian::MSet const *)arg1)->fetch(*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSet_fetch__SWIG_2(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","fetch", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  {
    try {
      ((Xapian::MSet const *)arg1)->fetch();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_MSet_fetch(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[4];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 4) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__MSet, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_MSet_fetch__SWIG_2(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__MSet, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Xapian__MSetIterator, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_MSet_fetch__SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__MSet, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Xapian__MSetIterator, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_Xapian__MSetIterator, 0);
        _v = SWIG_CheckState(res);
        if (_v) {
          return _wrap_MSet_fetch__SWIG_0(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 4, "MSet.fetch", 
    "    void MSet.fetch(Xapian::MSetIterator &begin, Xapian::MSetIterator &end)\n"
    "    void MSet.fetch(Xapian::MSetIterator &item)\n"
    "    void MSet.fetch()\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSet_convert_to_percent__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  Xapian::weight arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  Xapian::percent result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","convert_to_percent", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::weight","convert_to_percent", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::weight >(val2);
  {
    try {
      result = (Xapian::percent)((Xapian::MSet const *)arg1)->convert_to_percent(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSet_convert_to_percent__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  Xapian::MSetIterator *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  Xapian::percent result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","convert_to_percent", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__MSetIterator,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::MSetIterator const &","convert_to_percent", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::MSetIterator const &","convert_to_percent", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::MSetIterator * >(argp2);
  {
    try {
      result = (Xapian::percent)((Xapian::MSet const *)arg1)->convert_to_percent((Xapian::MSetIterator const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_MSet_convert_to_percent(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__MSet, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Xapian__MSetIterator, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_MSet_convert_to_percent__SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__MSet, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_double(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_MSet_convert_to_percent__SWIG_0(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "MSet.convert_to_percent", 
    "    Xapian::percent MSet.convert_to_percent(Xapian::weight wt)\n"
    "    Xapian::percent MSet.convert_to_percent(Xapian::MSetIterator const &item)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSet_termfreq(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  std::string arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","get_termfreq", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    int res = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res) || !ptr) {
      SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), Ruby_Format_TypeError( "", "std::string","get_termfreq", 2, argv[0] )); 
    }
    arg2 = *ptr;
    if (SWIG_IsNewObj(res)) delete ptr;
  }
  {
    try {
      result = (Xapian::doccount)((Xapian::MSet const *)arg1)->get_termfreq(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSet_termweight(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  std::string arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","get_termweight", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    int res = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res) || !ptr) {
      SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), Ruby_Format_TypeError( "", "std::string","get_termweight", 2, argv[0] )); 
    }
    arg2 = *ptr;
    if (SWIG_IsNewObj(res)) delete ptr;
  }
  {
    try {
      result = (Xapian::weight)((Xapian::MSet const *)arg1)->get_termweight(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSet_firstitem(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","get_firstitem", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  {
    try {
      result = (Xapian::doccount)((Xapian::MSet const *)arg1)->get_firstitem();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSet_matches_lower_bound(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","get_matches_lower_bound", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  {
    try {
      result = (Xapian::doccount)((Xapian::MSet const *)arg1)->get_matches_lower_bound();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSet_matches_estimated(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","get_matches_estimated", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  {
    try {
      result = (Xapian::doccount)((Xapian::MSet const *)arg1)->get_matches_estimated();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSet_matches_upper_bound(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","get_matches_upper_bound", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  {
    try {
      result = (Xapian::doccount)((Xapian::MSet const *)arg1)->get_matches_upper_bound();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSet_get_uncollapsed_matches_lower_bound(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","get_uncollapsed_matches_lower_bound", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  {
    try {
      result = (Xapian::doccount)((Xapian::MSet const *)arg1)->get_uncollapsed_matches_lower_bound();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSet_get_uncollapsed_matches_estimated(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","get_uncollapsed_matches_estimated", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  {
    try {
      result = (Xapian::doccount)((Xapian::MSet const *)arg1)->get_uncollapsed_matches_estimated();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSet_get_uncollapsed_matches_upper_bound(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","get_uncollapsed_matches_upper_bound", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  {
    try {
      result = (Xapian::doccount)((Xapian::MSet const *)arg1)->get_uncollapsed_matches_upper_bound();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSet_max_possible(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet *","get_max_possible", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  {
    try {
      result = (Xapian::weight)(arg1)->get_max_possible();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSet_max_attained(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet *","get_max_attained", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  {
    try {
      result = (Xapian::weight)(arg1)->get_max_attained();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::MSet.size

  call-seq:
    size -> Xapian::doccount

Size or Length of the MSet.
*/
SWIGINTERN VALUE
_wrap_MSet_size(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","size", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  {
    try {
      result = (Xapian::doccount)((Xapian::MSet const *)arg1)->size();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::MSet.empty

  call-seq:
    empty -> bool

Check if the MSet is empty or not.
*/
SWIGINTERN VALUE
_wrap_MSet_emptyq___(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","empty", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  {
    try {
      result = (bool)((Xapian::MSet const *)arg1)->empty();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = (result ? Qtrue : Qfalse);
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::MSet._begin

  call-seq:
    _begin -> MSetIterator

Return an iterator to the beginning of the MSet.
*/
SWIGINTERN VALUE
_wrap_MSet__begin(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::MSetIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  {
    try {
      result = ((Xapian::MSet const *)arg1)->begin();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::MSetIterator(static_cast< const Xapian::MSetIterator& >(result))), SWIGTYPE_p_Xapian__MSetIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::MSet._end

  call-seq:
    _end -> MSetIterator

Return an iterator to past the end of the MSet.
*/
SWIGINTERN VALUE
_wrap_MSet__end(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::MSetIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  {
    try {
      result = ((Xapian::MSet const *)arg1)->end();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::MSetIterator(static_cast< const Xapian::MSetIterator& >(result))), SWIGTYPE_p_Xapian__MSetIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::MSet._back

  call-seq:
    _back -> MSetIterator

Return the last element in MSet.
*/
SWIGINTERN VALUE
_wrap_MSet__back(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::MSetIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","back", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  {
    try {
      result = ((Xapian::MSet const *)arg1)->back();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::MSetIterator(static_cast< const Xapian::MSetIterator& >(result))), SWIGTYPE_p_Xapian__MSetIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSet_hit(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  Xapian::doccount arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  Xapian::MSetIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","get_hit", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::doccount","get_hit", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::doccount >(val2);
  {
    try {
      result = Xapian_MSet_get_hit((Xapian::MSet const *)arg1,arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::MSetIterator(static_cast< const Xapian::MSetIterator& >(result))), SWIGTYPE_p_Xapian__MSetIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSet_document_percentage(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  Xapian::doccount arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  int result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","get_document_percentage", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::doccount","get_document_percentage", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::doccount >(val2);
  {
    try {
      result = (int)Xapian_MSet_get_document_percentage((Xapian::MSet const *)arg1,arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSet_document(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  Xapian::doccount arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  Xapian::Document result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","get_document", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::doccount","get_document", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::doccount >(val2);
  {
    try {
      result = Xapian_MSet_get_document((Xapian::MSet const *)arg1,arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::Document(static_cast< const Xapian::Document& >(result))), SWIGTYPE_p_Xapian__Document, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSet_docid(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  Xapian::doccount arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  Xapian::docid result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","get_docid", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::doccount","get_docid", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::doccount >(val2);
  {
    try {
      result = (Xapian::docid)Xapian_MSet_get_docid((Xapian::MSet const *)arg1,arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSet_description(int argc, VALUE *argv, VALUE self) {
  Xapian::MSet *arg1 = (Xapian::MSet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSet const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSet * >(argp1);
  {
    try {
      result = ((Xapian::MSet const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


swig_class SwigClassMSetIterator;

SWIGINTERN VALUE
_wrap_new_MSetIterator__SWIG_0(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::MSetIterator";
  Xapian::MSetIterator *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::MSetIterator *)new Xapian::MSetIterator();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_MSetIterator_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_MSetIterator_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__MSetIterator);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_MSetIterator__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::MSetIterator *arg1 = 0 ;
  void *argp1 ;
  int res1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::MSetIterator";
  Xapian::MSetIterator *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_Xapian__MSetIterator,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSetIterator const &","Xapian::MSetIterator", 1, argv[0] )); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::MSetIterator const &","Xapian::MSetIterator", 1, argv[0])); 
  }
  arg1 = reinterpret_cast< Xapian::MSetIterator * >(argp1);
  {
    try {
      result = (Xapian::MSetIterator *)new Xapian::MSetIterator((Xapian::MSetIterator const &)*arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_MSetIterator(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[1];
  int ii;
  
  argc = nargs;
  if (argc > 1) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 0) {
    return _wrap_new_MSetIterator__SWIG_0(nargs, args, self);
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__MSetIterator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_new_MSetIterator__SWIG_1(nargs, args, self);
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 1, "MSetIterator.new", 
    "    MSetIterator.new()\n"
    "    MSetIterator.new(Xapian::MSetIterator const &other)\n");
  
  return Qnil;
}


SWIGINTERN void
free_Xapian_MSetIterator(Xapian::MSetIterator *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_MSetIterator_docid(int argc, VALUE *argv, VALUE self) {
  Xapian::MSetIterator *arg1 = (Xapian::MSetIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::docid result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSetIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSetIterator const *","get_docid", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSetIterator * >(argp1);
  {
    try {
      result = (Xapian::docid)Xapian_MSetIterator_get_docid((Xapian::MSetIterator const *)arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSetIterator_next(int argc, VALUE *argv, VALUE self) {
  Xapian::MSetIterator *arg1 = (Xapian::MSetIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSetIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSetIterator *","next", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSetIterator * >(argp1);
  {
    try {
      Xapian_MSetIterator_next(arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSetIterator_prev(int argc, VALUE *argv, VALUE self) {
  Xapian::MSetIterator *arg1 = (Xapian::MSetIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSetIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSetIterator *","prev", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSetIterator * >(argp1);
  {
    try {
      Xapian_MSetIterator_prev(arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSetIterator_equals(int argc, VALUE *argv, VALUE self) {
  Xapian::MSetIterator *arg1 = (Xapian::MSetIterator *) 0 ;
  Xapian::MSetIterator *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSetIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSetIterator const *","equals", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSetIterator * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__MSetIterator,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::MSetIterator const &","equals", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::MSetIterator const &","equals", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::MSetIterator * >(argp2);
  {
    try {
      result = (bool)Xapian_MSetIterator_equals((Xapian::MSetIterator const *)arg1,(Xapian::MSetIterator const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSetIterator_document(int argc, VALUE *argv, VALUE self) {
  Xapian::MSetIterator *arg1 = (Xapian::MSetIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::Document result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSetIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSetIterator const *","get_document", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSetIterator * >(argp1);
  {
    try {
      result = ((Xapian::MSetIterator const *)arg1)->get_document();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::Document(static_cast< const Xapian::Document& >(result))), SWIGTYPE_p_Xapian__Document, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSetIterator_rank(int argc, VALUE *argv, VALUE self) {
  Xapian::MSetIterator *arg1 = (Xapian::MSetIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSetIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSetIterator const *","get_rank", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSetIterator * >(argp1);
  {
    try {
      result = (Xapian::doccount)((Xapian::MSetIterator const *)arg1)->get_rank();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSetIterator_weight(int argc, VALUE *argv, VALUE self) {
  Xapian::MSetIterator *arg1 = (Xapian::MSetIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSetIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSetIterator const *","get_weight", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSetIterator * >(argp1);
  {
    try {
      result = (Xapian::weight)((Xapian::MSetIterator const *)arg1)->get_weight();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSetIterator_get_collapse_key(int argc, VALUE *argv, VALUE self) {
  Xapian::MSetIterator *arg1 = (Xapian::MSetIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSetIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSetIterator const *","get_collapse_key", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSetIterator * >(argp1);
  {
    try {
      result = ((Xapian::MSetIterator const *)arg1)->get_collapse_key();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSetIterator_collapse_count(int argc, VALUE *argv, VALUE self) {
  Xapian::MSetIterator *arg1 = (Xapian::MSetIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSetIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSetIterator const *","get_collapse_count", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSetIterator * >(argp1);
  {
    try {
      result = (Xapian::doccount)((Xapian::MSetIterator const *)arg1)->get_collapse_count();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSetIterator_percent(int argc, VALUE *argv, VALUE self) {
  Xapian::MSetIterator *arg1 = (Xapian::MSetIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::percent result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSetIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSetIterator const *","get_percent", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSetIterator * >(argp1);
  {
    try {
      result = (Xapian::percent)((Xapian::MSetIterator const *)arg1)->get_percent();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MSetIterator_description(int argc, VALUE *argv, VALUE self) {
  Xapian::MSetIterator *arg1 = (Xapian::MSetIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MSetIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MSetIterator const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MSetIterator * >(argp1);
  {
    try {
      result = ((Xapian::MSetIterator const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


swig_class SwigClassESet;

SWIGINTERN VALUE
_wrap_new_ESet__SWIG_0(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::ESet";
  Xapian::ESet *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::ESet *)new Xapian::ESet();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_ESet_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_ESet_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__ESet);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_ESet__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::ESet *arg1 = 0 ;
  void *argp1 ;
  int res1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::ESet";
  Xapian::ESet *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_Xapian__ESet,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ESet const &","Xapian::ESet", 1, argv[0] )); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::ESet const &","Xapian::ESet", 1, argv[0])); 
  }
  arg1 = reinterpret_cast< Xapian::ESet * >(argp1);
  {
    try {
      result = (Xapian::ESet *)new Xapian::ESet((Xapian::ESet const &)*arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_ESet(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[1];
  int ii;
  
  argc = nargs;
  if (argc > 1) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 0) {
    return _wrap_new_ESet__SWIG_0(nargs, args, self);
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__ESet, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_new_ESet__SWIG_1(nargs, args, self);
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 1, "ESet.new", 
    "    ESet.new()\n"
    "    ESet.new(Xapian::ESet const &other)\n");
  
  return Qnil;
}


SWIGINTERN void
free_Xapian_ESet(Xapian::ESet *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_ESet_ebound(int argc, VALUE *argv, VALUE self) {
  Xapian::ESet *arg1 = (Xapian::ESet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::termcount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ESet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ESet const *","get_ebound", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ESet * >(argp1);
  {
    try {
      result = (Xapian::termcount)((Xapian::ESet const *)arg1)->get_ebound();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::ESet.size

  call-seq:
    size -> Xapian::termcount

Size or Length of the ESet.
*/
SWIGINTERN VALUE
_wrap_ESet_size(int argc, VALUE *argv, VALUE self) {
  Xapian::ESet *arg1 = (Xapian::ESet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::termcount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ESet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ESet const *","size", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ESet * >(argp1);
  {
    try {
      result = (Xapian::termcount)((Xapian::ESet const *)arg1)->size();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::ESet.empty

  call-seq:
    empty -> bool

Check if the ESet is empty or not.
*/
SWIGINTERN VALUE
_wrap_ESet_emptyq___(int argc, VALUE *argv, VALUE self) {
  Xapian::ESet *arg1 = (Xapian::ESet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ESet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ESet const *","empty", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ESet * >(argp1);
  {
    try {
      result = (bool)((Xapian::ESet const *)arg1)->empty();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = (result ? Qtrue : Qfalse);
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::ESet._begin

  call-seq:
    _begin -> ESetIterator

Return an iterator to the beginning of the ESet.
*/
SWIGINTERN VALUE
_wrap_ESet__begin(int argc, VALUE *argv, VALUE self) {
  Xapian::ESet *arg1 = (Xapian::ESet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::ESetIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ESet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ESet const *","begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ESet * >(argp1);
  {
    try {
      result = ((Xapian::ESet const *)arg1)->begin();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::ESetIterator(static_cast< const Xapian::ESetIterator& >(result))), SWIGTYPE_p_Xapian__ESetIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::ESet._end

  call-seq:
    _end -> ESetIterator

Return an iterator to past the end of the ESet.
*/
SWIGINTERN VALUE
_wrap_ESet__end(int argc, VALUE *argv, VALUE self) {
  Xapian::ESet *arg1 = (Xapian::ESet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::ESetIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ESet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ESet const *","end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ESet * >(argp1);
  {
    try {
      result = ((Xapian::ESet const *)arg1)->end();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::ESetIterator(static_cast< const Xapian::ESetIterator& >(result))), SWIGTYPE_p_Xapian__ESetIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::ESet._back

  call-seq:
    _back -> ESetIterator

Return the last element in ESet.
*/
SWIGINTERN VALUE
_wrap_ESet__back(int argc, VALUE *argv, VALUE self) {
  Xapian::ESet *arg1 = (Xapian::ESet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::ESetIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ESet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ESet const *","back", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ESet * >(argp1);
  {
    try {
      result = ((Xapian::ESet const *)arg1)->back();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::ESetIterator(static_cast< const Xapian::ESetIterator& >(result))), SWIGTYPE_p_Xapian__ESetIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ESet_description(int argc, VALUE *argv, VALUE self) {
  Xapian::ESet *arg1 = (Xapian::ESet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ESet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ESet const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ESet * >(argp1);
  {
    try {
      result = ((Xapian::ESet const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


swig_class SwigClassESetIterator;

SWIGINTERN VALUE
_wrap_new_ESetIterator__SWIG_0(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::ESetIterator";
  Xapian::ESetIterator *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::ESetIterator *)new Xapian::ESetIterator();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_ESetIterator_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_ESetIterator_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__ESetIterator);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_ESetIterator__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::ESetIterator *arg1 = 0 ;
  void *argp1 ;
  int res1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::ESetIterator";
  Xapian::ESetIterator *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_Xapian__ESetIterator,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ESetIterator const &","Xapian::ESetIterator", 1, argv[0] )); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::ESetIterator const &","Xapian::ESetIterator", 1, argv[0])); 
  }
  arg1 = reinterpret_cast< Xapian::ESetIterator * >(argp1);
  {
    try {
      result = (Xapian::ESetIterator *)new Xapian::ESetIterator((Xapian::ESetIterator const &)*arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_ESetIterator(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[1];
  int ii;
  
  argc = nargs;
  if (argc > 1) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 0) {
    return _wrap_new_ESetIterator__SWIG_0(nargs, args, self);
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__ESetIterator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_new_ESetIterator__SWIG_1(nargs, args, self);
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 1, "ESetIterator.new", 
    "    ESetIterator.new()\n"
    "    ESetIterator.new(Xapian::ESetIterator const &other)\n");
  
  return Qnil;
}


SWIGINTERN void
free_Xapian_ESetIterator(Xapian::ESetIterator *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_ESetIterator_term(int argc, VALUE *argv, VALUE self) {
  Xapian::ESetIterator *arg1 = (Xapian::ESetIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ESetIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ESetIterator const *","get_term", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ESetIterator * >(argp1);
  {
    try {
      result = Xapian_ESetIterator_get_term((Xapian::ESetIterator const *)arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ESetIterator_next(int argc, VALUE *argv, VALUE self) {
  Xapian::ESetIterator *arg1 = (Xapian::ESetIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ESetIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ESetIterator *","next", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ESetIterator * >(argp1);
  {
    try {
      Xapian_ESetIterator_next(arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ESetIterator_prev(int argc, VALUE *argv, VALUE self) {
  Xapian::ESetIterator *arg1 = (Xapian::ESetIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ESetIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ESetIterator *","prev", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ESetIterator * >(argp1);
  {
    try {
      Xapian_ESetIterator_prev(arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ESetIterator_equals(int argc, VALUE *argv, VALUE self) {
  Xapian::ESetIterator *arg1 = (Xapian::ESetIterator *) 0 ;
  Xapian::ESetIterator *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ESetIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ESetIterator const *","equals", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ESetIterator * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__ESetIterator,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::ESetIterator const &","equals", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::ESetIterator const &","equals", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::ESetIterator * >(argp2);
  {
    try {
      result = (bool)Xapian_ESetIterator_equals((Xapian::ESetIterator const *)arg1,(Xapian::ESetIterator const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ESetIterator_weight(int argc, VALUE *argv, VALUE self) {
  Xapian::ESetIterator *arg1 = (Xapian::ESetIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ESetIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ESetIterator const *","get_weight", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ESetIterator * >(argp1);
  {
    try {
      result = (Xapian::weight)((Xapian::ESetIterator const *)arg1)->get_weight();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ESetIterator_description(int argc, VALUE *argv, VALUE self) {
  Xapian::ESetIterator *arg1 = (Xapian::ESetIterator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ESetIterator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ESetIterator const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ESetIterator * >(argp1);
  {
    try {
      result = ((Xapian::ESetIterator const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


swig_class SwigClassRSet;

SWIGINTERN VALUE
_wrap_new_RSet__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::RSet *arg1 = 0 ;
  void *argp1 ;
  int res1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::RSet";
  Xapian::RSet *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_Xapian__RSet,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::RSet const &","Xapian::RSet", 1, argv[0] )); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::RSet const &","Xapian::RSet", 1, argv[0])); 
  }
  arg1 = reinterpret_cast< Xapian::RSet * >(argp1);
  {
    try {
      result = (Xapian::RSet *)new Xapian::RSet((Xapian::RSet const &)*arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_RSet_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_RSet_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__RSet);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_RSet__SWIG_1(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::RSet";
  Xapian::RSet *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::RSet *)new Xapian::RSet();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_RSet(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[1];
  int ii;
  
  argc = nargs;
  if (argc > 1) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 0) {
    return _wrap_new_RSet__SWIG_1(nargs, args, self);
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__RSet, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_new_RSet__SWIG_0(nargs, args, self);
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 1, "RSet.new", 
    "    RSet.new(Xapian::RSet const &other)\n"
    "    RSet.new()\n");
  
  return Qnil;
}


SWIGINTERN void
free_Xapian_RSet(Xapian::RSet *arg1) {
    delete arg1;
}


/*
  Document-method: Xapian::RSet.size

  call-seq:
    size -> Xapian::doccount

Size or Length of the RSet.
*/
SWIGINTERN VALUE
_wrap_RSet_size(int argc, VALUE *argv, VALUE self) {
  Xapian::RSet *arg1 = (Xapian::RSet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__RSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::RSet const *","size", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::RSet * >(argp1);
  {
    try {
      result = (Xapian::doccount)((Xapian::RSet const *)arg1)->size();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::RSet.empty

  call-seq:
    empty -> bool

Check if the RSet is empty or not.
*/
SWIGINTERN VALUE
_wrap_RSet_emptyq___(int argc, VALUE *argv, VALUE self) {
  Xapian::RSet *arg1 = (Xapian::RSet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__RSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::RSet const *","empty", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::RSet * >(argp1);
  {
    try {
      result = (bool)((Xapian::RSet const *)arg1)->empty();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = (result ? Qtrue : Qfalse);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RSet_add_document__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::RSet *arg1 = (Xapian::RSet *) 0 ;
  Xapian::docid arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__RSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::RSet *","add_document", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::RSet * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","add_document", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  {
    try {
      (arg1)->add_document(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RSet_add_document__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::RSet *arg1 = (Xapian::RSet *) 0 ;
  Xapian::MSetIterator *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__RSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::RSet *","add_document", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::RSet * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__MSetIterator,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::MSetIterator &","add_document", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::MSetIterator &","add_document", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::MSetIterator * >(argp2);
  {
    try {
      (arg1)->add_document(*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_RSet_add_document(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__RSet, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Xapian__MSetIterator, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_RSet_add_document__SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__RSet, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_RSet_add_document__SWIG_0(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "RSet.add_document", 
    "    void RSet.add_document(Xapian::docid did)\n"
    "    void RSet.add_document(Xapian::MSetIterator &i)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RSet_remove_document__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::RSet *arg1 = (Xapian::RSet *) 0 ;
  Xapian::docid arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__RSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::RSet *","remove_document", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::RSet * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","remove_document", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  {
    try {
      (arg1)->remove_document(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RSet_remove_document__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::RSet *arg1 = (Xapian::RSet *) 0 ;
  Xapian::MSetIterator *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__RSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::RSet *","remove_document", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::RSet * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__MSetIterator,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::MSetIterator &","remove_document", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::MSetIterator &","remove_document", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::MSetIterator * >(argp2);
  {
    try {
      (arg1)->remove_document(*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_RSet_remove_document(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__RSet, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Xapian__MSetIterator, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_RSet_remove_document__SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__RSet, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_RSet_remove_document__SWIG_0(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "RSet.remove_document", 
    "    void RSet.remove_document(Xapian::docid did)\n"
    "    void RSet.remove_document(Xapian::MSetIterator &i)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RSet_contains__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::RSet *arg1 = (Xapian::RSet *) 0 ;
  Xapian::docid arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__RSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::RSet *","contains", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::RSet * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","contains", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  {
    try {
      result = (bool)(arg1)->contains(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RSet_contains__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::RSet *arg1 = (Xapian::RSet *) 0 ;
  Xapian::MSetIterator *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__RSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::RSet *","contains", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::RSet * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__MSetIterator,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::MSetIterator &","contains", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::MSetIterator &","contains", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::MSetIterator * >(argp2);
  {
    try {
      result = (bool)(arg1)->contains(*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_RSet_contains(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__RSet, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Xapian__MSetIterator, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_RSet_contains__SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__RSet, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_RSet_contains__SWIG_0(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "RSet.contains", 
    "    bool RSet.contains(Xapian::docid did)\n"
    "    bool RSet.contains(Xapian::MSetIterator &i)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_RSet_description(int argc, VALUE *argv, VALUE self) {
  Xapian::RSet *arg1 = (Xapian::RSet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__RSet, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::RSet const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::RSet * >(argp1);
  {
    try {
      result = ((Xapian::RSet const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


swig_class SwigClassMatchDecider;

SWIGINTERN VALUE
_wrap_MatchDecider___call__(int argc, VALUE *argv, VALUE self) {
  Xapian::MatchDecider *arg1 = (Xapian::MatchDecider *) 0 ;
  Xapian::Document *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  Swig::Director *director = 0;
  bool upcall = false;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MatchDecider, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MatchDecider const *","operator ()", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MatchDecider * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Document,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Document const &","operator ()", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Document const &","operator ()", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Document * >(argp2);
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          Swig::DirectorPureVirtualException::raise("Xapian::MatchDecider::operator ()");
        } else {
          result = (bool)((Xapian::MatchDecider const *)arg1)->operator ()((Xapian::Document const &)*arg2);
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_MatchDecider(Xapian::MatchDecider *arg1) {
    delete arg1;
}

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_MatchDecider_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_MatchDecider_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__MatchDecider);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_MatchDecider(int argc, VALUE *argv, VALUE self) {
  VALUE arg1 = (VALUE) 0 ;
  const char *classname SWIGUNUSED = "Xapian::MatchDecider";
  Xapian::MatchDecider *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  arg1 = self;
  {
    try {
      if ( strcmp(rb_obj_classname(self), classname) != 0 ) {
        /* subclassed */
        result = (Xapian::MatchDecider *)new SwigDirector_MatchDecider(arg1); 
      } else {
        rb_raise(rb_eNameError,"accessing abstract class or protected constructor"); 
        return Qnil;
      }
      
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_disown_MatchDecider(int argc, VALUE *argv, VALUE self) {
  Xapian::MatchDecider *arg1 = (Xapian::MatchDecider *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_Xapian__MatchDecider, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MatchDecider *","disown_MatchDecider", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< Xapian::MatchDecider * >(argp1);
  {
    Swig::Director *director = SWIG_DIRECTOR_CAST(arg1);
    if (director) director->swig_disown();
  }
  
  return Qnil;
fail:
  return Qnil;
}


swig_class SwigClassExpandDecider;

SWIGINTERN VALUE
_wrap_ExpandDecider___call__(int argc, VALUE *argv, VALUE self) {
  Xapian::ExpandDecider *arg1 = (Xapian::ExpandDecider *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Swig::Director *director = 0;
  bool upcall = false;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ExpandDecider, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ExpandDecider const *","operator ()", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ExpandDecider * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","operator ()", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","operator ()", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          Swig::DirectorPureVirtualException::raise("Xapian::ExpandDecider::operator ()");
        } else {
          result = (bool)((Xapian::ExpandDecider const *)arg1)->operator ()((std::string const &)*arg2);
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN void
free_Xapian_ExpandDecider(Xapian::ExpandDecider *arg1) {
    delete arg1;
}

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_ExpandDecider_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_ExpandDecider_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__ExpandDecider);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_ExpandDecider(int argc, VALUE *argv, VALUE self) {
  VALUE arg1 = (VALUE) 0 ;
  const char *classname SWIGUNUSED = "Xapian::ExpandDecider";
  Xapian::ExpandDecider *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  arg1 = self;
  {
    try {
      if ( strcmp(rb_obj_classname(self), classname) != 0 ) {
        /* subclassed */
        result = (Xapian::ExpandDecider *)new SwigDirector_ExpandDecider(arg1); 
      } else {
        rb_raise(rb_eNameError,"accessing abstract class or protected constructor"); 
        return Qnil;
      }
      
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_disown_ExpandDecider(int argc, VALUE *argv, VALUE self) {
  Xapian::ExpandDecider *arg1 = (Xapian::ExpandDecider *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_Xapian__ExpandDecider, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ExpandDecider *","disown_ExpandDecider", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< Xapian::ExpandDecider * >(argp1);
  {
    Swig::Director *director = SWIG_DIRECTOR_CAST(arg1);
    if (director) director->swig_disown();
  }
  
  return Qnil;
fail:
  return Qnil;
}


swig_class SwigClassEnquire;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_Enquire_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_Enquire_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__Enquire);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_Enquire(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = 0 ;
  void *argp1 ;
  int res1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::Enquire";
  Xapian::Enquire *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_Xapian__Database,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const &","Xapian::Enquire", 1, argv[0] )); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Database const &","Xapian::Enquire", 1, argv[0])); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    try {
      result = (Xapian::Enquire *)new Xapian::Enquire((Xapian::Database const &)*arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_Enquire(Xapian::Enquire *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_Enquire_queryN___(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::Query *arg2 = 0 ;
  Xapian::termcount arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","set_query", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Query,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Query const &","set_query", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Query const &","set_query", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Query * >(argp2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::termcount","set_query", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::termcount >(val3);
  {
    try {
      (arg1)->set_query((Xapian::Query const &)*arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_querye___(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::Query *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","set_query", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Query,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Query const &","set_query", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Query const &","set_query", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Query * >(argp2);
  {
    try {
      (arg1)->set_query((Xapian::Query const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_query(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::Query *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","get_query", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  {
    try {
      result = (Xapian::Query *) &(arg1)->get_query();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Xapian__Query, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_add_matchspy(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::MatchSpy *arg2 = (Xapian::MatchSpy *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","add_matchspy", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_Xapian__MatchSpy, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::MatchSpy *","add_matchspy", 2, argv[0] )); 
  }
  arg2 = reinterpret_cast< Xapian::MatchSpy * >(argp2);
  {
    try {
      (arg1)->add_matchspy(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_clear_matchspies(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","clear_matchspies", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  {
    try {
      (arg1)->clear_matchspies();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_weighting_schemee___(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::Weight *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","set_weighting_scheme", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Weight,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Weight const &","set_weighting_scheme", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Weight const &","set_weighting_scheme", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Weight * >(argp2);
  {
    try {
      (arg1)->set_weighting_scheme((Xapian::Weight const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_collapse_keye_____SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::valueno arg2 ;
  Xapian::doccount arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","set_collapse_key", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","set_collapse_key", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::doccount","set_collapse_key", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::doccount >(val3);
  {
    try {
      (arg1)->set_collapse_key(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_collapse_keye_____SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::valueno arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","set_collapse_key", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","set_collapse_key", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  {
    try {
      (arg1)->set_collapse_key(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_Enquire_collapse_keye___(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[4];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 4) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_Enquire_collapse_keye_____SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_Enquire_collapse_keye_____SWIG_0(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 4, "Enquire.collapse_key=", 
    "    void Enquire.collapse_key=(Xapian::valueno collapse_key, Xapian::doccount collapse_max)\n"
    "    void Enquire.collapse_key=(Xapian::valueno collapse_key)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_docid_ordere___(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::Enquire::docid_order arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","set_docid_order", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::Enquire::docid_order","set_docid_order", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::Enquire::docid_order >(val2);
  {
    try {
      (arg1)->set_docid_order(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_cutoffN_____SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  int arg2 ;
  Xapian::weight arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","set_cutoff", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","set_cutoff", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::weight","set_cutoff", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::weight >(val3);
  {
    try {
      (arg1)->set_cutoff(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_cutoffN_____SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","set_cutoff", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","set_cutoff", 2, argv[0] ));
  } 
  arg2 = static_cast< int >(val2);
  {
    try {
      (arg1)->set_cutoff(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_Enquire_cutoffN___(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[4];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 4) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_Enquire_cutoffN_____SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_double(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_Enquire_cutoffN_____SWIG_0(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 4, "Enquire.cutoff!", 
    "    void Enquire.cutoff!(int percent_cutoff, Xapian::weight weight_cutoff)\n"
    "    void Enquire.cutoff!(int percent_cutoff)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_sort_by_relevanceN___(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","set_sort_by_relevance", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  {
    try {
      (arg1)->set_sort_by_relevance();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_sort_by_valueN_____SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::valueno arg2 ;
  bool arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","set_sort_by_value", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","set_sort_by_value", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  ecode3 = SWIG_AsVal_bool(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","set_sort_by_value", 3, argv[1] ));
  } 
  arg3 = static_cast< bool >(val3);
  {
    try {
      (arg1)->set_sort_by_value(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_sort_by_valueN_____SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::valueno arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","set_sort_by_value", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","set_sort_by_value", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  {
    try {
      (arg1)->set_sort_by_value(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_Enquire_sort_by_valueN___(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[4];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 4) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_Enquire_sort_by_valueN_____SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_bool(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_Enquire_sort_by_valueN_____SWIG_0(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 4, "Enquire.sort_by_value!", 
    "    void Enquire.sort_by_value!(Xapian::valueno sort_key, bool reverse)\n"
    "    void Enquire.sort_by_value!(Xapian::valueno sort_key)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_sort_by_value_then_relevanceN_____SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::valueno arg2 ;
  bool arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","set_sort_by_value_then_relevance", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","set_sort_by_value_then_relevance", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  ecode3 = SWIG_AsVal_bool(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","set_sort_by_value_then_relevance", 3, argv[1] ));
  } 
  arg3 = static_cast< bool >(val3);
  {
    try {
      (arg1)->set_sort_by_value_then_relevance(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_sort_by_value_then_relevanceN_____SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::valueno arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","set_sort_by_value_then_relevance", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","set_sort_by_value_then_relevance", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  {
    try {
      (arg1)->set_sort_by_value_then_relevance(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_Enquire_sort_by_value_then_relevanceN___(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[4];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 4) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_Enquire_sort_by_value_then_relevanceN_____SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_bool(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_Enquire_sort_by_value_then_relevanceN_____SWIG_0(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 4, "Enquire.sort_by_value_then_relevance!", 
    "    void Enquire.sort_by_value_then_relevance!(Xapian::valueno sort_key, bool reverse)\n"
    "    void Enquire.sort_by_value_then_relevance!(Xapian::valueno sort_key)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_sort_by_relevance_then_valueN_____SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::valueno arg2 ;
  bool arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","set_sort_by_relevance_then_value", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","set_sort_by_relevance_then_value", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  ecode3 = SWIG_AsVal_bool(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","set_sort_by_relevance_then_value", 3, argv[1] ));
  } 
  arg3 = static_cast< bool >(val3);
  {
    try {
      (arg1)->set_sort_by_relevance_then_value(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_sort_by_relevance_then_valueN_____SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::valueno arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","set_sort_by_relevance_then_value", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","set_sort_by_relevance_then_value", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  {
    try {
      (arg1)->set_sort_by_relevance_then_value(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_Enquire_sort_by_relevance_then_valueN___(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[4];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 4) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_Enquire_sort_by_relevance_then_valueN_____SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_bool(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_Enquire_sort_by_relevance_then_valueN_____SWIG_0(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 4, "Enquire.sort_by_relevance_then_value!", 
    "    void Enquire.sort_by_relevance_then_value!(Xapian::valueno sort_key, bool reverse)\n"
    "    void Enquire.sort_by_relevance_then_value!(Xapian::valueno sort_key)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_set_sort_by_key__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::KeyMaker *arg2 = (Xapian::KeyMaker *) 0 ;
  bool arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","set_sort_by_key", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_Xapian__KeyMaker, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::KeyMaker *","set_sort_by_key", 2, argv[0] )); 
  }
  arg2 = reinterpret_cast< Xapian::KeyMaker * >(argp2);
  ecode3 = SWIG_AsVal_bool(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","set_sort_by_key", 3, argv[1] ));
  } 
  arg3 = static_cast< bool >(val3);
  {
    try {
      (arg1)->set_sort_by_key(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_set_sort_by_key__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::Sorter *arg2 = (Xapian::Sorter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","set_sort_by_key", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_Xapian__Sorter, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Sorter *","set_sort_by_key", 2, argv[0] )); 
  }
  arg2 = reinterpret_cast< Xapian::Sorter * >(argp2);
  {
    try {
      (arg1)->set_sort_by_key(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_Enquire_set_sort_by_key(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[4];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 4) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Xapian__Sorter, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_Enquire_set_sort_by_key__SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Xapian__KeyMaker, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_bool(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_Enquire_set_sort_by_key__SWIG_0(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 4, "Enquire.set_sort_by_key", 
    "    void Enquire.set_sort_by_key(Xapian::KeyMaker *sorter, bool reverse)\n"
    "    void Enquire.set_sort_by_key(Xapian::Sorter *sorter)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_set_sort_by_key_then_relevance__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::KeyMaker *arg2 = (Xapian::KeyMaker *) 0 ;
  bool arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","set_sort_by_key_then_relevance", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_Xapian__KeyMaker, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::KeyMaker *","set_sort_by_key_then_relevance", 2, argv[0] )); 
  }
  arg2 = reinterpret_cast< Xapian::KeyMaker * >(argp2);
  ecode3 = SWIG_AsVal_bool(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","set_sort_by_key_then_relevance", 3, argv[1] ));
  } 
  arg3 = static_cast< bool >(val3);
  {
    try {
      (arg1)->set_sort_by_key_then_relevance(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_set_sort_by_key_then_relevance__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::Sorter *arg2 = (Xapian::Sorter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","set_sort_by_key_then_relevance", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_Xapian__Sorter, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Sorter *","set_sort_by_key_then_relevance", 2, argv[0] )); 
  }
  arg2 = reinterpret_cast< Xapian::Sorter * >(argp2);
  {
    try {
      (arg1)->set_sort_by_key_then_relevance(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_Enquire_set_sort_by_key_then_relevance(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[4];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 4) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Xapian__Sorter, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_Enquire_set_sort_by_key_then_relevance__SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Xapian__KeyMaker, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_bool(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_Enquire_set_sort_by_key_then_relevance__SWIG_0(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 4, "Enquire.set_sort_by_key_then_relevance", 
    "    void Enquire.set_sort_by_key_then_relevance(Xapian::KeyMaker *sorter, bool reverse)\n"
    "    void Enquire.set_sort_by_key_then_relevance(Xapian::Sorter *sorter)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_set_sort_by_relevance_then_key__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::KeyMaker *arg2 = (Xapian::KeyMaker *) 0 ;
  bool arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","set_sort_by_relevance_then_key", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_Xapian__KeyMaker, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::KeyMaker *","set_sort_by_relevance_then_key", 2, argv[0] )); 
  }
  arg2 = reinterpret_cast< Xapian::KeyMaker * >(argp2);
  ecode3 = SWIG_AsVal_bool(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","set_sort_by_relevance_then_key", 3, argv[1] ));
  } 
  arg3 = static_cast< bool >(val3);
  {
    try {
      (arg1)->set_sort_by_relevance_then_key(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_set_sort_by_relevance_then_key__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::Sorter *arg2 = (Xapian::Sorter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire *","set_sort_by_relevance_then_key", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_Xapian__Sorter, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Sorter *","set_sort_by_relevance_then_key", 2, argv[0] )); 
  }
  arg2 = reinterpret_cast< Xapian::Sorter * >(argp2);
  {
    try {
      (arg1)->set_sort_by_relevance_then_key(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_Enquire_set_sort_by_relevance_then_key(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[4];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 4) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Xapian__Sorter, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_Enquire_set_sort_by_relevance_then_key__SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Xapian__KeyMaker, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_bool(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_Enquire_set_sort_by_relevance_then_key__SWIG_0(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 4, "Enquire.set_sort_by_relevance_then_key", 
    "    void Enquire.set_sort_by_relevance_then_key(Xapian::KeyMaker *sorter, bool reverse)\n"
    "    void Enquire.set_sort_by_relevance_then_key(Xapian::Sorter *sorter)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_mset__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::doccount arg2 ;
  Xapian::doccount arg3 ;
  Xapian::doccount arg4 ;
  Xapian::RSet *arg5 = (Xapian::RSet *) 0 ;
  Xapian::MatchDecider *arg6 = (Xapian::MatchDecider *) 0 ;
  Xapian::MatchDecider *arg7 = (Xapian::MatchDecider *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  void *argp6 = 0 ;
  int res6 = 0 ;
  void *argp7 = 0 ;
  int res7 = 0 ;
  Xapian::MSet result;
  VALUE vresult = Qnil;
  
  if ((argc < 6) || (argc > 6)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 6)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire const *","get_mset", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::doccount","get_mset", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::doccount >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::doccount","get_mset", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::doccount >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "Xapian::doccount","get_mset", 4, argv[2] ));
  } 
  arg4 = static_cast< Xapian::doccount >(val4);
  res5 = SWIG_ConvertPtr(argv[3], &argp5,SWIGTYPE_p_Xapian__RSet, 0 |  0 );
  if (!SWIG_IsOK(res5)) {
    SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "Xapian::RSet const *","get_mset", 5, argv[3] )); 
  }
  arg5 = reinterpret_cast< Xapian::RSet * >(argp5);
  res6 = SWIG_ConvertPtr(argv[4], &argp6,SWIGTYPE_p_Xapian__MatchDecider, 0 |  0 );
  if (!SWIG_IsOK(res6)) {
    SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "Xapian::MatchDecider const *","get_mset", 6, argv[4] )); 
  }
  arg6 = reinterpret_cast< Xapian::MatchDecider * >(argp6);
  res7 = SWIG_ConvertPtr(argv[5], &argp7,SWIGTYPE_p_Xapian__MatchDecider, 0 |  0 );
  if (!SWIG_IsOK(res7)) {
    SWIG_exception_fail(SWIG_ArgError(res7), Ruby_Format_TypeError( "", "Xapian::MatchDecider const *","get_mset", 7, argv[5] )); 
  }
  arg7 = reinterpret_cast< Xapian::MatchDecider * >(argp7);
  {
    try {
      result = ((Xapian::Enquire const *)arg1)->get_mset(arg2,arg3,arg4,(Xapian::RSet const *)arg5,(Xapian::MatchDecider const *)arg6,(Xapian::MatchDecider const *)arg7);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::MSet(static_cast< const Xapian::MSet& >(result))), SWIGTYPE_p_Xapian__MSet, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_mset__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::doccount arg2 ;
  Xapian::doccount arg3 ;
  Xapian::doccount arg4 ;
  Xapian::RSet *arg5 = (Xapian::RSet *) 0 ;
  Xapian::MatchDecider *arg6 = (Xapian::MatchDecider *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  void *argp6 = 0 ;
  int res6 = 0 ;
  Xapian::MSet result;
  VALUE vresult = Qnil;
  
  if ((argc < 5) || (argc > 5)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 5)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire const *","get_mset", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::doccount","get_mset", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::doccount >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::doccount","get_mset", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::doccount >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "Xapian::doccount","get_mset", 4, argv[2] ));
  } 
  arg4 = static_cast< Xapian::doccount >(val4);
  res5 = SWIG_ConvertPtr(argv[3], &argp5,SWIGTYPE_p_Xapian__RSet, 0 |  0 );
  if (!SWIG_IsOK(res5)) {
    SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "Xapian::RSet const *","get_mset", 5, argv[3] )); 
  }
  arg5 = reinterpret_cast< Xapian::RSet * >(argp5);
  res6 = SWIG_ConvertPtr(argv[4], &argp6,SWIGTYPE_p_Xapian__MatchDecider, 0 |  0 );
  if (!SWIG_IsOK(res6)) {
    SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "Xapian::MatchDecider const *","get_mset", 6, argv[4] )); 
  }
  arg6 = reinterpret_cast< Xapian::MatchDecider * >(argp6);
  {
    try {
      result = ((Xapian::Enquire const *)arg1)->get_mset(arg2,arg3,arg4,(Xapian::RSet const *)arg5,(Xapian::MatchDecider const *)arg6);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::MSet(static_cast< const Xapian::MSet& >(result))), SWIGTYPE_p_Xapian__MSet, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_mset__SWIG_2(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::doccount arg2 ;
  Xapian::doccount arg3 ;
  Xapian::doccount arg4 ;
  Xapian::RSet *arg5 = (Xapian::RSet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  Xapian::MSet result;
  VALUE vresult = Qnil;
  
  if ((argc < 4) || (argc > 4)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire const *","get_mset", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::doccount","get_mset", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::doccount >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::doccount","get_mset", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::doccount >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "Xapian::doccount","get_mset", 4, argv[2] ));
  } 
  arg4 = static_cast< Xapian::doccount >(val4);
  res5 = SWIG_ConvertPtr(argv[3], &argp5,SWIGTYPE_p_Xapian__RSet, 0 |  0 );
  if (!SWIG_IsOK(res5)) {
    SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "Xapian::RSet const *","get_mset", 5, argv[3] )); 
  }
  arg5 = reinterpret_cast< Xapian::RSet * >(argp5);
  {
    try {
      result = ((Xapian::Enquire const *)arg1)->get_mset(arg2,arg3,arg4,(Xapian::RSet const *)arg5);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::MSet(static_cast< const Xapian::MSet& >(result))), SWIGTYPE_p_Xapian__MSet, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_mset__SWIG_3(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::doccount arg2 ;
  Xapian::doccount arg3 ;
  Xapian::doccount arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  Xapian::MSet result;
  VALUE vresult = Qnil;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire const *","get_mset", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::doccount","get_mset", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::doccount >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::doccount","get_mset", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::doccount >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "Xapian::doccount","get_mset", 4, argv[2] ));
  } 
  arg4 = static_cast< Xapian::doccount >(val4);
  {
    try {
      result = ((Xapian::Enquire const *)arg1)->get_mset(arg2,arg3,arg4);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::MSet(static_cast< const Xapian::MSet& >(result))), SWIGTYPE_p_Xapian__MSet, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_mset__SWIG_4(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::doccount arg2 ;
  Xapian::doccount arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  Xapian::MSet result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire const *","get_mset", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::doccount","get_mset", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::doccount >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::doccount","get_mset", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::doccount >(val3);
  {
    try {
      result = ((Xapian::Enquire const *)arg1)->get_mset(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::MSet(static_cast< const Xapian::MSet& >(result))), SWIGTYPE_p_Xapian__MSet, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_mset__SWIG_5(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::doccount arg2 ;
  Xapian::doccount arg3 ;
  Xapian::RSet *arg4 = (Xapian::RSet *) 0 ;
  Xapian::MatchDecider *arg5 = (Xapian::MatchDecider *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  Xapian::MSet result;
  VALUE vresult = Qnil;
  
  if ((argc < 4) || (argc > 4)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire const *","get_mset", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::doccount","get_mset", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::doccount >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::doccount","get_mset", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::doccount >(val3);
  res4 = SWIG_ConvertPtr(argv[2], &argp4,SWIGTYPE_p_Xapian__RSet, 0 |  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "Xapian::RSet const *","get_mset", 4, argv[2] )); 
  }
  arg4 = reinterpret_cast< Xapian::RSet * >(argp4);
  res5 = SWIG_ConvertPtr(argv[3], &argp5,SWIGTYPE_p_Xapian__MatchDecider, 0 |  0 );
  if (!SWIG_IsOK(res5)) {
    SWIG_exception_fail(SWIG_ArgError(res5), Ruby_Format_TypeError( "", "Xapian::MatchDecider const *","get_mset", 5, argv[3] )); 
  }
  arg5 = reinterpret_cast< Xapian::MatchDecider * >(argp5);
  {
    try {
      result = ((Xapian::Enquire const *)arg1)->get_mset(arg2,arg3,(Xapian::RSet const *)arg4,(Xapian::MatchDecider const *)arg5);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::MSet(static_cast< const Xapian::MSet& >(result))), SWIGTYPE_p_Xapian__MSet, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_mset__SWIG_6(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::doccount arg2 ;
  Xapian::doccount arg3 ;
  Xapian::RSet *arg4 = (Xapian::RSet *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  Xapian::MSet result;
  VALUE vresult = Qnil;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire const *","get_mset", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::doccount","get_mset", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::doccount >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::doccount","get_mset", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::doccount >(val3);
  res4 = SWIG_ConvertPtr(argv[2], &argp4,SWIGTYPE_p_Xapian__RSet, 0 |  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "Xapian::RSet const *","get_mset", 4, argv[2] )); 
  }
  arg4 = reinterpret_cast< Xapian::RSet * >(argp4);
  {
    try {
      result = ((Xapian::Enquire const *)arg1)->get_mset(arg2,arg3,(Xapian::RSet const *)arg4);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::MSet(static_cast< const Xapian::MSet& >(result))), SWIGTYPE_p_Xapian__MSet, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_Enquire_mset(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[8];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 8) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_Enquire_mset__SWIG_4(nargs, args, self);
        }
      }
    }
  }
  if (argc == 4) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          void *vptr = 0;
          int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_Xapian__RSet, 0);
          _v = SWIG_CheckState(res);
          if (_v) {
            return _wrap_Enquire_mset__SWIG_6(nargs, args, self);
          }
        }
      }
    }
  }
  if (argc == 4) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          {
            int res = SWIG_AsVal_unsigned_SS_int(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
          if (_v) {
            return _wrap_Enquire_mset__SWIG_3(nargs, args, self);
          }
        }
      }
    }
  }
  if (argc == 5) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          void *vptr = 0;
          int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_Xapian__RSet, 0);
          _v = SWIG_CheckState(res);
          if (_v) {
            void *vptr = 0;
            int res = SWIG_ConvertPtr(argv[4], &vptr, SWIGTYPE_p_Xapian__MatchDecider, 0);
            _v = SWIG_CheckState(res);
            if (_v) {
              return _wrap_Enquire_mset__SWIG_5(nargs, args, self);
            }
          }
        }
      }
    }
  }
  if (argc == 5) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          {
            int res = SWIG_AsVal_unsigned_SS_int(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
          if (_v) {
            void *vptr = 0;
            int res = SWIG_ConvertPtr(argv[4], &vptr, SWIGTYPE_p_Xapian__RSet, 0);
            _v = SWIG_CheckState(res);
            if (_v) {
              return _wrap_Enquire_mset__SWIG_2(nargs, args, self);
            }
          }
        }
      }
    }
  }
  if (argc == 6) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          {
            int res = SWIG_AsVal_unsigned_SS_int(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
          if (_v) {
            void *vptr = 0;
            int res = SWIG_ConvertPtr(argv[4], &vptr, SWIGTYPE_p_Xapian__RSet, 0);
            _v = SWIG_CheckState(res);
            if (_v) {
              void *vptr = 0;
              int res = SWIG_ConvertPtr(argv[5], &vptr, SWIGTYPE_p_Xapian__MatchDecider, 0);
              _v = SWIG_CheckState(res);
              if (_v) {
                return _wrap_Enquire_mset__SWIG_1(nargs, args, self);
              }
            }
          }
        }
      }
    }
  }
  if (argc == 7) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          {
            int res = SWIG_AsVal_unsigned_SS_int(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
          if (_v) {
            void *vptr = 0;
            int res = SWIG_ConvertPtr(argv[4], &vptr, SWIGTYPE_p_Xapian__RSet, 0);
            _v = SWIG_CheckState(res);
            if (_v) {
              void *vptr = 0;
              int res = SWIG_ConvertPtr(argv[5], &vptr, SWIGTYPE_p_Xapian__MatchDecider, 0);
              _v = SWIG_CheckState(res);
              if (_v) {
                void *vptr = 0;
                int res = SWIG_ConvertPtr(argv[6], &vptr, SWIGTYPE_p_Xapian__MatchDecider, 0);
                _v = SWIG_CheckState(res);
                if (_v) {
                  return _wrap_Enquire_mset__SWIG_0(nargs, args, self);
                }
              }
            }
          }
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 8, "Enquire.mset", 
    "    Xapian::MSet Enquire.mset(Xapian::doccount first, Xapian::doccount maxitems, Xapian::doccount checkatleast, Xapian::RSet const *omrset, Xapian::MatchDecider const *mdecider, Xapian::MatchDecider const *matchspy)\n"
    "    Xapian::MSet Enquire.mset(Xapian::doccount first, Xapian::doccount maxitems, Xapian::doccount checkatleast, Xapian::RSet const *omrset, Xapian::MatchDecider const *mdecider)\n"
    "    Xapian::MSet Enquire.mset(Xapian::doccount first, Xapian::doccount maxitems, Xapian::doccount checkatleast, Xapian::RSet const *omrset)\n"
    "    Xapian::MSet Enquire.mset(Xapian::doccount first, Xapian::doccount maxitems, Xapian::doccount checkatleast)\n"
    "    Xapian::MSet Enquire.mset(Xapian::doccount first, Xapian::doccount maxitems)\n"
    "    Xapian::MSet Enquire.mset(Xapian::doccount first, Xapian::doccount maxitems, Xapian::RSet const *omrset, Xapian::MatchDecider const *mdecider)\n"
    "    Xapian::MSet Enquire.mset(Xapian::doccount first, Xapian::doccount maxitems, Xapian::RSet const *omrset)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_eset__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::termcount arg2 ;
  Xapian::RSet *arg3 = 0 ;
  int arg4 ;
  double arg5 ;
  Xapian::ExpandDecider *arg6 = (Xapian::ExpandDecider *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  void *argp3 ;
  int res3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  double val5 ;
  int ecode5 = 0 ;
  void *argp6 = 0 ;
  int res6 = 0 ;
  Xapian::ESet result;
  VALUE vresult = Qnil;
  
  if ((argc < 5) || (argc > 5)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 5)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire const *","get_eset", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::termcount","get_eset", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::termcount >(val2);
  res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_Xapian__RSet,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "Xapian::RSet const &","get_eset", 3, argv[1] )); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::RSet const &","get_eset", 3, argv[1])); 
  }
  arg3 = reinterpret_cast< Xapian::RSet * >(argp3);
  ecode4 = SWIG_AsVal_int(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","get_eset", 4, argv[2] ));
  } 
  arg4 = static_cast< int >(val4);
  ecode5 = SWIG_AsVal_double(argv[3], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "double","get_eset", 5, argv[3] ));
  } 
  arg5 = static_cast< double >(val5);
  res6 = SWIG_ConvertPtr(argv[4], &argp6,SWIGTYPE_p_Xapian__ExpandDecider, 0 |  0 );
  if (!SWIG_IsOK(res6)) {
    SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "Xapian::ExpandDecider const *","get_eset", 6, argv[4] )); 
  }
  arg6 = reinterpret_cast< Xapian::ExpandDecider * >(argp6);
  {
    try {
      result = ((Xapian::Enquire const *)arg1)->get_eset(arg2,(Xapian::RSet const &)*arg3,arg4,arg5,(Xapian::ExpandDecider const *)arg6);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::ESet(static_cast< const Xapian::ESet& >(result))), SWIGTYPE_p_Xapian__ESet, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_eset__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::termcount arg2 ;
  Xapian::RSet *arg3 = 0 ;
  int arg4 ;
  double arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  void *argp3 ;
  int res3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  double val5 ;
  int ecode5 = 0 ;
  Xapian::ESet result;
  VALUE vresult = Qnil;
  
  if ((argc < 4) || (argc > 4)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire const *","get_eset", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::termcount","get_eset", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::termcount >(val2);
  res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_Xapian__RSet,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "Xapian::RSet const &","get_eset", 3, argv[1] )); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::RSet const &","get_eset", 3, argv[1])); 
  }
  arg3 = reinterpret_cast< Xapian::RSet * >(argp3);
  ecode4 = SWIG_AsVal_int(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","get_eset", 4, argv[2] ));
  } 
  arg4 = static_cast< int >(val4);
  ecode5 = SWIG_AsVal_double(argv[3], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "double","get_eset", 5, argv[3] ));
  } 
  arg5 = static_cast< double >(val5);
  {
    try {
      result = ((Xapian::Enquire const *)arg1)->get_eset(arg2,(Xapian::RSet const &)*arg3,arg4,arg5);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::ESet(static_cast< const Xapian::ESet& >(result))), SWIGTYPE_p_Xapian__ESet, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_eset__SWIG_2(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::termcount arg2 ;
  Xapian::RSet *arg3 = 0 ;
  int arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  void *argp3 ;
  int res3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  Xapian::ESet result;
  VALUE vresult = Qnil;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire const *","get_eset", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::termcount","get_eset", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::termcount >(val2);
  res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_Xapian__RSet,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "Xapian::RSet const &","get_eset", 3, argv[1] )); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::RSet const &","get_eset", 3, argv[1])); 
  }
  arg3 = reinterpret_cast< Xapian::RSet * >(argp3);
  ecode4 = SWIG_AsVal_int(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","get_eset", 4, argv[2] ));
  } 
  arg4 = static_cast< int >(val4);
  {
    try {
      result = ((Xapian::Enquire const *)arg1)->get_eset(arg2,(Xapian::RSet const &)*arg3,arg4);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::ESet(static_cast< const Xapian::ESet& >(result))), SWIGTYPE_p_Xapian__ESet, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_eset__SWIG_3(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::termcount arg2 ;
  Xapian::RSet *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  void *argp3 ;
  int res3 = 0 ;
  Xapian::ESet result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire const *","get_eset", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::termcount","get_eset", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::termcount >(val2);
  res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_Xapian__RSet,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "Xapian::RSet const &","get_eset", 3, argv[1] )); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::RSet const &","get_eset", 3, argv[1])); 
  }
  arg3 = reinterpret_cast< Xapian::RSet * >(argp3);
  {
    try {
      result = ((Xapian::Enquire const *)arg1)->get_eset(arg2,(Xapian::RSet const &)*arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::ESet(static_cast< const Xapian::ESet& >(result))), SWIGTYPE_p_Xapian__ESet, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_eset__SWIG_4(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::termcount arg2 ;
  Xapian::RSet *arg3 = 0 ;
  int arg4 ;
  double arg5 ;
  Xapian::ExpandDecider *arg6 = (Xapian::ExpandDecider *) 0 ;
  Xapian::weight arg7 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  void *argp3 ;
  int res3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  double val5 ;
  int ecode5 = 0 ;
  void *argp6 = 0 ;
  int res6 = 0 ;
  double val7 ;
  int ecode7 = 0 ;
  Xapian::ESet result;
  VALUE vresult = Qnil;
  
  if ((argc < 6) || (argc > 6)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 6)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire const *","get_eset", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::termcount","get_eset", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::termcount >(val2);
  res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_Xapian__RSet,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "Xapian::RSet const &","get_eset", 3, argv[1] )); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::RSet const &","get_eset", 3, argv[1])); 
  }
  arg3 = reinterpret_cast< Xapian::RSet * >(argp3);
  ecode4 = SWIG_AsVal_int(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","get_eset", 4, argv[2] ));
  } 
  arg4 = static_cast< int >(val4);
  ecode5 = SWIG_AsVal_double(argv[3], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "double","get_eset", 5, argv[3] ));
  } 
  arg5 = static_cast< double >(val5);
  res6 = SWIG_ConvertPtr(argv[4], &argp6,SWIGTYPE_p_Xapian__ExpandDecider, 0 |  0 );
  if (!SWIG_IsOK(res6)) {
    SWIG_exception_fail(SWIG_ArgError(res6), Ruby_Format_TypeError( "", "Xapian::ExpandDecider const *","get_eset", 6, argv[4] )); 
  }
  arg6 = reinterpret_cast< Xapian::ExpandDecider * >(argp6);
  ecode7 = SWIG_AsVal_double(argv[5], &val7);
  if (!SWIG_IsOK(ecode7)) {
    SWIG_exception_fail(SWIG_ArgError(ecode7), Ruby_Format_TypeError( "", "Xapian::weight","get_eset", 7, argv[5] ));
  } 
  arg7 = static_cast< Xapian::weight >(val7);
  {
    try {
      result = ((Xapian::Enquire const *)arg1)->get_eset(arg2,(Xapian::RSet const &)*arg3,arg4,arg5,(Xapian::ExpandDecider const *)arg6,arg7);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::ESet(static_cast< const Xapian::ESet& >(result))), SWIGTYPE_p_Xapian__ESet, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_eset__SWIG_5(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::termcount arg2 ;
  Xapian::RSet *arg3 = 0 ;
  Xapian::ExpandDecider *arg4 = (Xapian::ExpandDecider *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  void *argp3 ;
  int res3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  Xapian::ESet result;
  VALUE vresult = Qnil;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire const *","get_eset", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::termcount","get_eset", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::termcount >(val2);
  res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_Xapian__RSet,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "Xapian::RSet const &","get_eset", 3, argv[1] )); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::RSet const &","get_eset", 3, argv[1])); 
  }
  arg3 = reinterpret_cast< Xapian::RSet * >(argp3);
  res4 = SWIG_ConvertPtr(argv[2], &argp4,SWIGTYPE_p_Xapian__ExpandDecider, 0 |  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "Xapian::ExpandDecider const *","get_eset", 4, argv[2] )); 
  }
  arg4 = reinterpret_cast< Xapian::ExpandDecider * >(argp4);
  {
    try {
      result = ((Xapian::Enquire const *)arg1)->get_eset(arg2,(Xapian::RSet const &)*arg3,(Xapian::ExpandDecider const *)arg4);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::ESet(static_cast< const Xapian::ESet& >(result))), SWIGTYPE_p_Xapian__ESet, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_Enquire_eset(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[8];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 8) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_Xapian__RSet, 0);
        _v = SWIG_CheckState(res);
        if (_v) {
          return _wrap_Enquire_eset__SWIG_3(nargs, args, self);
        }
      }
    }
  }
  if (argc == 4) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_Xapian__RSet, 0);
        _v = SWIG_CheckState(res);
        if (_v) {
          void *vptr = 0;
          int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_Xapian__ExpandDecider, 0);
          _v = SWIG_CheckState(res);
          if (_v) {
            return _wrap_Enquire_eset__SWIG_5(nargs, args, self);
          }
        }
      }
    }
  }
  if (argc == 4) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_Xapian__RSet, 0);
        _v = SWIG_CheckState(res);
        if (_v) {
          {
            int res = SWIG_AsVal_int(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
          if (_v) {
            return _wrap_Enquire_eset__SWIG_2(nargs, args, self);
          }
        }
      }
    }
  }
  if (argc == 5) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_Xapian__RSet, 0);
        _v = SWIG_CheckState(res);
        if (_v) {
          {
            int res = SWIG_AsVal_int(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
          if (_v) {
            {
              int res = SWIG_AsVal_double(argv[4], NULL);
              _v = SWIG_CheckState(res);
            }
            if (_v) {
              return _wrap_Enquire_eset__SWIG_1(nargs, args, self);
            }
          }
        }
      }
    }
  }
  if (argc == 6) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_Xapian__RSet, 0);
        _v = SWIG_CheckState(res);
        if (_v) {
          {
            int res = SWIG_AsVal_int(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
          if (_v) {
            {
              int res = SWIG_AsVal_double(argv[4], NULL);
              _v = SWIG_CheckState(res);
            }
            if (_v) {
              void *vptr = 0;
              int res = SWIG_ConvertPtr(argv[5], &vptr, SWIGTYPE_p_Xapian__ExpandDecider, 0);
              _v = SWIG_CheckState(res);
              if (_v) {
                return _wrap_Enquire_eset__SWIG_0(nargs, args, self);
              }
            }
          }
        }
      }
    }
  }
  if (argc == 7) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_Xapian__RSet, 0);
        _v = SWIG_CheckState(res);
        if (_v) {
          {
            int res = SWIG_AsVal_int(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
          if (_v) {
            {
              int res = SWIG_AsVal_double(argv[4], NULL);
              _v = SWIG_CheckState(res);
            }
            if (_v) {
              void *vptr = 0;
              int res = SWIG_ConvertPtr(argv[5], &vptr, SWIGTYPE_p_Xapian__ExpandDecider, 0);
              _v = SWIG_CheckState(res);
              if (_v) {
                {
                  int res = SWIG_AsVal_double(argv[6], NULL);
                  _v = SWIG_CheckState(res);
                }
                if (_v) {
                  return _wrap_Enquire_eset__SWIG_4(nargs, args, self);
                }
              }
            }
          }
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 8, "Enquire.eset", 
    "    Xapian::ESet Enquire.eset(Xapian::termcount maxitems, Xapian::RSet const &omrset, int flags, double k, Xapian::ExpandDecider const *edecider)\n"
    "    Xapian::ESet Enquire.eset(Xapian::termcount maxitems, Xapian::RSet const &omrset, int flags, double k)\n"
    "    Xapian::ESet Enquire.eset(Xapian::termcount maxitems, Xapian::RSet const &omrset, int flags)\n"
    "    Xapian::ESet Enquire.eset(Xapian::termcount maxitems, Xapian::RSet const &omrset)\n"
    "    Xapian::ESet Enquire.eset(Xapian::termcount maxitems, Xapian::RSet const &omrset, int flags, double k, Xapian::ExpandDecider const *edecider, Xapian::weight min_wt)\n"
    "    Xapian::ESet Enquire.eset(Xapian::termcount maxitems, Xapian::RSet const &omrset, Xapian::ExpandDecider const *edecider)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire__dangerous_matching_terms_begin__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::docid arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire const *","get_matching_terms_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","get_matching_terms_begin", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  {
    try {
      result = ((Xapian::Enquire const *)arg1)->get_matching_terms_begin(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire__dangerous_matching_terms_end__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::docid arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire const *","get_matching_terms_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","get_matching_terms_end", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  {
    try {
      result = ((Xapian::Enquire const *)arg1)->get_matching_terms_end(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire__dangerous_matching_terms_begin__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::MSetIterator *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire const *","get_matching_terms_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__MSetIterator,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::MSetIterator const &","get_matching_terms_begin", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::MSetIterator const &","get_matching_terms_begin", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::MSetIterator * >(argp2);
  {
    try {
      result = ((Xapian::Enquire const *)arg1)->get_matching_terms_begin((Xapian::MSetIterator const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_Enquire__dangerous_matching_terms_begin(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Xapian__MSetIterator, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_Enquire__dangerous_matching_terms_begin__SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_Enquire__dangerous_matching_terms_begin__SWIG_0(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "Enquire._dangerous_matching_terms_begin", 
    "    Xapian::TermIterator Enquire._dangerous_matching_terms_begin(Xapian::docid did)\n"
    "    Xapian::TermIterator Enquire._dangerous_matching_terms_begin(Xapian::MSetIterator const &i)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire__dangerous_matching_terms_end__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  Xapian::MSetIterator *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire const *","get_matching_terms_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__MSetIterator,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::MSetIterator const &","get_matching_terms_end", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::MSetIterator const &","get_matching_terms_end", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::MSetIterator * >(argp2);
  {
    try {
      result = ((Xapian::Enquire const *)arg1)->get_matching_terms_end((Xapian::MSetIterator const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_Enquire__dangerous_matching_terms_end(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Xapian__MSetIterator, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_Enquire__dangerous_matching_terms_end__SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Enquire, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_Enquire__dangerous_matching_terms_end__SWIG_0(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "Enquire._dangerous_matching_terms_end", 
    "    Xapian::TermIterator Enquire._dangerous_matching_terms_end(Xapian::docid did)\n"
    "    Xapian::TermIterator Enquire._dangerous_matching_terms_end(Xapian::MSetIterator const &i)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Enquire_description(int argc, VALUE *argv, VALUE self) {
  Xapian::Enquire *arg1 = (Xapian::Enquire *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Enquire, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Enquire const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Enquire * >(argp1);
  {
    try {
      result = ((Xapian::Enquire const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


swig_class SwigClassRegistry;

SWIGINTERN VALUE
_wrap_new_Registry__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Registry *arg1 = 0 ;
  void *argp1 ;
  int res1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::Registry";
  Xapian::Registry *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_Xapian__Registry,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Registry const &","Xapian::Registry", 1, argv[0] )); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Registry const &","Xapian::Registry", 1, argv[0])); 
  }
  arg1 = reinterpret_cast< Xapian::Registry * >(argp1);
  {
    try {
      result = (Xapian::Registry *)new Xapian::Registry((Xapian::Registry const &)*arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_Registry_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_Registry_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__Registry);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_Registry__SWIG_1(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::Registry";
  Xapian::Registry *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::Registry *)new Xapian::Registry();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_Registry(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[1];
  int ii;
  
  argc = nargs;
  if (argc > 1) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 0) {
    return _wrap_new_Registry__SWIG_1(nargs, args, self);
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Registry, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_new_Registry__SWIG_0(nargs, args, self);
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 1, "Registry.new", 
    "    Registry.new(Xapian::Registry const &other)\n"
    "    Registry.new()\n");
  
  return Qnil;
}


SWIGINTERN void
free_Xapian_Registry(Xapian::Registry *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_Registry_register_weighting_scheme(int argc, VALUE *argv, VALUE self) {
  Xapian::Registry *arg1 = (Xapian::Registry *) 0 ;
  Xapian::Weight *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Registry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Registry *","register_weighting_scheme", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Registry * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Weight,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Weight const &","register_weighting_scheme", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Weight const &","register_weighting_scheme", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Weight * >(argp2);
  {
    try {
      (arg1)->register_weighting_scheme((Xapian::Weight const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Registry_get_weighting_scheme(int argc, VALUE *argv, VALUE self) {
  Xapian::Registry *arg1 = (Xapian::Registry *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Xapian::Weight *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Registry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Registry const *","get_weighting_scheme", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Registry * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","get_weighting_scheme", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","get_weighting_scheme", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = (Xapian::Weight *)((Xapian::Registry const *)arg1)->get_weighting_scheme((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Xapian__Weight, 0 |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Registry_register_posting_source(int argc, VALUE *argv, VALUE self) {
  Xapian::Registry *arg1 = (Xapian::Registry *) 0 ;
  Xapian::PostingSource *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Registry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Registry *","register_posting_source", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Registry * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__PostingSource,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::PostingSource const &","register_posting_source", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::PostingSource const &","register_posting_source", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::PostingSource * >(argp2);
  {
    try {
      (arg1)->register_posting_source((Xapian::PostingSource const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Registry_get_posting_source(int argc, VALUE *argv, VALUE self) {
  Xapian::Registry *arg1 = (Xapian::Registry *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Swig::Director *director = 0;
  Xapian::PostingSource *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Registry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Registry const *","get_posting_source", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Registry * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","get_posting_source", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","get_posting_source", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = (Xapian::PostingSource *)((Xapian::Registry const *)arg1)->get_posting_source((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  director = dynamic_cast<Swig::Director *>(result);
  if (director) {
    vresult = director->swig_get_self();
  } else {
    vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Xapian__PostingSource, 0 |  0 );
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Registry_register_match_spy(int argc, VALUE *argv, VALUE self) {
  Xapian::Registry *arg1 = (Xapian::Registry *) 0 ;
  Xapian::MatchSpy *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Registry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Registry *","register_match_spy", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Registry * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__MatchSpy,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::MatchSpy const &","register_match_spy", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::MatchSpy const &","register_match_spy", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::MatchSpy * >(argp2);
  {
    try {
      (arg1)->register_match_spy((Xapian::MatchSpy const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Registry_get_match_spy(int argc, VALUE *argv, VALUE self) {
  Xapian::Registry *arg1 = (Xapian::Registry *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Xapian::MatchSpy *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Registry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Registry const *","get_match_spy", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Registry * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","get_match_spy", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","get_match_spy", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = (Xapian::MatchSpy *)((Xapian::Registry const *)arg1)->get_match_spy((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Xapian__MatchSpy, 0 |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


swig_class SwigClassWeight;

SWIGINTERN void
free_Xapian_Weight(Xapian::Weight *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_Weight_name(int argc, VALUE *argv, VALUE self) {
  Xapian::Weight *arg1 = (Xapian::Weight *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Weight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Weight const *","name", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Weight * >(argp1);
  {
    try {
      result = ((Xapian::Weight const *)arg1)->name();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Weight_sumpart(int argc, VALUE *argv, VALUE self) {
  Xapian::Weight *arg1 = (Xapian::Weight *) 0 ;
  Xapian::termcount arg2 ;
  Xapian::termcount arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Weight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Weight const *","get_sumpart", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Weight * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::termcount","get_sumpart", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::termcount >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::termcount","get_sumpart", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::termcount >(val3);
  {
    try {
      result = (Xapian::weight)((Xapian::Weight const *)arg1)->get_sumpart(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Weight_maxpart(int argc, VALUE *argv, VALUE self) {
  Xapian::Weight *arg1 = (Xapian::Weight *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Weight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Weight const *","get_maxpart", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Weight * >(argp1);
  {
    try {
      result = (Xapian::weight)((Xapian::Weight const *)arg1)->get_maxpart();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Weight_sumextra(int argc, VALUE *argv, VALUE self) {
  Xapian::Weight *arg1 = (Xapian::Weight *) 0 ;
  Xapian::termcount arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Weight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Weight const *","get_sumextra", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Weight * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::termcount","get_sumextra", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::termcount >(val2);
  {
    try {
      result = (Xapian::weight)((Xapian::Weight const *)arg1)->get_sumextra(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Weight_maxextra(int argc, VALUE *argv, VALUE self) {
  Xapian::Weight *arg1 = (Xapian::Weight *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Weight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Weight const *","get_maxextra", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Weight * >(argp1);
  {
    try {
      result = (Xapian::weight)((Xapian::Weight const *)arg1)->get_maxextra();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Weight_get_sumpart_needs_doclength_(int argc, VALUE *argv, VALUE self) {
  Xapian::Weight *arg1 = (Xapian::Weight *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Weight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Weight const *","get_sumpart_needs_doclength_", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Weight * >(argp1);
  {
    try {
      result = (bool)((Xapian::Weight const *)arg1)->get_sumpart_needs_doclength_();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Weight_get_sumpart_needs_wdf_(int argc, VALUE *argv, VALUE self) {
  Xapian::Weight *arg1 = (Xapian::Weight *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Weight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Weight const *","get_sumpart_needs_wdf_", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Weight * >(argp1);
  {
    try {
      result = (bool)((Xapian::Weight const *)arg1)->get_sumpart_needs_wdf_();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


swig_class SwigClassBoolWeight;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_BoolWeight_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_BoolWeight_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__BoolWeight);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_BoolWeight(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::BoolWeight";
  Xapian::BoolWeight *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::BoolWeight *)new Xapian::BoolWeight();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_BoolWeight_name(int argc, VALUE *argv, VALUE self) {
  Xapian::BoolWeight *arg1 = (Xapian::BoolWeight *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__BoolWeight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::BoolWeight const *","name", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::BoolWeight * >(argp1);
  {
    try {
      result = ((Xapian::BoolWeight const *)arg1)->name();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_BoolWeight_sumpart(int argc, VALUE *argv, VALUE self) {
  Xapian::BoolWeight *arg1 = (Xapian::BoolWeight *) 0 ;
  Xapian::termcount arg2 ;
  Xapian::termcount arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__BoolWeight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::BoolWeight const *","get_sumpart", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::BoolWeight * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::termcount","get_sumpart", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::termcount >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::termcount","get_sumpart", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::termcount >(val3);
  {
    try {
      result = (Xapian::weight)((Xapian::BoolWeight const *)arg1)->get_sumpart(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_BoolWeight_maxpart(int argc, VALUE *argv, VALUE self) {
  Xapian::BoolWeight *arg1 = (Xapian::BoolWeight *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__BoolWeight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::BoolWeight const *","get_maxpart", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::BoolWeight * >(argp1);
  {
    try {
      result = (Xapian::weight)((Xapian::BoolWeight const *)arg1)->get_maxpart();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_BoolWeight_sumextra(int argc, VALUE *argv, VALUE self) {
  Xapian::BoolWeight *arg1 = (Xapian::BoolWeight *) 0 ;
  Xapian::termcount arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__BoolWeight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::BoolWeight const *","get_sumextra", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::BoolWeight * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::termcount","get_sumextra", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::termcount >(val2);
  {
    try {
      result = (Xapian::weight)((Xapian::BoolWeight const *)arg1)->get_sumextra(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_BoolWeight_maxextra(int argc, VALUE *argv, VALUE self) {
  Xapian::BoolWeight *arg1 = (Xapian::BoolWeight *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__BoolWeight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::BoolWeight const *","get_maxextra", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::BoolWeight * >(argp1);
  {
    try {
      result = (Xapian::weight)((Xapian::BoolWeight const *)arg1)->get_maxextra();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_BoolWeight(Xapian::BoolWeight *arg1) {
    delete arg1;
}

swig_class SwigClassBM25Weight;

SWIGINTERN VALUE
_wrap_new_BM25Weight__SWIG_0(int argc, VALUE *argv, VALUE self) {
  double arg1 ;
  double arg2 ;
  double arg3 ;
  double arg4 ;
  double arg5 ;
  double val1 ;
  int ecode1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  double val4 ;
  int ecode4 = 0 ;
  double val5 ;
  int ecode5 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::BM25Weight";
  Xapian::BM25Weight *result = 0 ;
  
  if ((argc < 5) || (argc > 5)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 5)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_double(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "double","Xapian::BM25Weight", 1, argv[0] ));
  } 
  arg1 = static_cast< double >(val1);
  ecode2 = SWIG_AsVal_double(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "double","Xapian::BM25Weight", 2, argv[1] ));
  } 
  arg2 = static_cast< double >(val2);
  ecode3 = SWIG_AsVal_double(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","Xapian::BM25Weight", 3, argv[2] ));
  } 
  arg3 = static_cast< double >(val3);
  ecode4 = SWIG_AsVal_double(argv[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "double","Xapian::BM25Weight", 4, argv[3] ));
  } 
  arg4 = static_cast< double >(val4);
  ecode5 = SWIG_AsVal_double(argv[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "double","Xapian::BM25Weight", 5, argv[4] ));
  } 
  arg5 = static_cast< double >(val5);
  {
    try {
      result = (Xapian::BM25Weight *)new Xapian::BM25Weight(arg1,arg2,arg3,arg4,arg5);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_BM25Weight_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_BM25Weight_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__BM25Weight);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_BM25Weight__SWIG_1(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::BM25Weight";
  Xapian::BM25Weight *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::BM25Weight *)new Xapian::BM25Weight();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_BM25Weight(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[5];
  int ii;
  
  argc = nargs;
  if (argc > 5) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 0) {
    return _wrap_new_BM25Weight__SWIG_1(nargs, args, self);
  }
  if (argc == 5) {
    int _v;
    {
      int res = SWIG_AsVal_double(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      {
        int res = SWIG_AsVal_double(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_double(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          {
            int res = SWIG_AsVal_double(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
          if (_v) {
            {
              int res = SWIG_AsVal_double(argv[4], NULL);
              _v = SWIG_CheckState(res);
            }
            if (_v) {
              return _wrap_new_BM25Weight__SWIG_0(nargs, args, self);
            }
          }
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 5, "BM25Weight.new", 
    "    BM25Weight.new(double k1, double k2, double k3, double b, double min_normlen)\n"
    "    BM25Weight.new()\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_BM25Weight_name(int argc, VALUE *argv, VALUE self) {
  Xapian::BM25Weight *arg1 = (Xapian::BM25Weight *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__BM25Weight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::BM25Weight const *","name", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::BM25Weight * >(argp1);
  {
    try {
      result = ((Xapian::BM25Weight const *)arg1)->name();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_BM25Weight_sumpart(int argc, VALUE *argv, VALUE self) {
  Xapian::BM25Weight *arg1 = (Xapian::BM25Weight *) 0 ;
  Xapian::termcount arg2 ;
  Xapian::termcount arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__BM25Weight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::BM25Weight const *","get_sumpart", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::BM25Weight * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::termcount","get_sumpart", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::termcount >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::termcount","get_sumpart", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::termcount >(val3);
  {
    try {
      result = (Xapian::weight)((Xapian::BM25Weight const *)arg1)->get_sumpart(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_BM25Weight_maxpart(int argc, VALUE *argv, VALUE self) {
  Xapian::BM25Weight *arg1 = (Xapian::BM25Weight *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__BM25Weight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::BM25Weight const *","get_maxpart", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::BM25Weight * >(argp1);
  {
    try {
      result = (Xapian::weight)((Xapian::BM25Weight const *)arg1)->get_maxpart();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_BM25Weight_sumextra(int argc, VALUE *argv, VALUE self) {
  Xapian::BM25Weight *arg1 = (Xapian::BM25Weight *) 0 ;
  Xapian::termcount arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__BM25Weight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::BM25Weight const *","get_sumextra", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::BM25Weight * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::termcount","get_sumextra", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::termcount >(val2);
  {
    try {
      result = (Xapian::weight)((Xapian::BM25Weight const *)arg1)->get_sumextra(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_BM25Weight_maxextra(int argc, VALUE *argv, VALUE self) {
  Xapian::BM25Weight *arg1 = (Xapian::BM25Weight *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__BM25Weight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::BM25Weight const *","get_maxextra", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::BM25Weight * >(argp1);
  {
    try {
      result = (Xapian::weight)((Xapian::BM25Weight const *)arg1)->get_maxextra();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_BM25Weight(Xapian::BM25Weight *arg1) {
    delete arg1;
}

swig_class SwigClassTradWeight;

SWIGINTERN VALUE
_wrap_new_TradWeight__SWIG_0(int argc, VALUE *argv, VALUE self) {
  double arg1 ;
  double val1 ;
  int ecode1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::TradWeight";
  Xapian::TradWeight *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_double(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "double","Xapian::TradWeight", 1, argv[0] ));
  } 
  arg1 = static_cast< double >(val1);
  {
    try {
      result = (Xapian::TradWeight *)new Xapian::TradWeight(arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_TradWeight_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_TradWeight_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__TradWeight);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_TradWeight__SWIG_1(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::TradWeight";
  Xapian::TradWeight *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::TradWeight *)new Xapian::TradWeight();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_TradWeight(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[1];
  int ii;
  
  argc = nargs;
  if (argc > 1) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 0) {
    return _wrap_new_TradWeight__SWIG_1(nargs, args, self);
  }
  if (argc == 1) {
    int _v;
    {
      int res = SWIG_AsVal_double(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      return _wrap_new_TradWeight__SWIG_0(nargs, args, self);
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 1, "TradWeight.new", 
    "    TradWeight.new(double k)\n"
    "    TradWeight.new()\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TradWeight_name(int argc, VALUE *argv, VALUE self) {
  Xapian::TradWeight *arg1 = (Xapian::TradWeight *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TradWeight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TradWeight const *","name", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TradWeight * >(argp1);
  {
    try {
      result = ((Xapian::TradWeight const *)arg1)->name();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TradWeight_sumpart(int argc, VALUE *argv, VALUE self) {
  Xapian::TradWeight *arg1 = (Xapian::TradWeight *) 0 ;
  Xapian::termcount arg2 ;
  Xapian::termcount arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TradWeight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TradWeight const *","get_sumpart", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TradWeight * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::termcount","get_sumpart", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::termcount >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::termcount","get_sumpart", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::termcount >(val3);
  {
    try {
      result = (Xapian::weight)((Xapian::TradWeight const *)arg1)->get_sumpart(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TradWeight_maxpart(int argc, VALUE *argv, VALUE self) {
  Xapian::TradWeight *arg1 = (Xapian::TradWeight *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TradWeight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TradWeight const *","get_maxpart", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TradWeight * >(argp1);
  {
    try {
      result = (Xapian::weight)((Xapian::TradWeight const *)arg1)->get_maxpart();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TradWeight_sumextra(int argc, VALUE *argv, VALUE self) {
  Xapian::TradWeight *arg1 = (Xapian::TradWeight *) 0 ;
  Xapian::termcount arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TradWeight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TradWeight const *","get_sumextra", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TradWeight * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::termcount","get_sumextra", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::termcount >(val2);
  {
    try {
      result = (Xapian::weight)((Xapian::TradWeight const *)arg1)->get_sumextra(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TradWeight_maxextra(int argc, VALUE *argv, VALUE self) {
  Xapian::TradWeight *arg1 = (Xapian::TradWeight *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::weight result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TradWeight, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TradWeight const *","get_maxextra", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TradWeight * >(argp1);
  {
    try {
      result = (Xapian::weight)((Xapian::TradWeight const *)arg1)->get_maxextra();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_TradWeight(Xapian::TradWeight *arg1) {
    delete arg1;
}

swig_class SwigClassMatchSpy;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_MatchSpy_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_MatchSpy_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__MatchSpy);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_MatchSpy(int argc, VALUE *argv, VALUE self) {
  VALUE arg1 = (VALUE) 0 ;
  const char *classname SWIGUNUSED = "Xapian::MatchSpy";
  Xapian::MatchSpy *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  arg1 = self;
  {
    try {
      if ( strcmp(rb_obj_classname(self), classname) != 0 ) {
        /* subclassed */
        result = (Xapian::MatchSpy *)new SwigDirector_MatchSpy(arg1); 
      } else {
        rb_raise(rb_eNameError,"accessing abstract class or protected constructor"); 
        return Qnil;
      }
      
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_MatchSpy(Xapian::MatchSpy *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_MatchSpy___call__(int argc, VALUE *argv, VALUE self) {
  Xapian::MatchSpy *arg1 = (Xapian::MatchSpy *) 0 ;
  Xapian::Document *arg2 = 0 ;
  Xapian::weight arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  Swig::Director *director = 0;
  bool upcall = false;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MatchSpy, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MatchSpy *","operator ()", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MatchSpy * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Document,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Document const &","operator ()", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Document const &","operator ()", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Document * >(argp2);
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::weight","operator ()", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::weight >(val3);
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          Swig::DirectorPureVirtualException::raise("Xapian::MatchSpy::operator ()");
        } else {
          (arg1)->operator ()((Xapian::Document const &)*arg2,arg3);
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MatchSpy_name(int argc, VALUE *argv, VALUE self) {
  Xapian::MatchSpy *arg1 = (Xapian::MatchSpy *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Swig::Director *director = 0;
  bool upcall = false;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MatchSpy, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MatchSpy const *","name", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MatchSpy * >(argp1);
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          result = ((Xapian::MatchSpy const *)arg1)->Xapian::MatchSpy::name();
        } else {
          result = ((Xapian::MatchSpy const *)arg1)->name();
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MatchSpy_merge_results(int argc, VALUE *argv, VALUE self) {
  Xapian::MatchSpy *arg1 = (Xapian::MatchSpy *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Swig::Director *director = 0;
  bool upcall = false;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MatchSpy, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MatchSpy *","merge_results", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MatchSpy * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","merge_results", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","merge_results", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          (arg1)->Xapian::MatchSpy::merge_results((std::string const &)*arg2);
        } else {
          (arg1)->merge_results((std::string const &)*arg2);
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MatchSpy_description(int argc, VALUE *argv, VALUE self) {
  Xapian::MatchSpy *arg1 = (Xapian::MatchSpy *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Swig::Director *director = 0;
  bool upcall = false;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MatchSpy, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MatchSpy const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MatchSpy * >(argp1);
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          result = ((Xapian::MatchSpy const *)arg1)->Xapian::MatchSpy::get_description();
        } else {
          result = ((Xapian::MatchSpy const *)arg1)->get_description();
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_disown_MatchSpy(int argc, VALUE *argv, VALUE self) {
  Xapian::MatchSpy *arg1 = (Xapian::MatchSpy *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_Xapian__MatchSpy, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MatchSpy *","disown_MatchSpy", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< Xapian::MatchSpy * >(argp1);
  {
    Swig::Director *director = SWIG_DIRECTOR_CAST(arg1);
    if (director) director->swig_disown();
  }
  
  return Qnil;
fail:
  return Qnil;
}


swig_class SwigClassValueCountMatchSpy;

SWIGINTERN VALUE
_wrap_new_ValueCountMatchSpy__SWIG_0(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::ValueCountMatchSpy";
  Xapian::ValueCountMatchSpy *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::ValueCountMatchSpy *)new Xapian::ValueCountMatchSpy();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_ValueCountMatchSpy_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_ValueCountMatchSpy_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__ValueCountMatchSpy);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_ValueCountMatchSpy__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::valueno arg1 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::ValueCountMatchSpy";
  Xapian::ValueCountMatchSpy *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::ValueCountMatchSpy", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::valueno >(val1);
  {
    try {
      result = (Xapian::ValueCountMatchSpy *)new Xapian::ValueCountMatchSpy(arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_ValueCountMatchSpy(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[1];
  int ii;
  
  argc = nargs;
  if (argc > 1) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 0) {
    return _wrap_new_ValueCountMatchSpy__SWIG_0(nargs, args, self);
  }
  if (argc == 1) {
    int _v;
    {
      int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      return _wrap_new_ValueCountMatchSpy__SWIG_1(nargs, args, self);
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 1, "ValueCountMatchSpy.new", 
    "    ValueCountMatchSpy.new()\n"
    "    ValueCountMatchSpy.new(Xapian::valueno slot_)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueCountMatchSpy_get_total(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueCountMatchSpy *arg1 = (Xapian::ValueCountMatchSpy *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueCountMatchSpy, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueCountMatchSpy const *","get_total", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueCountMatchSpy * >(argp1);
  {
    try {
      result = ((Xapian::ValueCountMatchSpy const *)arg1)->get_total();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_size_t(static_cast< size_t >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueCountMatchSpy__dangerous_values_begin(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueCountMatchSpy *arg1 = (Xapian::ValueCountMatchSpy *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueCountMatchSpy, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueCountMatchSpy const *","values_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueCountMatchSpy * >(argp1);
  {
    try {
      result = ((Xapian::ValueCountMatchSpy const *)arg1)->values_begin();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueCountMatchSpy__dangerous_values_end(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueCountMatchSpy *arg1 = (Xapian::ValueCountMatchSpy *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueCountMatchSpy, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueCountMatchSpy const *","values_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueCountMatchSpy * >(argp1);
  {
    try {
      result = ((Xapian::ValueCountMatchSpy const *)arg1)->values_end();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueCountMatchSpy__dangerous_top_values_begin(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueCountMatchSpy *arg1 = (Xapian::ValueCountMatchSpy *) 0 ;
  size_t arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueCountMatchSpy, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueCountMatchSpy const *","top_values_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueCountMatchSpy * >(argp1);
  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","top_values_begin", 2, argv[0] ));
  } 
  arg2 = static_cast< size_t >(val2);
  {
    try {
      result = ((Xapian::ValueCountMatchSpy const *)arg1)->top_values_begin(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueCountMatchSpy__dangerous_top_values_end(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueCountMatchSpy *arg1 = (Xapian::ValueCountMatchSpy *) 0 ;
  size_t arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueCountMatchSpy, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueCountMatchSpy const *","top_values_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueCountMatchSpy * >(argp1);
  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","top_values_end", 2, argv[0] ));
  } 
  arg2 = static_cast< size_t >(val2);
  {
    try {
      result = ((Xapian::ValueCountMatchSpy const *)arg1)->top_values_end(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueCountMatchSpy___call__(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueCountMatchSpy *arg1 = (Xapian::ValueCountMatchSpy *) 0 ;
  Xapian::Document *arg2 = 0 ;
  Xapian::weight arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueCountMatchSpy, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueCountMatchSpy *","operator ()", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueCountMatchSpy * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Document,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Document const &","operator ()", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Document const &","operator ()", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Document * >(argp2);
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::weight","operator ()", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::weight >(val3);
  {
    try {
      (arg1)->operator ()((Xapian::Document const &)*arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueCountMatchSpy_name(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueCountMatchSpy *arg1 = (Xapian::ValueCountMatchSpy *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueCountMatchSpy, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueCountMatchSpy const *","name", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueCountMatchSpy * >(argp1);
  {
    try {
      result = ((Xapian::ValueCountMatchSpy const *)arg1)->name();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueCountMatchSpy_merge_results(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueCountMatchSpy *arg1 = (Xapian::ValueCountMatchSpy *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueCountMatchSpy, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueCountMatchSpy *","merge_results", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueCountMatchSpy * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","merge_results", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","merge_results", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      (arg1)->merge_results((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueCountMatchSpy_description(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueCountMatchSpy *arg1 = (Xapian::ValueCountMatchSpy *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueCountMatchSpy, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueCountMatchSpy const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueCountMatchSpy * >(argp1);
  {
    try {
      result = ((Xapian::ValueCountMatchSpy const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_ValueCountMatchSpy(Xapian::ValueCountMatchSpy *arg1) {
    delete arg1;
}

swig_class SwigClassDatabase;

SWIGINTERN VALUE
_wrap_Database_add_database(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  Xapian::Database *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database *","add_database", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Database,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Database const &","add_database", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Database const &","add_database", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Database * >(argp2);
  {
    try {
      (arg1)->add_database((Xapian::Database const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_new_Database__SWIG_0(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::Database";
  Xapian::Database *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::Database *)new Xapian::Database();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_new_Database__SWIG_1(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  const char *classname SWIGUNUSED = "Xapian::Database";
  Xapian::Database *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Database", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Database", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  {
    try {
      result = (Xapian::Database *)new Xapian::Database((std::string const &)*arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res1)) delete arg1;
  return self;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN void
free_Xapian_Database(Xapian::Database *arg1) {
    delete arg1;
}

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_Database_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_Database_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__Database);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_Database__SWIG_2(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = 0 ;
  void *argp1 ;
  int res1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::Database";
  Xapian::Database *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_Xapian__Database,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const &","Xapian::Database", 1, argv[0] )); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Database const &","Xapian::Database", 1, argv[0])); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    try {
      result = (Xapian::Database *)new Xapian::Database((Xapian::Database const &)*arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_Database(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[1];
  int ii;
  
  argc = nargs;
  if (argc > 1) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 0) {
    return _wrap_new_Database__SWIG_0(nargs, args, self);
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Database, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_new_Database__SWIG_2(nargs, args, self);
    }
  }
  if (argc == 1) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_new_Database__SWIG_1(nargs, args, self);
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 1, "Database.new", 
    "    Database.new()\n"
    "    Database.new(std::string const &path)\n"
    "    Database.new(Xapian::Database const &other)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_reopen(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database *","reopen", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    try {
      (arg1)->reopen();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_close(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database *","close", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    try {
      (arg1)->close();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_description(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    try {
      result = ((Xapian::Database const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database__dangerous_postlist_begin(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Xapian::PostingIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","postlist_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","postlist_begin", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","postlist_begin", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = ((Xapian::Database const *)arg1)->postlist_begin((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::PostingIterator(static_cast< const Xapian::PostingIterator& >(result))), SWIGTYPE_p_Xapian__PostingIterator, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database__dangerous_postlist_end(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Xapian::PostingIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","postlist_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","postlist_end", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","postlist_end", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = ((Xapian::Database const *)arg1)->postlist_end((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::PostingIterator(static_cast< const Xapian::PostingIterator& >(result))), SWIGTYPE_p_Xapian__PostingIterator, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database__dangerous_termlist_begin(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  Xapian::docid arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","termlist_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","termlist_begin", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  {
    try {
      result = ((Xapian::Database const *)arg1)->termlist_begin(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database__dangerous_termlist_end(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  Xapian::docid arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","termlist_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","termlist_end", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  {
    try {
      result = ((Xapian::Database const *)arg1)->termlist_end(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database__dangerous_positionlist_begin(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  Xapian::docid arg2 ;
  std::string *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  Xapian::PositionIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","positionlist_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","positionlist_begin", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::string const &","positionlist_begin", 3, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","positionlist_begin", 3, argv[1])); 
    }
    arg3 = ptr;
  }
  {
    try {
      result = ((Xapian::Database const *)arg1)->positionlist_begin(arg2,(std::string const &)*arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::PositionIterator(static_cast< const Xapian::PositionIterator& >(result))), SWIGTYPE_p_Xapian__PositionIterator, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res3)) delete arg3;
  return vresult;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database__dangerous_positionlist_end(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  Xapian::docid arg2 ;
  std::string *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  Xapian::PositionIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","positionlist_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","positionlist_end", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::string const &","positionlist_end", 3, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","positionlist_end", 3, argv[1])); 
    }
    arg3 = ptr;
  }
  {
    try {
      result = ((Xapian::Database const *)arg1)->positionlist_end(arg2,(std::string const &)*arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::PositionIterator(static_cast< const Xapian::PositionIterator& >(result))), SWIGTYPE_p_Xapian__PositionIterator, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res3)) delete arg3;
  return vresult;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database__dangerous_allterms_begin__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","allterms_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    try {
      result = ((Xapian::Database const *)arg1)->allterms_begin();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database__dangerous_allterms_end__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","allterms_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    try {
      result = ((Xapian::Database const *)arg1)->allterms_end();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database__dangerous_allterms_begin__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","allterms_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","allterms_begin", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","allterms_begin", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = ((Xapian::Database const *)arg1)->allterms_begin((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE _wrap_Database__dangerous_allterms_begin(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Database, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_Database__dangerous_allterms_begin__SWIG_0(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Database, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_Database__dangerous_allterms_begin__SWIG_1(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "Database._dangerous_allterms_begin", 
    "    Xapian::TermIterator Database._dangerous_allterms_begin()\n"
    "    Xapian::TermIterator Database._dangerous_allterms_begin(std::string const &prefix)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database__dangerous_allterms_end__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","allterms_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","allterms_end", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","allterms_end", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = ((Xapian::Database const *)arg1)->allterms_end((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE _wrap_Database__dangerous_allterms_end(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Database, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_Database__dangerous_allterms_end__SWIG_0(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Database, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_Database__dangerous_allterms_end__SWIG_1(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "Database._dangerous_allterms_end", 
    "    Xapian::TermIterator Database._dangerous_allterms_end()\n"
    "    Xapian::TermIterator Database._dangerous_allterms_end(std::string const &prefix)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_doccount(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","get_doccount", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    try {
      result = (Xapian::doccount)((Xapian::Database const *)arg1)->get_doccount();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_lastdocid(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::docid result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","get_lastdocid", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    try {
      result = (Xapian::docid)((Xapian::Database const *)arg1)->get_lastdocid();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_avlength(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::doclength result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","get_avlength", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    try {
      result = (Xapian::doclength)((Xapian::Database const *)arg1)->get_avlength();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_termfreq(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","get_termfreq", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","get_termfreq", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","get_termfreq", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = (Xapian::doccount)((Xapian::Database const *)arg1)->get_termfreq((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_term_exists(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","term_exists", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","term_exists", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","term_exists", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = (bool)((Xapian::Database const *)arg1)->term_exists((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_collection_freq(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Xapian::termcount result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","get_collection_freq", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","get_collection_freq", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","get_collection_freq", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = (Xapian::termcount)((Xapian::Database const *)arg1)->get_collection_freq((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_get_value_freq(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  Xapian::valueno arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  Xapian::doccount result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","get_value_freq", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","get_value_freq", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  {
    try {
      result = (Xapian::doccount)((Xapian::Database const *)arg1)->get_value_freq(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_get_value_lower_bound(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  Xapian::valueno arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","get_value_lower_bound", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","get_value_lower_bound", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  {
    try {
      result = ((Xapian::Database const *)arg1)->get_value_lower_bound(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_get_value_upper_bound(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  Xapian::valueno arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","get_value_upper_bound", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","get_value_upper_bound", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  {
    try {
      result = ((Xapian::Database const *)arg1)->get_value_upper_bound(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_get_doclength_lower_bound(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::termcount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","get_doclength_lower_bound", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    try {
      result = (Xapian::termcount)((Xapian::Database const *)arg1)->get_doclength_lower_bound();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_get_doclength_upper_bound(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::termcount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","get_doclength_upper_bound", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    try {
      result = (Xapian::termcount)((Xapian::Database const *)arg1)->get_doclength_upper_bound();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_get_wdf_upper_bound(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Xapian::termcount result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","get_wdf_upper_bound", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","get_wdf_upper_bound", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","get_wdf_upper_bound", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = (Xapian::termcount)((Xapian::Database const *)arg1)->get_wdf_upper_bound((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database__dangerous_valuestream_begin(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  Xapian::valueno arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  Xapian::ValueIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","valuestream_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","valuestream_begin", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  {
    try {
      result = ((Xapian::Database const *)arg1)->valuestream_begin(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::ValueIterator(static_cast< const Xapian::ValueIterator& >(result))), SWIGTYPE_p_Xapian__ValueIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database__dangerous_valuestream_end(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  Xapian::valueno arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  Xapian::ValueIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","valuestream_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","valuestream_end", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  {
    try {
      result = ((Xapian::Database const *)arg1)->valuestream_end(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::ValueIterator(static_cast< const Xapian::ValueIterator& >(result))), SWIGTYPE_p_Xapian__ValueIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_doclength(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  Xapian::docid arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  Xapian::termcount result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","get_doclength", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","get_doclength", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  {
    try {
      result = (Xapian::termcount)((Xapian::Database const *)arg1)->get_doclength(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_keep_alive(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database *","keep_alive", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    try {
      (arg1)->keep_alive();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_document(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  Xapian::docid arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  Xapian::Document result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database *","get_document", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","get_document", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  {
    try {
      result = (arg1)->get_document(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::Document(static_cast< const Xapian::Document& >(result))), SWIGTYPE_p_Xapian__Document, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_get_spelling_suggestion__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  std::string *arg2 = 0 ;
  unsigned int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","get_spelling_suggestion", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","get_spelling_suggestion", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","get_spelling_suggestion", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "unsigned int","get_spelling_suggestion", 3, argv[1] ));
  } 
  arg3 = static_cast< unsigned int >(val3);
  {
    try {
      result = ((Xapian::Database const *)arg1)->get_spelling_suggestion((std::string const &)*arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_get_spelling_suggestion__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","get_spelling_suggestion", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","get_spelling_suggestion", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","get_spelling_suggestion", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = ((Xapian::Database const *)arg1)->get_spelling_suggestion((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE _wrap_Database_get_spelling_suggestion(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[4];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 4) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Database, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_Database_get_spelling_suggestion__SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Database, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_Database_get_spelling_suggestion__SWIG_0(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 4, "Database.get_spelling_suggestion", 
    "    std::string Database.get_spelling_suggestion(std::string const &word, unsigned int max_edit_distance)\n"
    "    std::string Database.get_spelling_suggestion(std::string const &word)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_spellings_begin(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","spellings_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    try {
      result = ((Xapian::Database const *)arg1)->spellings_begin();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_spellings_end(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","spellings_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    try {
      result = ((Xapian::Database const *)arg1)->spellings_end();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_synonyms_begin(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","synonyms_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","synonyms_begin", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","synonyms_begin", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = ((Xapian::Database const *)arg1)->synonyms_begin((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_synonyms_end(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","synonyms_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","synonyms_end", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","synonyms_end", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = ((Xapian::Database const *)arg1)->synonyms_end((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_synonym_keys_begin__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","synonym_keys_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","synonym_keys_begin", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","synonym_keys_begin", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = ((Xapian::Database const *)arg1)->synonym_keys_begin((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_synonym_keys_begin__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","synonym_keys_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    try {
      result = ((Xapian::Database const *)arg1)->synonym_keys_begin();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_Database_synonym_keys_begin(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Database, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_Database_synonym_keys_begin__SWIG_1(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Database, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_Database_synonym_keys_begin__SWIG_0(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "Database.synonym_keys_begin", 
    "    Xapian::TermIterator Database.synonym_keys_begin(std::string const &prefix)\n"
    "    Xapian::TermIterator Database.synonym_keys_begin()\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_synonym_keys_end__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","synonym_keys_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","synonym_keys_end", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","synonym_keys_end", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = ((Xapian::Database const *)arg1)->synonym_keys_end((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_synonym_keys_end__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","synonym_keys_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    try {
      result = ((Xapian::Database const *)arg1)->synonym_keys_end();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_Database_synonym_keys_end(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Database, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_Database_synonym_keys_end__SWIG_1(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Database, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_Database_synonym_keys_end__SWIG_0(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "Database.synonym_keys_end", 
    "    Xapian::TermIterator Database.synonym_keys_end(std::string const &prefix)\n"
    "    Xapian::TermIterator Database.synonym_keys_end()\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_get_metadata(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","get_metadata", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","get_metadata", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","get_metadata", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = ((Xapian::Database const *)arg1)->get_metadata((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_metadata_keys_begin__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","metadata_keys_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","metadata_keys_begin", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","metadata_keys_begin", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = ((Xapian::Database const *)arg1)->metadata_keys_begin((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_metadata_keys_begin__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","metadata_keys_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    try {
      result = ((Xapian::Database const *)arg1)->metadata_keys_begin();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_Database_metadata_keys_begin(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Database, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_Database_metadata_keys_begin__SWIG_1(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Database, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_Database_metadata_keys_begin__SWIG_0(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "Database.metadata_keys_begin", 
    "    Xapian::TermIterator Database.metadata_keys_begin(std::string const &prefix)\n"
    "    Xapian::TermIterator Database.metadata_keys_begin()\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_metadata_keys_end__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","metadata_keys_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","metadata_keys_end", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","metadata_keys_end", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = ((Xapian::Database const *)arg1)->metadata_keys_end((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_metadata_keys_end__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","metadata_keys_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    try {
      result = ((Xapian::Database const *)arg1)->metadata_keys_end();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_Database_metadata_keys_end(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Database, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_Database_metadata_keys_end__SWIG_1(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Database, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_Database_metadata_keys_end__SWIG_0(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "Database.metadata_keys_end", 
    "    Xapian::TermIterator Database.metadata_keys_end(std::string const &prefix)\n"
    "    Xapian::TermIterator Database.metadata_keys_end()\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_get_uuid(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","get_uuid", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    try {
      result = ((Xapian::Database const *)arg1)->get_uuid();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Database_has_positions(int argc, VALUE *argv, VALUE self) {
  Xapian::Database *arg1 = (Xapian::Database *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Database, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Database const *","has_positions", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Database * >(argp1);
  {
    try {
      result = (bool)((Xapian::Database const *)arg1)->has_positions();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


swig_class SwigClassWritableDatabase;

SWIGINTERN void
free_Xapian_WritableDatabase(Xapian::WritableDatabase *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_new_WritableDatabase__SWIG_0(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::WritableDatabase";
  Xapian::WritableDatabase *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::WritableDatabase *)new Xapian::WritableDatabase();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_new_WritableDatabase__SWIG_1(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  int arg2 ;
  int res1 = SWIG_OLDOBJ ;
  int val2 ;
  int ecode2 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::WritableDatabase";
  Xapian::WritableDatabase *result = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::WritableDatabase", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::WritableDatabase", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  ecode2 = SWIG_AsVal_int(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","Xapian::WritableDatabase", 2, argv[1] ));
  } 
  arg2 = static_cast< int >(val2);
  {
    try {
      result = (Xapian::WritableDatabase *)new Xapian::WritableDatabase((std::string const &)*arg1,arg2);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res1)) delete arg1;
  return self;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_WritableDatabase_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_WritableDatabase_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__WritableDatabase);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_WritableDatabase__SWIG_2(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase *arg1 = 0 ;
  void *argp1 ;
  int res1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::WritableDatabase";
  Xapian::WritableDatabase *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_Xapian__WritableDatabase,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::WritableDatabase const &","Xapian::WritableDatabase", 1, argv[0] )); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::WritableDatabase const &","Xapian::WritableDatabase", 1, argv[0])); 
  }
  arg1 = reinterpret_cast< Xapian::WritableDatabase * >(argp1);
  {
    try {
      result = (Xapian::WritableDatabase *)new Xapian::WritableDatabase((Xapian::WritableDatabase const &)*arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_WritableDatabase(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[2];
  int ii;
  
  argc = nargs;
  if (argc > 2) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 0) {
    return _wrap_new_WritableDatabase__SWIG_0(nargs, args, self);
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__WritableDatabase, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_new_WritableDatabase__SWIG_2(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_new_WritableDatabase__SWIG_1(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 2, "WritableDatabase.new", 
    "    WritableDatabase.new()\n"
    "    WritableDatabase.new(std::string const &path, int action)\n"
    "    WritableDatabase.new(Xapian::WritableDatabase const &other)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WritableDatabase_commit(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase *arg1 = (Xapian::WritableDatabase *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__WritableDatabase, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::WritableDatabase *","commit", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::WritableDatabase * >(argp1);
  {
    try {
      (arg1)->commit();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WritableDatabase_flush(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase *arg1 = (Xapian::WritableDatabase *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__WritableDatabase, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::WritableDatabase *","flush", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::WritableDatabase * >(argp1);
  {
    try {
      (arg1)->flush();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WritableDatabase_begin_transaction__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase *arg1 = (Xapian::WritableDatabase *) 0 ;
  bool arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__WritableDatabase, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::WritableDatabase *","begin_transaction", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::WritableDatabase * >(argp1);
  ecode2 = SWIG_AsVal_bool(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","begin_transaction", 2, argv[0] ));
  } 
  arg2 = static_cast< bool >(val2);
  {
    try {
      (arg1)->begin_transaction(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WritableDatabase_begin_transaction__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase *arg1 = (Xapian::WritableDatabase *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__WritableDatabase, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::WritableDatabase *","begin_transaction", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::WritableDatabase * >(argp1);
  {
    try {
      (arg1)->begin_transaction();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_WritableDatabase_begin_transaction(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__WritableDatabase, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_WritableDatabase_begin_transaction__SWIG_1(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__WritableDatabase, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_bool(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_WritableDatabase_begin_transaction__SWIG_0(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "WritableDatabase.begin_transaction", 
    "    void WritableDatabase.begin_transaction(bool flushed)\n"
    "    void WritableDatabase.begin_transaction()\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WritableDatabase_commit_transaction(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase *arg1 = (Xapian::WritableDatabase *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__WritableDatabase, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::WritableDatabase *","commit_transaction", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::WritableDatabase * >(argp1);
  {
    try {
      (arg1)->commit_transaction();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WritableDatabase_cancel_transaction(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase *arg1 = (Xapian::WritableDatabase *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__WritableDatabase, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::WritableDatabase *","cancel_transaction", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::WritableDatabase * >(argp1);
  {
    try {
      (arg1)->cancel_transaction();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WritableDatabase_add_document(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase *arg1 = (Xapian::WritableDatabase *) 0 ;
  Xapian::Document *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  Xapian::docid result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__WritableDatabase, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::WritableDatabase *","add_document", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::WritableDatabase * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Document,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Document const &","add_document", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Document const &","add_document", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Document * >(argp2);
  {
    try {
      result = (Xapian::docid)(arg1)->add_document((Xapian::Document const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WritableDatabase_delete_document__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase *arg1 = (Xapian::WritableDatabase *) 0 ;
  Xapian::docid arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__WritableDatabase, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::WritableDatabase *","delete_document", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::WritableDatabase * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","delete_document", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  {
    try {
      (arg1)->delete_document(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WritableDatabase_replace_document__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase *arg1 = (Xapian::WritableDatabase *) 0 ;
  Xapian::docid arg2 ;
  Xapian::Document *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  void *argp3 ;
  int res3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__WritableDatabase, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::WritableDatabase *","replace_document", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::WritableDatabase * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::docid","replace_document", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::docid >(val2);
  res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_Xapian__Document,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "Xapian::Document const &","replace_document", 3, argv[1] )); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Document const &","replace_document", 3, argv[1])); 
  }
  arg3 = reinterpret_cast< Xapian::Document * >(argp3);
  {
    try {
      (arg1)->replace_document(arg2,(Xapian::Document const &)*arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WritableDatabase_delete_document__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase *arg1 = (Xapian::WritableDatabase *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__WritableDatabase, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::WritableDatabase *","delete_document", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::WritableDatabase * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","delete_document", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","delete_document", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      (arg1)->delete_document((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE _wrap_WritableDatabase_delete_document(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__WritableDatabase, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_WritableDatabase_delete_document__SWIG_0(nargs, args, self);
      }
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__WritableDatabase, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_WritableDatabase_delete_document__SWIG_1(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "WritableDatabase.delete_document", 
    "    void WritableDatabase.delete_document(Xapian::docid did)\n"
    "    void WritableDatabase.delete_document(std::string const &unique_term)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WritableDatabase_replace_document__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase *arg1 = (Xapian::WritableDatabase *) 0 ;
  std::string *arg2 = 0 ;
  Xapian::Document *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  void *argp3 ;
  int res3 = 0 ;
  Xapian::docid result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__WritableDatabase, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::WritableDatabase *","replace_document", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::WritableDatabase * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","replace_document", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","replace_document", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_Xapian__Document,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "Xapian::Document const &","replace_document", 3, argv[1] )); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Document const &","replace_document", 3, argv[1])); 
  }
  arg3 = reinterpret_cast< Xapian::Document * >(argp3);
  {
    try {
      result = (Xapian::docid)(arg1)->replace_document((std::string const &)*arg2,(Xapian::Document const &)*arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE _wrap_WritableDatabase_replace_document(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[4];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 4) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__WritableDatabase, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_Xapian__Document, 0);
        _v = SWIG_CheckState(res);
        if (_v) {
          return _wrap_WritableDatabase_replace_document__SWIG_0(nargs, args, self);
        }
      }
    }
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__WritableDatabase, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_Xapian__Document, 0);
        _v = SWIG_CheckState(res);
        if (_v) {
          return _wrap_WritableDatabase_replace_document__SWIG_1(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 4, "WritableDatabase.replace_document", 
    "    Xapian::docid WritableDatabase.replace_document(Xapian::docid did, Xapian::Document const &document)\n"
    "    Xapian::docid WritableDatabase.replace_document(std::string const &unique_term, Xapian::Document const &document)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WritableDatabase_add_spelling__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase *arg1 = (Xapian::WritableDatabase *) 0 ;
  std::string *arg2 = 0 ;
  Xapian::termcount arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__WritableDatabase, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::WritableDatabase const *","add_spelling", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::WritableDatabase * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","add_spelling", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","add_spelling", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::termcount","add_spelling", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::termcount >(val3);
  {
    try {
      ((Xapian::WritableDatabase const *)arg1)->add_spelling((std::string const &)*arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WritableDatabase_add_spelling__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase *arg1 = (Xapian::WritableDatabase *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__WritableDatabase, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::WritableDatabase const *","add_spelling", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::WritableDatabase * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","add_spelling", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","add_spelling", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      ((Xapian::WritableDatabase const *)arg1)->add_spelling((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE _wrap_WritableDatabase_add_spelling(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[4];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 4) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__WritableDatabase, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_WritableDatabase_add_spelling__SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__WritableDatabase, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_WritableDatabase_add_spelling__SWIG_0(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 4, "WritableDatabase.add_spelling", 
    "    void WritableDatabase.add_spelling(std::string const &word, Xapian::termcount freqinc)\n"
    "    void WritableDatabase.add_spelling(std::string const &word)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WritableDatabase_remove_spelling__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase *arg1 = (Xapian::WritableDatabase *) 0 ;
  std::string *arg2 = 0 ;
  Xapian::termcount arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__WritableDatabase, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::WritableDatabase const *","remove_spelling", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::WritableDatabase * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","remove_spelling", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","remove_spelling", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::termcount","remove_spelling", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::termcount >(val3);
  {
    try {
      ((Xapian::WritableDatabase const *)arg1)->remove_spelling((std::string const &)*arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WritableDatabase_remove_spelling__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase *arg1 = (Xapian::WritableDatabase *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__WritableDatabase, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::WritableDatabase const *","remove_spelling", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::WritableDatabase * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","remove_spelling", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","remove_spelling", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      ((Xapian::WritableDatabase const *)arg1)->remove_spelling((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE _wrap_WritableDatabase_remove_spelling(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[4];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 4) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__WritableDatabase, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_WritableDatabase_remove_spelling__SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__WritableDatabase, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_WritableDatabase_remove_spelling__SWIG_0(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 4, "WritableDatabase.remove_spelling", 
    "    void WritableDatabase.remove_spelling(std::string const &word, Xapian::termcount freqdec)\n"
    "    void WritableDatabase.remove_spelling(std::string const &word)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WritableDatabase_add_synonym(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase *arg1 = (Xapian::WritableDatabase *) 0 ;
  std::string *arg2 = 0 ;
  std::string *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__WritableDatabase, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::WritableDatabase const *","add_synonym", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::WritableDatabase * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","add_synonym", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","add_synonym", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::string const &","add_synonym", 3, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","add_synonym", 3, argv[1])); 
    }
    arg3 = ptr;
  }
  {
    try {
      ((Xapian::WritableDatabase const *)arg1)->add_synonym((std::string const &)*arg2,(std::string const &)*arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WritableDatabase_remove_synonym(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase *arg1 = (Xapian::WritableDatabase *) 0 ;
  std::string *arg2 = 0 ;
  std::string *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__WritableDatabase, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::WritableDatabase const *","remove_synonym", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::WritableDatabase * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","remove_synonym", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","remove_synonym", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::string const &","remove_synonym", 3, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","remove_synonym", 3, argv[1])); 
    }
    arg3 = ptr;
  }
  {
    try {
      ((Xapian::WritableDatabase const *)arg1)->remove_synonym((std::string const &)*arg2,(std::string const &)*arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WritableDatabase_clear_synonyms(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase *arg1 = (Xapian::WritableDatabase *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__WritableDatabase, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::WritableDatabase const *","clear_synonyms", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::WritableDatabase * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","clear_synonyms", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","clear_synonyms", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      ((Xapian::WritableDatabase const *)arg1)->clear_synonyms((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WritableDatabase_set_metadata(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase *arg1 = (Xapian::WritableDatabase *) 0 ;
  std::string *arg2 = 0 ;
  std::string *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__WritableDatabase, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::WritableDatabase *","set_metadata", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::WritableDatabase * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","set_metadata", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","set_metadata", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::string const &","set_metadata", 3, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","set_metadata", 3, argv[1])); 
    }
    arg3 = ptr;
  }
  {
    try {
      (arg1)->set_metadata((std::string const &)*arg2,(std::string const &)*arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WritableDatabase_description(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase *arg1 = (Xapian::WritableDatabase *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__WritableDatabase, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::WritableDatabase const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::WritableDatabase * >(argp1);
  {
    try {
      result = ((Xapian::WritableDatabase const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_open_stub(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  Xapian::Database result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Auto::open_stub", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Auto::open_stub", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  {
    try {
      result = Xapian::Auto::open_stub((std::string const &)*arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::Database(static_cast< const Xapian::Database& >(result))), SWIGTYPE_p_Xapian__Database, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_brass_open__SWIG_0(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  Xapian::Database result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Brass::open", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Brass::open", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  {
    try {
      result = Xapian::Brass::open((std::string const &)*arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::Database(static_cast< const Xapian::Database& >(result))), SWIGTYPE_p_Xapian__Database, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_brass_open__SWIG_1(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  int arg2 ;
  int arg3 ;
  int res1 = SWIG_OLDOBJ ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  Xapian::WritableDatabase result;
  VALUE vresult = Qnil;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Brass::open", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Brass::open", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  ecode2 = SWIG_AsVal_int(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","Xapian::Brass::open", 2, argv[1] ));
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","Xapian::Brass::open", 3, argv[2] ));
  } 
  arg3 = static_cast< int >(val3);
  {
    try {
      result = Xapian::Brass::open((std::string const &)*arg1,arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::WritableDatabase(static_cast< const Xapian::WritableDatabase& >(result))), SWIGTYPE_p_Xapian__WritableDatabase, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_brass_open__SWIG_2(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  int arg2 ;
  int res1 = SWIG_OLDOBJ ;
  int val2 ;
  int ecode2 = 0 ;
  Xapian::WritableDatabase result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Brass::open", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Brass::open", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  ecode2 = SWIG_AsVal_int(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","Xapian::Brass::open", 2, argv[1] ));
  } 
  arg2 = static_cast< int >(val2);
  {
    try {
      result = Xapian::Brass::open((std::string const &)*arg1,arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::WritableDatabase(static_cast< const Xapian::WritableDatabase& >(result))), SWIGTYPE_p_Xapian__WritableDatabase, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE _wrap_brass_open(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs;
  if (argc > 3) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 1) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_brass_open__SWIG_0(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_brass_open__SWIG_2(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_brass_open__SWIG_1(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "brass_open", 
    "    Xapian::WritableDatabase brass_open(std::string const &dir)\n"
    "    Xapian::WritableDatabase brass_open(std::string const &dir, int action, int block_size)\n"
    "    Xapian::WritableDatabase brass_open(std::string const &dir, int action)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_chert_open__SWIG_0(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  Xapian::Database result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Chert::open", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Chert::open", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  {
    try {
      result = Xapian::Chert::open((std::string const &)*arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::Database(static_cast< const Xapian::Database& >(result))), SWIGTYPE_p_Xapian__Database, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_chert_open__SWIG_1(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  int arg2 ;
  int arg3 ;
  int res1 = SWIG_OLDOBJ ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  Xapian::WritableDatabase result;
  VALUE vresult = Qnil;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Chert::open", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Chert::open", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  ecode2 = SWIG_AsVal_int(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","Xapian::Chert::open", 2, argv[1] ));
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","Xapian::Chert::open", 3, argv[2] ));
  } 
  arg3 = static_cast< int >(val3);
  {
    try {
      result = Xapian::Chert::open((std::string const &)*arg1,arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::WritableDatabase(static_cast< const Xapian::WritableDatabase& >(result))), SWIGTYPE_p_Xapian__WritableDatabase, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_chert_open__SWIG_2(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  int arg2 ;
  int res1 = SWIG_OLDOBJ ;
  int val2 ;
  int ecode2 = 0 ;
  Xapian::WritableDatabase result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Chert::open", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Chert::open", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  ecode2 = SWIG_AsVal_int(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","Xapian::Chert::open", 2, argv[1] ));
  } 
  arg2 = static_cast< int >(val2);
  {
    try {
      result = Xapian::Chert::open((std::string const &)*arg1,arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::WritableDatabase(static_cast< const Xapian::WritableDatabase& >(result))), SWIGTYPE_p_Xapian__WritableDatabase, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE _wrap_chert_open(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs;
  if (argc > 3) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 1) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_chert_open__SWIG_0(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_chert_open__SWIG_2(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_chert_open__SWIG_1(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "chert_open", 
    "    Xapian::WritableDatabase chert_open(std::string const &dir)\n"
    "    Xapian::WritableDatabase chert_open(std::string const &dir, int action, int block_size)\n"
    "    Xapian::WritableDatabase chert_open(std::string const &dir, int action)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_flint_open__SWIG_0(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  Xapian::Database result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Flint::open", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Flint::open", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  {
    try {
      result = Xapian::Flint::open((std::string const &)*arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::Database(static_cast< const Xapian::Database& >(result))), SWIGTYPE_p_Xapian__Database, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_flint_open__SWIG_1(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  int arg2 ;
  int arg3 ;
  int res1 = SWIG_OLDOBJ ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  Xapian::WritableDatabase result;
  VALUE vresult = Qnil;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Flint::open", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Flint::open", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  ecode2 = SWIG_AsVal_int(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","Xapian::Flint::open", 2, argv[1] ));
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","Xapian::Flint::open", 3, argv[2] ));
  } 
  arg3 = static_cast< int >(val3);
  {
    try {
      result = Xapian::Flint::open((std::string const &)*arg1,arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::WritableDatabase(static_cast< const Xapian::WritableDatabase& >(result))), SWIGTYPE_p_Xapian__WritableDatabase, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_flint_open__SWIG_2(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  int arg2 ;
  int res1 = SWIG_OLDOBJ ;
  int val2 ;
  int ecode2 = 0 ;
  Xapian::WritableDatabase result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Flint::open", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Flint::open", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  ecode2 = SWIG_AsVal_int(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","Xapian::Flint::open", 2, argv[1] ));
  } 
  arg2 = static_cast< int >(val2);
  {
    try {
      result = Xapian::Flint::open((std::string const &)*arg1,arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::WritableDatabase(static_cast< const Xapian::WritableDatabase& >(result))), SWIGTYPE_p_Xapian__WritableDatabase, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE _wrap_flint_open(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs;
  if (argc > 3) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 1) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_flint_open__SWIG_0(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_flint_open__SWIG_2(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_flint_open__SWIG_1(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "flint_open", 
    "    Xapian::WritableDatabase flint_open(std::string const &dir)\n"
    "    Xapian::WritableDatabase flint_open(std::string const &dir, int action, int block_size)\n"
    "    Xapian::WritableDatabase flint_open(std::string const &dir, int action)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_inmemory_open(int argc, VALUE *argv, VALUE self) {
  Xapian::WritableDatabase result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = Xapian::InMemory::open();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::WritableDatabase(static_cast< const Xapian::WritableDatabase& >(result))), SWIGTYPE_p_Xapian__WritableDatabase, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_remote_open__SWIG_0(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  unsigned int arg2 ;
  Xapian::timeout arg3 ;
  Xapian::timeout arg4 ;
  int res1 = SWIG_OLDOBJ ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  Xapian::Database result;
  VALUE vresult = Qnil;
  
  if ((argc < 4) || (argc > 4)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Remote::open", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Remote::open", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","Xapian::Remote::open", 2, argv[1] ));
  } 
  arg2 = static_cast< unsigned int >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::timeout","Xapian::Remote::open", 3, argv[2] ));
  } 
  arg3 = static_cast< Xapian::timeout >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(argv[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "Xapian::timeout","Xapian::Remote::open", 4, argv[3] ));
  } 
  arg4 = static_cast< Xapian::timeout >(val4);
  {
    try {
      result = Xapian::Remote::open((std::string const &)*arg1,arg2,arg3,arg4);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::Database(static_cast< const Xapian::Database& >(result))), SWIGTYPE_p_Xapian__Database, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_remote_open__SWIG_1(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  unsigned int arg2 ;
  Xapian::timeout arg3 ;
  int res1 = SWIG_OLDOBJ ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  Xapian::Database result;
  VALUE vresult = Qnil;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Remote::open", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Remote::open", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","Xapian::Remote::open", 2, argv[1] ));
  } 
  arg2 = static_cast< unsigned int >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::timeout","Xapian::Remote::open", 3, argv[2] ));
  } 
  arg3 = static_cast< Xapian::timeout >(val3);
  {
    try {
      result = Xapian::Remote::open((std::string const &)*arg1,arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::Database(static_cast< const Xapian::Database& >(result))), SWIGTYPE_p_Xapian__Database, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_remote_open__SWIG_2(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  unsigned int arg2 ;
  int res1 = SWIG_OLDOBJ ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  Xapian::Database result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Remote::open", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Remote::open", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","Xapian::Remote::open", 2, argv[1] ));
  } 
  arg2 = static_cast< unsigned int >(val2);
  {
    try {
      result = Xapian::Remote::open((std::string const &)*arg1,arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::Database(static_cast< const Xapian::Database& >(result))), SWIGTYPE_p_Xapian__Database, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_remote_open_writable__SWIG_0(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  unsigned int arg2 ;
  Xapian::timeout arg3 ;
  Xapian::timeout arg4 ;
  int res1 = SWIG_OLDOBJ ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  unsigned int val4 ;
  int ecode4 = 0 ;
  Xapian::WritableDatabase result;
  VALUE vresult = Qnil;
  
  if ((argc < 4) || (argc > 4)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Remote::open_writable", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Remote::open_writable", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","Xapian::Remote::open_writable", 2, argv[1] ));
  } 
  arg2 = static_cast< unsigned int >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::timeout","Xapian::Remote::open_writable", 3, argv[2] ));
  } 
  arg3 = static_cast< Xapian::timeout >(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_int(argv[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "Xapian::timeout","Xapian::Remote::open_writable", 4, argv[3] ));
  } 
  arg4 = static_cast< Xapian::timeout >(val4);
  {
    try {
      result = Xapian::Remote::open_writable((std::string const &)*arg1,arg2,arg3,arg4);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::WritableDatabase(static_cast< const Xapian::WritableDatabase& >(result))), SWIGTYPE_p_Xapian__WritableDatabase, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_remote_open_writable__SWIG_1(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  unsigned int arg2 ;
  Xapian::timeout arg3 ;
  int res1 = SWIG_OLDOBJ ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  Xapian::WritableDatabase result;
  VALUE vresult = Qnil;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Remote::open_writable", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Remote::open_writable", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","Xapian::Remote::open_writable", 2, argv[1] ));
  } 
  arg2 = static_cast< unsigned int >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::timeout","Xapian::Remote::open_writable", 3, argv[2] ));
  } 
  arg3 = static_cast< Xapian::timeout >(val3);
  {
    try {
      result = Xapian::Remote::open_writable((std::string const &)*arg1,arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::WritableDatabase(static_cast< const Xapian::WritableDatabase& >(result))), SWIGTYPE_p_Xapian__WritableDatabase, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_remote_open_writable__SWIG_2(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  unsigned int arg2 ;
  int res1 = SWIG_OLDOBJ ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  Xapian::WritableDatabase result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Remote::open_writable", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Remote::open_writable", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","Xapian::Remote::open_writable", 2, argv[1] ));
  } 
  arg2 = static_cast< unsigned int >(val2);
  {
    try {
      result = Xapian::Remote::open_writable((std::string const &)*arg1,arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::WritableDatabase(static_cast< const Xapian::WritableDatabase& >(result))), SWIGTYPE_p_Xapian__WritableDatabase, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_remote_open__SWIG_3(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  std::string *arg2 = 0 ;
  Xapian::timeout arg3 ;
  int res1 = SWIG_OLDOBJ ;
  int res2 = SWIG_OLDOBJ ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  Xapian::Database result;
  VALUE vresult = Qnil;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Remote::open", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Remote::open", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","Xapian::Remote::open", 2, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Remote::open", 2, argv[1])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::timeout","Xapian::Remote::open", 3, argv[2] ));
  } 
  arg3 = static_cast< Xapian::timeout >(val3);
  {
    try {
      result = Xapian::Remote::open((std::string const &)*arg1,(std::string const &)*arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::Database(static_cast< const Xapian::Database& >(result))), SWIGTYPE_p_Xapian__Database, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_remote_open__SWIG_4(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  std::string *arg2 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  int res2 = SWIG_OLDOBJ ;
  Xapian::Database result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Remote::open", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Remote::open", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","Xapian::Remote::open", 2, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Remote::open", 2, argv[1])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = Xapian::Remote::open((std::string const &)*arg1,(std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::Database(static_cast< const Xapian::Database& >(result))), SWIGTYPE_p_Xapian__Database, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE _wrap_remote_open(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[4];
  int ii;
  
  argc = nargs;
  if (argc > 4) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 2) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_remote_open__SWIG_2(nargs, args, self);
      }
    }
  }
  if (argc == 2) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_remote_open__SWIG_4(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_remote_open__SWIG_1(nargs, args, self);
        }
      }
    }
  }
  if (argc == 3) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_remote_open__SWIG_3(nargs, args, self);
        }
      }
    }
  }
  if (argc == 4) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          {
            int res = SWIG_AsVal_unsigned_SS_int(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
          if (_v) {
            return _wrap_remote_open__SWIG_0(nargs, args, self);
          }
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 4, "remote_open", 
    "    Xapian::Database remote_open(std::string const &host, unsigned int port, Xapian::timeout timeout, Xapian::timeout connect_timeout)\n"
    "    Xapian::Database remote_open(std::string const &host, unsigned int port, Xapian::timeout timeout)\n"
    "    Xapian::Database remote_open(std::string const &host, unsigned int port)\n"
    "    Xapian::Database remote_open(std::string const &program, std::string const &args, Xapian::timeout timeout)\n"
    "    Xapian::Database remote_open(std::string const &program, std::string const &args)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_remote_open_writable__SWIG_3(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  std::string *arg2 = 0 ;
  Xapian::timeout arg3 ;
  int res1 = SWIG_OLDOBJ ;
  int res2 = SWIG_OLDOBJ ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  Xapian::WritableDatabase result;
  VALUE vresult = Qnil;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Remote::open_writable", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Remote::open_writable", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","Xapian::Remote::open_writable", 2, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Remote::open_writable", 2, argv[1])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::timeout","Xapian::Remote::open_writable", 3, argv[2] ));
  } 
  arg3 = static_cast< Xapian::timeout >(val3);
  {
    try {
      result = Xapian::Remote::open_writable((std::string const &)*arg1,(std::string const &)*arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::WritableDatabase(static_cast< const Xapian::WritableDatabase& >(result))), SWIGTYPE_p_Xapian__WritableDatabase, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_remote_open_writable__SWIG_4(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  std::string *arg2 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  int res2 = SWIG_OLDOBJ ;
  Xapian::WritableDatabase result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Remote::open_writable", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Remote::open_writable", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","Xapian::Remote::open_writable", 2, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Remote::open_writable", 2, argv[1])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = Xapian::Remote::open_writable((std::string const &)*arg1,(std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::WritableDatabase(static_cast< const Xapian::WritableDatabase& >(result))), SWIGTYPE_p_Xapian__WritableDatabase, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE _wrap_remote_open_writable(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[4];
  int ii;
  
  argc = nargs;
  if (argc > 4) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 2) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_remote_open_writable__SWIG_2(nargs, args, self);
      }
    }
  }
  if (argc == 2) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_remote_open_writable__SWIG_4(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_remote_open_writable__SWIG_1(nargs, args, self);
        }
      }
    }
  }
  if (argc == 3) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_remote_open_writable__SWIG_3(nargs, args, self);
        }
      }
    }
  }
  if (argc == 4) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          {
            int res = SWIG_AsVal_unsigned_SS_int(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
          if (_v) {
            return _wrap_remote_open_writable__SWIG_0(nargs, args, self);
          }
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 4, "remote_open_writable", 
    "    Xapian::WritableDatabase remote_open_writable(std::string const &host, unsigned int port, Xapian::timeout timeout, Xapian::timeout connect_timeout)\n"
    "    Xapian::WritableDatabase remote_open_writable(std::string const &host, unsigned int port, Xapian::timeout timeout)\n"
    "    Xapian::WritableDatabase remote_open_writable(std::string const &host, unsigned int port)\n"
    "    Xapian::WritableDatabase remote_open_writable(std::string const &program, std::string const &args, Xapian::timeout timeout)\n"
    "    Xapian::WritableDatabase remote_open_writable(std::string const &program, std::string const &args)\n");
  
  return Qnil;
}


swig_class SwigClassQuery;

SWIGINTERN VALUE
_wrap_new_Query__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::Query *arg1 = 0 ;
  void *argp1 ;
  int res1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::Query";
  Xapian::Query *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_Xapian__Query,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Query const &","Xapian::Query", 1, argv[0] )); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Query const &","Xapian::Query", 1, argv[0])); 
  }
  arg1 = reinterpret_cast< Xapian::Query * >(argp1);
  {
    try {
      result = (Xapian::Query *)new Xapian::Query((Xapian::Query const &)*arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_new_Query__SWIG_1(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::Query";
  Xapian::Query *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::Query *)new Xapian::Query();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_Query(Xapian::Query *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_new_Query__SWIG_2(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  Xapian::termcount arg2 ;
  Xapian::termpos arg3 ;
  int res1 = SWIG_OLDOBJ ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::Query";
  Xapian::Query *result = 0 ;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Query", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Query", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::termcount","Xapian::Query", 2, argv[1] ));
  } 
  arg2 = static_cast< Xapian::termcount >(val2);
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::termpos","Xapian::Query", 3, argv[2] ));
  } 
  arg3 = static_cast< Xapian::termpos >(val3);
  {
    try {
      result = (Xapian::Query *)new Xapian::Query((std::string const &)*arg1,arg2,arg3);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res1)) delete arg1;
  return self;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_new_Query__SWIG_3(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  Xapian::termcount arg2 ;
  int res1 = SWIG_OLDOBJ ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::Query";
  Xapian::Query *result = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Query", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Query", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::termcount","Xapian::Query", 2, argv[1] ));
  } 
  arg2 = static_cast< Xapian::termcount >(val2);
  {
    try {
      result = (Xapian::Query *)new Xapian::Query((std::string const &)*arg1,arg2);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res1)) delete arg1;
  return self;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_new_Query__SWIG_4(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  const char *classname SWIGUNUSED = "Xapian::Query";
  Xapian::Query *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Query", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Query", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  {
    try {
      result = (Xapian::Query *)new Xapian::Query((std::string const &)*arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res1)) delete arg1;
  return self;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_new_Query__SWIG_5(int argc, VALUE *argv, VALUE self) {
  Xapian::Query::op arg1 ;
  Xapian::Query *arg2 = 0 ;
  Xapian::Query *arg3 = 0 ;
  int val1 ;
  int ecode1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  void *argp3 ;
  int res3 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::Query";
  Xapian::Query *result = 0 ;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::Query::op","Xapian::Query", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::Query::op >(val1);
  res2 = SWIG_ConvertPtr(argv[1], &argp2, SWIGTYPE_p_Xapian__Query,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Query const &","Xapian::Query", 2, argv[1] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Query const &","Xapian::Query", 2, argv[1])); 
  }
  arg2 = reinterpret_cast< Xapian::Query * >(argp2);
  res3 = SWIG_ConvertPtr(argv[2], &argp3, SWIGTYPE_p_Xapian__Query,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "Xapian::Query const &","Xapian::Query", 3, argv[2] )); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Query const &","Xapian::Query", 3, argv[2])); 
  }
  arg3 = reinterpret_cast< Xapian::Query * >(argp3);
  {
    try {
      result = (Xapian::Query *)new Xapian::Query(arg1,(Xapian::Query const &)*arg2,(Xapian::Query const &)*arg3);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_new_Query__SWIG_6(int argc, VALUE *argv, VALUE self) {
  Xapian::Query::op arg1 ;
  std::string *arg2 = 0 ;
  std::string *arg3 = 0 ;
  int val1 ;
  int ecode1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  int res3 = SWIG_OLDOBJ ;
  const char *classname SWIGUNUSED = "Xapian::Query";
  Xapian::Query *result = 0 ;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::Query::op","Xapian::Query", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::Query::op >(val1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","Xapian::Query", 2, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Query", 2, argv[1])); 
    }
    arg2 = ptr;
  }
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(argv[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::string const &","Xapian::Query", 3, argv[2] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Query", 3, argv[2])); 
    }
    arg3 = ptr;
  }
  {
    try {
      result = (Xapian::Query *)new Xapian::Query(arg1,(std::string const &)*arg2,(std::string const &)*arg3);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return self;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_new_Query__SWIG_9(int argc, VALUE *argv, VALUE self) {
  Xapian::Query::op arg1 ;
  Xapian::Query arg2 ;
  double arg3 ;
  int val1 ;
  int ecode1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::Query";
  Xapian::Query *result = 0 ;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::Query::op","Xapian::Query", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::Query::op >(val1);
  {
    res2 = SWIG_ConvertPtr(argv[1], &argp2, SWIGTYPE_p_Xapian__Query,  0 );
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Query","Xapian::Query", 2, argv[1] )); 
    }  
    if (!argp2) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Query","Xapian::Query", 2, argv[1]));
    } else {
      arg2 = *(reinterpret_cast< Xapian::Query * >(argp2));
    }
  }
  ecode3 = SWIG_AsVal_double(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","Xapian::Query", 3, argv[2] ));
  } 
  arg3 = static_cast< double >(val3);
  {
    try {
      result = (Xapian::Query *)new Xapian::Query(arg1,arg2,arg3);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_new_Query__SWIG_10(int argc, VALUE *argv, VALUE self) {
  Xapian::Query::op arg1 ;
  Xapian::valueno arg2 ;
  std::string *arg3 = 0 ;
  std::string *arg4 = 0 ;
  int val1 ;
  int ecode1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  int res4 = SWIG_OLDOBJ ;
  const char *classname SWIGUNUSED = "Xapian::Query";
  Xapian::Query *result = 0 ;
  
  if ((argc < 4) || (argc > 4)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::Query::op","Xapian::Query", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::Query::op >(val1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::Query", 2, argv[1] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(argv[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::string const &","Xapian::Query", 3, argv[2] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Query", 3, argv[2])); 
    }
    arg3 = ptr;
  }
  {
    std::string *ptr = (std::string *)0;
    res4 = SWIG_AsPtr_std_string(argv[3], &ptr);
    if (!SWIG_IsOK(res4)) {
      SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "std::string const &","Xapian::Query", 4, argv[3] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Query", 4, argv[3])); 
    }
    arg4 = ptr;
  }
  {
    try {
      result = (Xapian::Query *)new Xapian::Query(arg1,arg2,(std::string const &)*arg3,(std::string const &)*arg4);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res3)) delete arg3;
  if (SWIG_IsNewObj(res4)) delete arg4;
  return self;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  if (SWIG_IsNewObj(res4)) delete arg4;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_new_Query__SWIG_11(int argc, VALUE *argv, VALUE self) {
  Xapian::Query::op arg1 ;
  Xapian::valueno arg2 ;
  std::string *arg3 = 0 ;
  int val1 ;
  int ecode1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  const char *classname SWIGUNUSED = "Xapian::Query";
  Xapian::Query *result = 0 ;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::Query::op","Xapian::Query", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::Query::op >(val1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::Query", 2, argv[1] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(argv[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::string const &","Xapian::Query", 3, argv[2] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Query", 3, argv[2])); 
    }
    arg3 = ptr;
  }
  {
    try {
      result = (Xapian::Query *)new Xapian::Query(arg1,arg2,(std::string const &)*arg3);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res3)) delete arg3;
  return self;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_new_Query__SWIG_12(int argc, VALUE *argv, VALUE self) {
  Xapian::PostingSource *arg1 = (Xapian::PostingSource *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::Query";
  Xapian::Query *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_Xapian__PostingSource, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::PostingSource *","Xapian::Query", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< Xapian::PostingSource * >(argp1);
  {
    try {
      result = (Xapian::Query *)new Xapian::Query(arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Query_length(int argc, VALUE *argv, VALUE self) {
  Xapian::Query *arg1 = (Xapian::Query *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::termcount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Query, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Query const *","get_length", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Query * >(argp1);
  {
    try {
      result = (Xapian::termcount)((Xapian::Query const *)arg1)->get_length();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Query__dangerous_terms_begin(int argc, VALUE *argv, VALUE self) {
  Xapian::Query *arg1 = (Xapian::Query *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Query, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Query const *","get_terms_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Query * >(argp1);
  {
    try {
      result = ((Xapian::Query const *)arg1)->get_terms_begin();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Query__dangerous_terms_end(int argc, VALUE *argv, VALUE self) {
  Xapian::Query *arg1 = (Xapian::Query *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Query, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Query const *","get_terms_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Query * >(argp1);
  {
    try {
      result = ((Xapian::Query const *)arg1)->get_terms_end();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}



/*
  Document-method: Xapian::Query.empty

  call-seq:
    empty -> bool

Check if the Query is empty or not.
*/
SWIGINTERN VALUE
_wrap_Query_emptyq___(int argc, VALUE *argv, VALUE self) {
  Xapian::Query *arg1 = (Xapian::Query *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Query, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Query const *","empty", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Query * >(argp1);
  {
    try {
      result = (bool)((Xapian::Query const *)arg1)->empty();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = (result ? Qtrue : Qfalse);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Query_serialise(int argc, VALUE *argv, VALUE self) {
  Xapian::Query *arg1 = (Xapian::Query *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Query, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Query const *","serialise", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Query * >(argp1);
  {
    try {
      result = ((Xapian::Query const *)arg1)->serialise();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Query_unserialise__SWIG_0(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  Xapian::Query result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Query::unserialise", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Query::unserialise", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  {
    try {
      result = Xapian::Query::unserialise((std::string const &)*arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::Query(static_cast< const Xapian::Query& >(result))), SWIGTYPE_p_Xapian__Query, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Query_unserialise__SWIG_1(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  Xapian::Registry *arg2 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  void *argp2 ;
  int res2 = 0 ;
  Xapian::Query result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Query::unserialise", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Query::unserialise", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  res2 = SWIG_ConvertPtr(argv[1], &argp2, SWIGTYPE_p_Xapian__Registry,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Registry const &","Xapian::Query::unserialise", 2, argv[1] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Registry const &","Xapian::Query::unserialise", 2, argv[1])); 
  }
  arg2 = reinterpret_cast< Xapian::Registry * >(argp2);
  {
    try {
      result = Xapian::Query::unserialise((std::string const &)*arg1,(Xapian::Registry const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::Query(static_cast< const Xapian::Query& >(result))), SWIGTYPE_p_Xapian__Query, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


SWIGINTERN VALUE _wrap_Query_unserialise(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[2];
  int ii;
  
  argc = nargs;
  if (argc > 2) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 1) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_Query_unserialise__SWIG_0(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Xapian__Registry, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_Query_unserialise__SWIG_1(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 2, "Query.unserialise", 
    "    Xapian::Query Query.unserialise(std::string const &s)\n"
    "    Xapian::Query Query.unserialise(std::string const &s, Xapian::Registry const &registry)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Query_description(int argc, VALUE *argv, VALUE self) {
  Xapian::Query *arg1 = (Xapian::Query *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Query, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Query const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Query * >(argp1);
  {
    try {
      result = ((Xapian::Query const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_new_Query__SWIG_13(int argc, VALUE *argv, VALUE self) {
  Xapian::Query::op arg1 ;
  std::vector< Xapian::Query > *arg2 = 0 ;
  Xapian::termcount arg3 ;
  int val1 ;
  int ecode1 = 0 ;
  vector< Xapian::Query > v2 ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::Query";
  Xapian::Query *result = 0 ;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::Query::op","Xapian::Query", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::Query::op >(val1);
  {
    if (TYPE(argv[1]) != T_ARRAY) {
      SWIG_exception(SWIG_ValueError, "expected array of queries");
    }
    
    int numitems = RARRAY_LEN(argv[1]);
    v2.reserve(numitems);
    for (int i = 0; i < numitems; ++i) {
      VALUE arrayEntry = rb_ary_entry(argv[1], i);
      if (TYPE(arrayEntry) == T_STRING) {
        v2.push_back(Xapian::Query(string(RSTRING_PTR(arrayEntry),
              RSTRING_LEN(arrayEntry))));
      }
      else {
        // array element may be a Xapian::Query object. Add it if it is,
        // otherwise error out.
        Xapian::Query *subq = 0;
        if (SWIG_ConvertPtr(arrayEntry, (void **)&subq,
            SWIGTYPE_p_Xapian__Query, 0) < 0) {
          subq = 0;
        }
        if (!subq) {
          SWIG_exception(SWIG_ValueError, "elements of Arrays passed to Query must be either Strings or other Queries");
        }
        v2.push_back(*subq);            
      }
      
    }       
    
    arg2 = &v2;
  }
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::termcount","Xapian::Query", 3, argv[2] ));
  } 
  arg3 = static_cast< Xapian::termcount >(val3);
  {
    try {
      result = (Xapian::Query *)new_Xapian_Query__SWIG_13(arg1,(std::vector< Xapian::Query > const &)*arg2,arg3);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_Query_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_Query_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__Query);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_Query__SWIG_14(int argc, VALUE *argv, VALUE self) {
  Xapian::Query::op arg1 ;
  std::vector< Xapian::Query > *arg2 = 0 ;
  int val1 ;
  int ecode1 = 0 ;
  vector< Xapian::Query > v2 ;
  const char *classname SWIGUNUSED = "Xapian::Query";
  Xapian::Query *result = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::Query::op","Xapian::Query", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::Query::op >(val1);
  {
    if (TYPE(argv[1]) != T_ARRAY) {
      SWIG_exception(SWIG_ValueError, "expected array of queries");
    }
    
    int numitems = RARRAY_LEN(argv[1]);
    v2.reserve(numitems);
    for (int i = 0; i < numitems; ++i) {
      VALUE arrayEntry = rb_ary_entry(argv[1], i);
      if (TYPE(arrayEntry) == T_STRING) {
        v2.push_back(Xapian::Query(string(RSTRING_PTR(arrayEntry),
              RSTRING_LEN(arrayEntry))));
      }
      else {
        // array element may be a Xapian::Query object. Add it if it is,
        // otherwise error out.
        Xapian::Query *subq = 0;
        if (SWIG_ConvertPtr(arrayEntry, (void **)&subq,
            SWIGTYPE_p_Xapian__Query, 0) < 0) {
          subq = 0;
        }
        if (!subq) {
          SWIG_exception(SWIG_ValueError, "elements of Arrays passed to Query must be either Strings or other Queries");
        }
        v2.push_back(*subq);            
      }
      
    }       
    
    arg2 = &v2;
  }
  {
    try {
      result = (Xapian::Query *)new_Xapian_Query__SWIG_13(arg1,(std::vector< Xapian::Query > const &)*arg2);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_Query(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[4];
  int ii;
  
  argc = nargs;
  if (argc > 4) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 0) {
    return _wrap_new_Query__SWIG_1(nargs, args, self);
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__Query, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_new_Query__SWIG_0(nargs, args, self);
    }
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__PostingSource, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_new_Query__SWIG_12(nargs, args, self);
    }
  }
  if (argc == 1) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_new_Query__SWIG_4(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    {
      int res = SWIG_AsVal_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      {
        _v = (TYPE(argv[1]) == T_ARRAY);
        
        /* Says Olly:
             * Currently, the only wrapped method which takes a Ruby array is the
             * "extra" constructor Query(OP, ARRAY), where ARRAY can contain any mix of
             * strings and Query objects.
             *
             * If we ever had a method (or function) which had two overloaded forms
             * only differentiated by what type of array can be passed we'd need to
             * look at the type of the array element in the typecheck typemaps.
             */
      }
      if (_v) {
        return _wrap_new_Query__SWIG_14(nargs, args, self);
      }
    }
  }
  if (argc == 2) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_new_Query__SWIG_3(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    {
      int res = SWIG_AsVal_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Xapian__Query, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_Xapian__Query, 0);
        _v = SWIG_CheckState(res);
        if (_v) {
          return _wrap_new_Query__SWIG_5(nargs, args, self);
        }
      }
    }
  }
  if (argc == 3) {
    int _v;
    {
      int res = SWIG_AsVal_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Xapian__Query, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_double(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_new_Query__SWIG_9(nargs, args, self);
        }
      }
    }
  }
  if (argc == 3) {
    int _v;
    {
      int res = SWIG_AsVal_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0));
        _v = SWIG_CheckState(res);
        if (_v) {
          return _wrap_new_Query__SWIG_11(nargs, args, self);
        }
      }
    }
  }
  if (argc == 3) {
    int _v;
    {
      int res = SWIG_AsVal_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0));
        _v = SWIG_CheckState(res);
        if (_v) {
          return _wrap_new_Query__SWIG_6(nargs, args, self);
        }
      }
    }
  }
  if (argc == 3) {
    int _v;
    {
      int res = SWIG_AsVal_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      {
        _v = (TYPE(argv[1]) == T_ARRAY);
        
        /* Says Olly:
             * Currently, the only wrapped method which takes a Ruby array is the
             * "extra" constructor Query(OP, ARRAY), where ARRAY can contain any mix of
             * strings and Query objects.
             *
             * If we ever had a method (or function) which had two overloaded forms
             * only differentiated by what type of array can be passed we'd need to
             * look at the type of the array element in the typecheck typemaps.
             */
      }
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_new_Query__SWIG_13(nargs, args, self);
        }
      }
    }
  }
  if (argc == 3) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_new_Query__SWIG_2(nargs, args, self);
        }
      }
    }
  }
  if (argc == 4) {
    int _v;
    {
      int res = SWIG_AsVal_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0));
        _v = SWIG_CheckState(res);
        if (_v) {
          int res = SWIG_AsPtr_std_string(argv[3], (std::string**)(0));
          _v = SWIG_CheckState(res);
          if (_v) {
            return _wrap_new_Query__SWIG_10(nargs, args, self);
          }
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 4, "Query.new", 
    "    Query.new(Xapian::Query const &copyme)\n"
    "    Query.new()\n"
    "    Query.new(std::string const &tname_, Xapian::termcount wqf_, Xapian::termpos pos_)\n"
    "    Query.new(std::string const &tname_, Xapian::termcount wqf_)\n"
    "    Query.new(std::string const &tname_)\n"
    "    Query.new(Xapian::Query::op op_, Xapian::Query const &left, Xapian::Query const &right)\n"
    "    Query.new(Xapian::Query::op op_, std::string const &left, std::string const &right)\n"
    "    Query.new(Xapian::Query::op op_, Xapian::Query q, double parameter)\n"
    "    Query.new(Xapian::Query::op op_, Xapian::valueno slot, std::string const &begin, std::string const &end)\n"
    "    Query.new(Xapian::Query::op op_, Xapian::valueno slot, std::string const &value)\n"
    "    Query.new(Xapian::PostingSource *external_source)\n"
    "    Query.new(Xapian::Query::op op, std::vector< Xapian::Query > const &subqs, Xapian::termcount param)\n"
    "    Query.new(Xapian::Query::op op, std::vector< Xapian::Query > const &subqs)\n");
  
  return Qnil;
}


swig_class SwigClassStopper;

SWIGINTERN VALUE
_wrap_Stopper___call__(int argc, VALUE *argv, VALUE self) {
  Xapian::Stopper *arg1 = (Xapian::Stopper *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Swig::Director *director = 0;
  bool upcall = false;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Stopper, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Stopper const *","operator ()", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Stopper * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","operator ()", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","operator ()", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          Swig::DirectorPureVirtualException::raise("Xapian::Stopper::operator ()");
        } else {
          result = (bool)((Xapian::Stopper const *)arg1)->operator ()((std::string const &)*arg2);
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN void
free_Xapian_Stopper(Xapian::Stopper *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_Stopper_description(int argc, VALUE *argv, VALUE self) {
  Xapian::Stopper *arg1 = (Xapian::Stopper *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Swig::Director *director = 0;
  bool upcall = false;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Stopper, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Stopper const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Stopper * >(argp1);
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          result = ((Xapian::Stopper const *)arg1)->Xapian::Stopper::get_description();
        } else {
          result = ((Xapian::Stopper const *)arg1)->get_description();
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_Stopper_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_Stopper_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__Stopper);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_Stopper(int argc, VALUE *argv, VALUE self) {
  VALUE arg1 = (VALUE) 0 ;
  const char *classname SWIGUNUSED = "Xapian::Stopper";
  Xapian::Stopper *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  arg1 = self;
  {
    try {
      if ( strcmp(rb_obj_classname(self), classname) != 0 ) {
        /* subclassed */
        result = (Xapian::Stopper *)new SwigDirector_Stopper(arg1); 
      } else {
        rb_raise(rb_eNameError,"accessing abstract class or protected constructor"); 
        return Qnil;
      }
      
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_disown_Stopper(int argc, VALUE *argv, VALUE self) {
  Xapian::Stopper *arg1 = (Xapian::Stopper *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_Xapian__Stopper, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Stopper *","disown_Stopper", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< Xapian::Stopper * >(argp1);
  {
    Swig::Director *director = SWIG_DIRECTOR_CAST(arg1);
    if (director) director->swig_disown();
  }
  
  return Qnil;
fail:
  return Qnil;
}


swig_class SwigClassSimpleStopper;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_SimpleStopper_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_SimpleStopper_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__SimpleStopper);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_SimpleStopper(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::SimpleStopper";
  Xapian::SimpleStopper *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::SimpleStopper *)new Xapian::SimpleStopper();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_SimpleStopper_add(int argc, VALUE *argv, VALUE self) {
  Xapian::SimpleStopper *arg1 = (Xapian::SimpleStopper *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__SimpleStopper, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::SimpleStopper *","add", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::SimpleStopper * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","add", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","add", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      (arg1)->add((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_SimpleStopper___call__(int argc, VALUE *argv, VALUE self) {
  Xapian::SimpleStopper *arg1 = (Xapian::SimpleStopper *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__SimpleStopper, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::SimpleStopper const *","operator ()", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::SimpleStopper * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","operator ()", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","operator ()", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = (bool)((Xapian::SimpleStopper const *)arg1)->operator ()((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_SimpleStopper_description(int argc, VALUE *argv, VALUE self) {
  Xapian::SimpleStopper *arg1 = (Xapian::SimpleStopper *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__SimpleStopper, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::SimpleStopper const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::SimpleStopper * >(argp1);
  {
    try {
      result = ((Xapian::SimpleStopper const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_SimpleStopper(Xapian::SimpleStopper *arg1) {
    delete arg1;
}

swig_class SwigClassValueRangeProcessor;

SWIGINTERN void
free_Xapian_ValueRangeProcessor(Xapian::ValueRangeProcessor *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_ValueRangeProcessor___call__(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueRangeProcessor *arg1 = (Xapian::ValueRangeProcessor *) 0 ;
  std::string *arg2 = 0 ;
  std::string *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  Swig::Director *director = 0;
  bool upcall = false;
  Xapian::valueno result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueRangeProcessor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueRangeProcessor *","operator ()", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueRangeProcessor * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__string,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string &","operator ()", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string &","operator ()", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< std::string * >(argp2);
  res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_std__string,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::string &","operator ()", 3, argv[1] )); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string &","operator ()", 3, argv[1])); 
  }
  arg3 = reinterpret_cast< std::string * >(argp3);
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          Swig::DirectorPureVirtualException::raise("Xapian::ValueRangeProcessor::operator ()");
        } else {
          result = (Xapian::valueno)(arg1)->operator ()(*arg2,*arg3);
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_ValueRangeProcessor_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_ValueRangeProcessor_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__ValueRangeProcessor);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_ValueRangeProcessor(int argc, VALUE *argv, VALUE self) {
  VALUE arg1 = (VALUE) 0 ;
  const char *classname SWIGUNUSED = "Xapian::ValueRangeProcessor";
  Xapian::ValueRangeProcessor *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  arg1 = self;
  {
    try {
      if ( strcmp(rb_obj_classname(self), classname) != 0 ) {
        /* subclassed */
        result = (Xapian::ValueRangeProcessor *)new SwigDirector_ValueRangeProcessor(arg1); 
      } else {
        rb_raise(rb_eNameError,"accessing abstract class or protected constructor"); 
        return Qnil;
      }
      
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_disown_ValueRangeProcessor(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueRangeProcessor *arg1 = (Xapian::ValueRangeProcessor *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_Xapian__ValueRangeProcessor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueRangeProcessor *","disown_ValueRangeProcessor", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueRangeProcessor * >(argp1);
  {
    Swig::Director *director = SWIG_DIRECTOR_CAST(arg1);
    if (director) director->swig_disown();
  }
  
  return Qnil;
fail:
  return Qnil;
}


swig_class SwigClassStringValueRangeProcessor;

SWIGINTERN VALUE
_wrap_new_StringValueRangeProcessor__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::valueno arg1 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::StringValueRangeProcessor";
  Xapian::StringValueRangeProcessor *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::StringValueRangeProcessor", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::valueno >(val1);
  {
    try {
      result = (Xapian::StringValueRangeProcessor *)new Xapian::StringValueRangeProcessor(arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_new_StringValueRangeProcessor__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::valueno arg1 ;
  std::string *arg2 = 0 ;
  bool arg3 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  bool val3 ;
  int ecode3 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::StringValueRangeProcessor";
  Xapian::StringValueRangeProcessor *result = 0 ;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::StringValueRangeProcessor", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::valueno >(val1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","Xapian::StringValueRangeProcessor", 2, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::StringValueRangeProcessor", 2, argv[1])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_bool(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","Xapian::StringValueRangeProcessor", 3, argv[2] ));
  } 
  arg3 = static_cast< bool >(val3);
  {
    try {
      result = (Xapian::StringValueRangeProcessor *)new Xapian::StringValueRangeProcessor(arg1,(std::string const &)*arg2,arg3);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return self;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_StringValueRangeProcessor_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_StringValueRangeProcessor_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__StringValueRangeProcessor);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_StringValueRangeProcessor__SWIG_2(int argc, VALUE *argv, VALUE self) {
  Xapian::valueno arg1 ;
  std::string *arg2 = 0 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  const char *classname SWIGUNUSED = "Xapian::StringValueRangeProcessor";
  Xapian::StringValueRangeProcessor *result = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::StringValueRangeProcessor", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::valueno >(val1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","Xapian::StringValueRangeProcessor", 2, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::StringValueRangeProcessor", 2, argv[1])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = (Xapian::StringValueRangeProcessor *)new Xapian::StringValueRangeProcessor(arg1,(std::string const &)*arg2);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return self;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_StringValueRangeProcessor(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs;
  if (argc > 3) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 1) {
    int _v;
    {
      int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      return _wrap_new_StringValueRangeProcessor__SWIG_0(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    {
      int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_new_StringValueRangeProcessor__SWIG_2(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    {
      int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_bool(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_new_StringValueRangeProcessor__SWIG_1(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "StringValueRangeProcessor.new", 
    "    StringValueRangeProcessor.new(Xapian::valueno slot_)\n"
    "    StringValueRangeProcessor.new(Xapian::valueno slot_, std::string const &str_, bool prefix_)\n"
    "    StringValueRangeProcessor.new(Xapian::valueno slot_, std::string const &str_)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_StringValueRangeProcessor___call__(int argc, VALUE *argv, VALUE self) {
  Xapian::StringValueRangeProcessor *arg1 = (Xapian::StringValueRangeProcessor *) 0 ;
  std::string *arg2 = 0 ;
  std::string *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  Xapian::valueno result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__StringValueRangeProcessor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::StringValueRangeProcessor *","operator ()", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::StringValueRangeProcessor * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__string,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string &","operator ()", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string &","operator ()", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< std::string * >(argp2);
  res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_std__string,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::string &","operator ()", 3, argv[1] )); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string &","operator ()", 3, argv[1])); 
  }
  arg3 = reinterpret_cast< std::string * >(argp3);
  {
    try {
      result = (Xapian::valueno)(arg1)->operator ()(*arg2,*arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_StringValueRangeProcessor(Xapian::StringValueRangeProcessor *arg1) {
    delete arg1;
}

swig_class SwigClassDateValueRangeProcessor;

SWIGINTERN VALUE
_wrap_new_DateValueRangeProcessor__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::valueno arg1 ;
  bool arg2 ;
  int arg3 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::DateValueRangeProcessor";
  Xapian::DateValueRangeProcessor *result = 0 ;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::DateValueRangeProcessor", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::valueno >(val1);
  ecode2 = SWIG_AsVal_bool(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","Xapian::DateValueRangeProcessor", 2, argv[1] ));
  } 
  arg2 = static_cast< bool >(val2);
  ecode3 = SWIG_AsVal_int(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","Xapian::DateValueRangeProcessor", 3, argv[2] ));
  } 
  arg3 = static_cast< int >(val3);
  {
    try {
      result = (Xapian::DateValueRangeProcessor *)new Xapian::DateValueRangeProcessor(arg1,arg2,arg3);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_new_DateValueRangeProcessor__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::valueno arg1 ;
  bool arg2 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::DateValueRangeProcessor";
  Xapian::DateValueRangeProcessor *result = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::DateValueRangeProcessor", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::valueno >(val1);
  ecode2 = SWIG_AsVal_bool(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","Xapian::DateValueRangeProcessor", 2, argv[1] ));
  } 
  arg2 = static_cast< bool >(val2);
  {
    try {
      result = (Xapian::DateValueRangeProcessor *)new Xapian::DateValueRangeProcessor(arg1,arg2);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_new_DateValueRangeProcessor__SWIG_2(int argc, VALUE *argv, VALUE self) {
  Xapian::valueno arg1 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::DateValueRangeProcessor";
  Xapian::DateValueRangeProcessor *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::DateValueRangeProcessor", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::valueno >(val1);
  {
    try {
      result = (Xapian::DateValueRangeProcessor *)new Xapian::DateValueRangeProcessor(arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_new_DateValueRangeProcessor__SWIG_3(int argc, VALUE *argv, VALUE self) {
  Xapian::valueno arg1 ;
  std::string *arg2 = 0 ;
  bool arg3 ;
  bool arg4 ;
  int arg5 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  bool val3 ;
  int ecode3 = 0 ;
  bool val4 ;
  int ecode4 = 0 ;
  int val5 ;
  int ecode5 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::DateValueRangeProcessor";
  Xapian::DateValueRangeProcessor *result = 0 ;
  
  if ((argc < 5) || (argc > 5)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 5)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::DateValueRangeProcessor", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::valueno >(val1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","Xapian::DateValueRangeProcessor", 2, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::DateValueRangeProcessor", 2, argv[1])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_bool(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","Xapian::DateValueRangeProcessor", 3, argv[2] ));
  } 
  arg3 = static_cast< bool >(val3);
  ecode4 = SWIG_AsVal_bool(argv[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "bool","Xapian::DateValueRangeProcessor", 4, argv[3] ));
  } 
  arg4 = static_cast< bool >(val4);
  ecode5 = SWIG_AsVal_int(argv[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "int","Xapian::DateValueRangeProcessor", 5, argv[4] ));
  } 
  arg5 = static_cast< int >(val5);
  {
    try {
      result = (Xapian::DateValueRangeProcessor *)new Xapian::DateValueRangeProcessor(arg1,(std::string const &)*arg2,arg3,arg4,arg5);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return self;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_new_DateValueRangeProcessor__SWIG_4(int argc, VALUE *argv, VALUE self) {
  Xapian::valueno arg1 ;
  std::string *arg2 = 0 ;
  bool arg3 ;
  bool arg4 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  bool val3 ;
  int ecode3 = 0 ;
  bool val4 ;
  int ecode4 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::DateValueRangeProcessor";
  Xapian::DateValueRangeProcessor *result = 0 ;
  
  if ((argc < 4) || (argc > 4)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::DateValueRangeProcessor", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::valueno >(val1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","Xapian::DateValueRangeProcessor", 2, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::DateValueRangeProcessor", 2, argv[1])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_bool(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","Xapian::DateValueRangeProcessor", 3, argv[2] ));
  } 
  arg3 = static_cast< bool >(val3);
  ecode4 = SWIG_AsVal_bool(argv[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "bool","Xapian::DateValueRangeProcessor", 4, argv[3] ));
  } 
  arg4 = static_cast< bool >(val4);
  {
    try {
      result = (Xapian::DateValueRangeProcessor *)new Xapian::DateValueRangeProcessor(arg1,(std::string const &)*arg2,arg3,arg4);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return self;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_new_DateValueRangeProcessor__SWIG_5(int argc, VALUE *argv, VALUE self) {
  Xapian::valueno arg1 ;
  std::string *arg2 = 0 ;
  bool arg3 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  bool val3 ;
  int ecode3 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::DateValueRangeProcessor";
  Xapian::DateValueRangeProcessor *result = 0 ;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::DateValueRangeProcessor", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::valueno >(val1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","Xapian::DateValueRangeProcessor", 2, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::DateValueRangeProcessor", 2, argv[1])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_bool(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","Xapian::DateValueRangeProcessor", 3, argv[2] ));
  } 
  arg3 = static_cast< bool >(val3);
  {
    try {
      result = (Xapian::DateValueRangeProcessor *)new Xapian::DateValueRangeProcessor(arg1,(std::string const &)*arg2,arg3);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return self;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_DateValueRangeProcessor_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_DateValueRangeProcessor_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__DateValueRangeProcessor);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_DateValueRangeProcessor__SWIG_6(int argc, VALUE *argv, VALUE self) {
  Xapian::valueno arg1 ;
  std::string *arg2 = 0 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  const char *classname SWIGUNUSED = "Xapian::DateValueRangeProcessor";
  Xapian::DateValueRangeProcessor *result = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::DateValueRangeProcessor", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::valueno >(val1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","Xapian::DateValueRangeProcessor", 2, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::DateValueRangeProcessor", 2, argv[1])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = (Xapian::DateValueRangeProcessor *)new Xapian::DateValueRangeProcessor(arg1,(std::string const &)*arg2);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return self;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_DateValueRangeProcessor(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[5];
  int ii;
  
  argc = nargs;
  if (argc > 5) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 1) {
    int _v;
    {
      int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      return _wrap_new_DateValueRangeProcessor__SWIG_2(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    {
      int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_new_DateValueRangeProcessor__SWIG_6(nargs, args, self);
      }
    }
  }
  if (argc == 2) {
    int _v;
    {
      int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      {
        int res = SWIG_AsVal_bool(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_new_DateValueRangeProcessor__SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    {
      int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_bool(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_new_DateValueRangeProcessor__SWIG_5(nargs, args, self);
        }
      }
    }
  }
  if (argc == 3) {
    int _v;
    {
      int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      {
        int res = SWIG_AsVal_bool(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_new_DateValueRangeProcessor__SWIG_0(nargs, args, self);
        }
      }
    }
  }
  if (argc == 4) {
    int _v;
    {
      int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_bool(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          {
            int res = SWIG_AsVal_bool(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
          if (_v) {
            return _wrap_new_DateValueRangeProcessor__SWIG_4(nargs, args, self);
          }
        }
      }
    }
  }
  if (argc == 5) {
    int _v;
    {
      int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_bool(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          {
            int res = SWIG_AsVal_bool(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
          if (_v) {
            {
              int res = SWIG_AsVal_int(argv[4], NULL);
              _v = SWIG_CheckState(res);
            }
            if (_v) {
              return _wrap_new_DateValueRangeProcessor__SWIG_3(nargs, args, self);
            }
          }
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 5, "DateValueRangeProcessor.new", 
    "    DateValueRangeProcessor.new(Xapian::valueno slot_, bool prefer_mdy_, int epoch_year_)\n"
    "    DateValueRangeProcessor.new(Xapian::valueno slot_, bool prefer_mdy_)\n"
    "    DateValueRangeProcessor.new(Xapian::valueno slot_)\n"
    "    DateValueRangeProcessor.new(Xapian::valueno slot_, std::string const &str_, bool prefix_, bool prefer_mdy_, int epoch_year_)\n"
    "    DateValueRangeProcessor.new(Xapian::valueno slot_, std::string const &str_, bool prefix_, bool prefer_mdy_)\n"
    "    DateValueRangeProcessor.new(Xapian::valueno slot_, std::string const &str_, bool prefix_)\n"
    "    DateValueRangeProcessor.new(Xapian::valueno slot_, std::string const &str_)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_DateValueRangeProcessor___call__(int argc, VALUE *argv, VALUE self) {
  Xapian::DateValueRangeProcessor *arg1 = (Xapian::DateValueRangeProcessor *) 0 ;
  std::string *arg2 = 0 ;
  std::string *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  Xapian::valueno result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__DateValueRangeProcessor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::DateValueRangeProcessor *","operator ()", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::DateValueRangeProcessor * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__string,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string &","operator ()", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string &","operator ()", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< std::string * >(argp2);
  res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_std__string,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::string &","operator ()", 3, argv[1] )); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string &","operator ()", 3, argv[1])); 
  }
  arg3 = reinterpret_cast< std::string * >(argp3);
  {
    try {
      result = (Xapian::valueno)(arg1)->operator ()(*arg2,*arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_DateValueRangeProcessor(Xapian::DateValueRangeProcessor *arg1) {
    delete arg1;
}

swig_class SwigClassNumberValueRangeProcessor;

SWIGINTERN VALUE
_wrap_new_NumberValueRangeProcessor__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::valueno arg1 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::NumberValueRangeProcessor";
  Xapian::NumberValueRangeProcessor *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::NumberValueRangeProcessor", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::valueno >(val1);
  {
    try {
      result = (Xapian::NumberValueRangeProcessor *)new Xapian::NumberValueRangeProcessor(arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_new_NumberValueRangeProcessor__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::valueno arg1 ;
  std::string *arg2 = 0 ;
  bool arg3 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  bool val3 ;
  int ecode3 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::NumberValueRangeProcessor";
  Xapian::NumberValueRangeProcessor *result = 0 ;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::NumberValueRangeProcessor", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::valueno >(val1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","Xapian::NumberValueRangeProcessor", 2, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::NumberValueRangeProcessor", 2, argv[1])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_bool(argv[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","Xapian::NumberValueRangeProcessor", 3, argv[2] ));
  } 
  arg3 = static_cast< bool >(val3);
  {
    try {
      result = (Xapian::NumberValueRangeProcessor *)new Xapian::NumberValueRangeProcessor(arg1,(std::string const &)*arg2,arg3);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return self;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_NumberValueRangeProcessor_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_NumberValueRangeProcessor_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__NumberValueRangeProcessor);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_NumberValueRangeProcessor__SWIG_2(int argc, VALUE *argv, VALUE self) {
  Xapian::valueno arg1 ;
  std::string *arg2 = 0 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  const char *classname SWIGUNUSED = "Xapian::NumberValueRangeProcessor";
  Xapian::NumberValueRangeProcessor *result = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::NumberValueRangeProcessor", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::valueno >(val1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","Xapian::NumberValueRangeProcessor", 2, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::NumberValueRangeProcessor", 2, argv[1])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = (Xapian::NumberValueRangeProcessor *)new Xapian::NumberValueRangeProcessor(arg1,(std::string const &)*arg2);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return self;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_NumberValueRangeProcessor(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs;
  if (argc > 3) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 1) {
    int _v;
    {
      int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      return _wrap_new_NumberValueRangeProcessor__SWIG_0(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    {
      int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_new_NumberValueRangeProcessor__SWIG_2(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    {
      int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
      _v = SWIG_CheckState(res);
    }
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_bool(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_new_NumberValueRangeProcessor__SWIG_1(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "NumberValueRangeProcessor.new", 
    "    NumberValueRangeProcessor.new(Xapian::valueno slot_)\n"
    "    NumberValueRangeProcessor.new(Xapian::valueno slot_, std::string const &str_, bool prefix_)\n"
    "    NumberValueRangeProcessor.new(Xapian::valueno slot_, std::string const &str_)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_NumberValueRangeProcessor___call__(int argc, VALUE *argv, VALUE self) {
  Xapian::NumberValueRangeProcessor *arg1 = (Xapian::NumberValueRangeProcessor *) 0 ;
  std::string *arg2 = 0 ;
  std::string *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  Xapian::valueno result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__NumberValueRangeProcessor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::NumberValueRangeProcessor *","operator ()", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::NumberValueRangeProcessor * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_std__string,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string &","operator ()", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string &","operator ()", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< std::string * >(argp2);
  res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_std__string,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::string &","operator ()", 3, argv[1] )); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string &","operator ()", 3, argv[1])); 
  }
  arg3 = reinterpret_cast< std::string * >(argp3);
  {
    try {
      result = (Xapian::valueno)(arg1)->operator ()(*arg2,*arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_NumberValueRangeProcessor(Xapian::NumberValueRangeProcessor *arg1) {
    delete arg1;
}

swig_class SwigClassQueryParser;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_QueryParser_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_QueryParser_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__QueryParser);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_QueryParser(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::QueryParser";
  Xapian::QueryParser *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::QueryParser *)new Xapian::QueryParser();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_QueryParser(Xapian::QueryParser *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_QueryParser_stemmere___(int argc, VALUE *argv, VALUE self) {
  Xapian::QueryParser *arg1 = (Xapian::QueryParser *) 0 ;
  Xapian::Stem *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__QueryParser, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::QueryParser *","set_stemmer", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::QueryParser * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Stem,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Stem const &","set_stemmer", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Stem const &","set_stemmer", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Stem * >(argp2);
  {
    try {
      (arg1)->set_stemmer((Xapian::Stem const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_QueryParser_stemming_strategye___(int argc, VALUE *argv, VALUE self) {
  Xapian::QueryParser *arg1 = (Xapian::QueryParser *) 0 ;
  Xapian::QueryParser::stem_strategy arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__QueryParser, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::QueryParser *","set_stemming_strategy", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::QueryParser * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::QueryParser::stem_strategy","set_stemming_strategy", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::QueryParser::stem_strategy >(val2);
  {
    try {
      (arg1)->set_stemming_strategy(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_QueryParser_stoppere_____SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::QueryParser *arg1 = (Xapian::QueryParser *) 0 ;
  Xapian::Stopper *arg2 = (Xapian::Stopper *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__QueryParser, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::QueryParser *","set_stopper", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::QueryParser * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_Xapian__Stopper, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Stopper const *","set_stopper", 2, argv[0] )); 
  }
  arg2 = reinterpret_cast< Xapian::Stopper * >(argp2);
  {
    try {
      (arg1)->set_stopper((Xapian::Stopper const *)arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_QueryParser_stoppere_____SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::QueryParser *arg1 = (Xapian::QueryParser *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__QueryParser, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::QueryParser *","set_stopper", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::QueryParser * >(argp1);
  {
    try {
      (arg1)->set_stopper();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_QueryParser_stoppere___(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__QueryParser, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_QueryParser_stoppere_____SWIG_1(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__QueryParser, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Xapian__Stopper, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_QueryParser_stoppere_____SWIG_0(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "QueryParser.stopper=", 
    "    void QueryParser.stopper=(Xapian::Stopper const *stop)\n"
    "    void QueryParser.stopper=()\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_QueryParser_default_ope___(int argc, VALUE *argv, VALUE self) {
  Xapian::QueryParser *arg1 = (Xapian::QueryParser *) 0 ;
  Xapian::Query::op arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__QueryParser, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::QueryParser *","set_default_op", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::QueryParser * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::Query::op","set_default_op", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::Query::op >(val2);
  {
    try {
      (arg1)->set_default_op(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_QueryParser_default_op(int argc, VALUE *argv, VALUE self) {
  Xapian::QueryParser *arg1 = (Xapian::QueryParser *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::Query::op result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__QueryParser, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::QueryParser const *","get_default_op", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::QueryParser * >(argp1);
  {
    try {
      result = (Xapian::Query::op)((Xapian::QueryParser const *)arg1)->get_default_op();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_QueryParser_databasee___(int argc, VALUE *argv, VALUE self) {
  Xapian::QueryParser *arg1 = (Xapian::QueryParser *) 0 ;
  Xapian::Database *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__QueryParser, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::QueryParser *","set_database", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::QueryParser * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Database,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Database const &","set_database", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Database const &","set_database", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Database * >(argp2);
  {
    try {
      (arg1)->set_database((Xapian::Database const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_QueryParser_set_max_wildcard_expansion(int argc, VALUE *argv, VALUE self) {
  Xapian::QueryParser *arg1 = (Xapian::QueryParser *) 0 ;
  Xapian::termcount arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__QueryParser, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::QueryParser *","set_max_wildcard_expansion", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::QueryParser * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::termcount","set_max_wildcard_expansion", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::termcount >(val2);
  {
    try {
      (arg1)->set_max_wildcard_expansion(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_QueryParser_parse_query__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::QueryParser *arg1 = (Xapian::QueryParser *) 0 ;
  std::string *arg2 = 0 ;
  unsigned int arg3 ;
  std::string *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  int res4 = SWIG_OLDOBJ ;
  Xapian::Query result;
  VALUE vresult = Qnil;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__QueryParser, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::QueryParser *","parse_query", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::QueryParser * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","parse_query", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","parse_query", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "unsigned int","parse_query", 3, argv[1] ));
  } 
  arg3 = static_cast< unsigned int >(val3);
  {
    std::string *ptr = (std::string *)0;
    res4 = SWIG_AsPtr_std_string(argv[2], &ptr);
    if (!SWIG_IsOK(res4)) {
      SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "std::string const &","parse_query", 4, argv[2] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","parse_query", 4, argv[2])); 
    }
    arg4 = ptr;
  }
  {
    try {
      result = (arg1)->parse_query((std::string const &)*arg2,arg3,(std::string const &)*arg4);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::Query(static_cast< const Xapian::Query& >(result))), SWIGTYPE_p_Xapian__Query, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res4)) delete arg4;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res4)) delete arg4;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_QueryParser_parse_query__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::QueryParser *arg1 = (Xapian::QueryParser *) 0 ;
  std::string *arg2 = 0 ;
  unsigned int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  Xapian::Query result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__QueryParser, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::QueryParser *","parse_query", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::QueryParser * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","parse_query", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","parse_query", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "unsigned int","parse_query", 3, argv[1] ));
  } 
  arg3 = static_cast< unsigned int >(val3);
  {
    try {
      result = (arg1)->parse_query((std::string const &)*arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::Query(static_cast< const Xapian::Query& >(result))), SWIGTYPE_p_Xapian__Query, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_QueryParser_parse_query__SWIG_2(int argc, VALUE *argv, VALUE self) {
  Xapian::QueryParser *arg1 = (Xapian::QueryParser *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Xapian::Query result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__QueryParser, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::QueryParser *","parse_query", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::QueryParser * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","parse_query", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","parse_query", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = (arg1)->parse_query((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::Query(static_cast< const Xapian::Query& >(result))), SWIGTYPE_p_Xapian__Query, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE _wrap_QueryParser_parse_query(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[5];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 5) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__QueryParser, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_QueryParser_parse_query__SWIG_2(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__QueryParser, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_QueryParser_parse_query__SWIG_1(nargs, args, self);
        }
      }
    }
  }
  if (argc == 4) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__QueryParser, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          int res = SWIG_AsPtr_std_string(argv[3], (std::string**)(0));
          _v = SWIG_CheckState(res);
          if (_v) {
            return _wrap_QueryParser_parse_query__SWIG_0(nargs, args, self);
          }
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 5, "QueryParser.parse_query", 
    "    Xapian::Query QueryParser.parse_query(std::string const &query_string, unsigned int flags, std::string const &default_prefix)\n"
    "    Xapian::Query QueryParser.parse_query(std::string const &query_string, unsigned int flags)\n"
    "    Xapian::Query QueryParser.parse_query(std::string const &query_string)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_QueryParser_add_prefix(int argc, VALUE *argv, VALUE self) {
  Xapian::QueryParser *arg1 = (Xapian::QueryParser *) 0 ;
  std::string *arg2 = 0 ;
  std::string *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__QueryParser, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::QueryParser *","add_prefix", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::QueryParser * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","add_prefix", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","add_prefix", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::string const &","add_prefix", 3, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","add_prefix", 3, argv[1])); 
    }
    arg3 = ptr;
  }
  {
    try {
      (arg1)->add_prefix((std::string const &)*arg2,(std::string const &)*arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_QueryParser_add_boolean_prefix__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::QueryParser *arg1 = (Xapian::QueryParser *) 0 ;
  std::string *arg2 = 0 ;
  std::string *arg3 = 0 ;
  bool arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  int res3 = SWIG_OLDOBJ ;
  bool val4 ;
  int ecode4 = 0 ;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__QueryParser, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::QueryParser *","add_boolean_prefix", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::QueryParser * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","add_boolean_prefix", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","add_boolean_prefix", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::string const &","add_boolean_prefix", 3, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","add_boolean_prefix", 3, argv[1])); 
    }
    arg3 = ptr;
  }
  ecode4 = SWIG_AsVal_bool(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "bool","add_boolean_prefix", 4, argv[2] ));
  } 
  arg4 = static_cast< bool >(val4);
  {
    try {
      (arg1)->add_boolean_prefix((std::string const &)*arg2,(std::string const &)*arg3,arg4);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_QueryParser_add_boolean_prefix__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::QueryParser *arg1 = (Xapian::QueryParser *) 0 ;
  std::string *arg2 = 0 ;
  std::string *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__QueryParser, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::QueryParser *","add_boolean_prefix", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::QueryParser * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","add_boolean_prefix", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","add_boolean_prefix", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::string const &","add_boolean_prefix", 3, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","add_boolean_prefix", 3, argv[1])); 
    }
    arg3 = ptr;
  }
  {
    try {
      (arg1)->add_boolean_prefix((std::string const &)*arg2,(std::string const &)*arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return Qnil;
}


SWIGINTERN VALUE _wrap_QueryParser_add_boolean_prefix(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[5];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 5) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__QueryParser, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0));
        _v = SWIG_CheckState(res);
        if (_v) {
          return _wrap_QueryParser_add_boolean_prefix__SWIG_1(nargs, args, self);
        }
      }
    }
  }
  if (argc == 4) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__QueryParser, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0));
        _v = SWIG_CheckState(res);
        if (_v) {
          {
            int res = SWIG_AsVal_bool(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
          if (_v) {
            return _wrap_QueryParser_add_boolean_prefix__SWIG_0(nargs, args, self);
          }
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 5, "QueryParser.add_boolean_prefix", 
    "    void QueryParser.add_boolean_prefix(std::string const &field, std::string const &prefix, bool exclusive)\n"
    "    void QueryParser.add_boolean_prefix(std::string const &field, std::string const &prefix)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_QueryParser_stoplist_begin(int argc, VALUE *argv, VALUE self) {
  Xapian::QueryParser *arg1 = (Xapian::QueryParser *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__QueryParser, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::QueryParser const *","stoplist_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::QueryParser * >(argp1);
  {
    try {
      result = ((Xapian::QueryParser const *)arg1)->stoplist_begin();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_QueryParser_stoplist_end(int argc, VALUE *argv, VALUE self) {
  Xapian::QueryParser *arg1 = (Xapian::QueryParser *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__QueryParser, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::QueryParser const *","stoplist_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::QueryParser * >(argp1);
  {
    try {
      result = ((Xapian::QueryParser const *)arg1)->stoplist_end();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_QueryParser_unstem_begin(int argc, VALUE *argv, VALUE self) {
  Xapian::QueryParser *arg1 = (Xapian::QueryParser *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__QueryParser, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::QueryParser const *","unstem_begin", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::QueryParser * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","unstem_begin", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","unstem_begin", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = ((Xapian::QueryParser const *)arg1)->unstem_begin((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_QueryParser_unstem_end(int argc, VALUE *argv, VALUE self) {
  Xapian::QueryParser *arg1 = (Xapian::QueryParser *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Xapian::TermIterator result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__QueryParser, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::QueryParser const *","unstem_end", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::QueryParser * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","unstem_end", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","unstem_end", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = ((Xapian::QueryParser const *)arg1)->unstem_end((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj((new Xapian::TermIterator(static_cast< const Xapian::TermIterator& >(result))), SWIGTYPE_p_Xapian__TermIterator, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_QueryParser_add_valuerangeprocessor(int argc, VALUE *argv, VALUE self) {
  Xapian::QueryParser *arg1 = (Xapian::QueryParser *) 0 ;
  Xapian::ValueRangeProcessor *arg2 = (Xapian::ValueRangeProcessor *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__QueryParser, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::QueryParser *","add_valuerangeprocessor", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::QueryParser * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_Xapian__ValueRangeProcessor, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::ValueRangeProcessor *","add_valuerangeprocessor", 2, argv[0] )); 
  }
  arg2 = reinterpret_cast< Xapian::ValueRangeProcessor * >(argp2);
  {
    try {
      (arg1)->add_valuerangeprocessor(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_QueryParser_get_corrected_query_string(int argc, VALUE *argv, VALUE self) {
  Xapian::QueryParser *arg1 = (Xapian::QueryParser *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__QueryParser, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::QueryParser const *","get_corrected_query_string", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::QueryParser * >(argp1);
  {
    try {
      result = ((Xapian::QueryParser const *)arg1)->get_corrected_query_string();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_QueryParser_description(int argc, VALUE *argv, VALUE self) {
  Xapian::QueryParser *arg1 = (Xapian::QueryParser *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__QueryParser, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::QueryParser const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::QueryParser * >(argp1);
  {
    try {
      result = ((Xapian::QueryParser const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_sortable_serialise(int argc, VALUE *argv, VALUE self) {
  double arg1 ;
  double val1 ;
  int ecode1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_double(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "double","Xapian::sortable_serialise", 1, argv[0] ));
  } 
  arg1 = static_cast< double >(val1);
  {
    try {
      result = Xapian::sortable_serialise(arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_sortable_unserialise(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  double result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::sortable_unserialise", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::sortable_unserialise", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  {
    try {
      result = (double)Xapian::sortable_unserialise((std::string const &)*arg1);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  if (SWIG_IsNewObj(res1)) delete arg1;
  return vresult;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


swig_class SwigClassStemImplementation;

SWIGINTERN void
free_Xapian_StemImplementation(Xapian::StemImplementation *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_StemImplementation___call__(int argc, VALUE *argv, VALUE self) {
  Xapian::StemImplementation *arg1 = (Xapian::StemImplementation *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  Swig::Director *director = 0;
  bool upcall = false;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__StemImplementation, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::StemImplementation *","operator ()", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::StemImplementation * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","operator ()", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","operator ()", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          Swig::DirectorPureVirtualException::raise("Xapian::StemImplementation::operator ()");
        } else {
          result = (arg1)->operator ()((std::string const &)*arg2);
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_StemImplementation_description(int argc, VALUE *argv, VALUE self) {
  Xapian::StemImplementation *arg1 = (Xapian::StemImplementation *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Swig::Director *director = 0;
  bool upcall = false;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__StemImplementation, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::StemImplementation const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::StemImplementation * >(argp1);
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          Swig::DirectorPureVirtualException::raise("Xapian::StemImplementation::get_description");
        } else {
          result = ((Xapian::StemImplementation const *)arg1)->get_description();
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_StemImplementation_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_StemImplementation_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__StemImplementation);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_StemImplementation(int argc, VALUE *argv, VALUE self) {
  VALUE arg1 = (VALUE) 0 ;
  const char *classname SWIGUNUSED = "Xapian::StemImplementation";
  Xapian::StemImplementation *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  arg1 = self;
  {
    try {
      if ( strcmp(rb_obj_classname(self), classname) != 0 ) {
        /* subclassed */
        result = (Xapian::StemImplementation *)new SwigDirector_StemImplementation(arg1); 
      } else {
        rb_raise(rb_eNameError,"accessing abstract class or protected constructor"); 
        return Qnil;
      }
      
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_disown_StemImplementation(int argc, VALUE *argv, VALUE self) {
  Xapian::StemImplementation *arg1 = (Xapian::StemImplementation *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_Xapian__StemImplementation, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::StemImplementation *","disown_StemImplementation", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< Xapian::StemImplementation * >(argp1);
  {
    Swig::Director *director = SWIG_DIRECTOR_CAST(arg1);
    if (director) director->swig_disown();
  }
  
  return Qnil;
fail:
  return Qnil;
}


swig_class SwigClassStem;

SWIGINTERN VALUE
_wrap_new_Stem__SWIG_0(int argc, VALUE *argv, VALUE self) {
  std::string *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  const char *classname SWIGUNUSED = "Xapian::Stem";
  Xapian::Stem *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  {
    std::string *ptr = (std::string *)0;
    res1 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "std::string const &","Xapian::Stem", 1, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","Xapian::Stem", 1, argv[0])); 
    }
    arg1 = ptr;
  }
  {
    try {
      result = (Xapian::Stem *)new Xapian::Stem((std::string const &)*arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res1)) delete arg1;
  return self;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return Qnil;
}


#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_Stem_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_Stem_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__Stem);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_Stem__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::StemImplementation *arg1 = (Xapian::StemImplementation *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::Stem";
  Xapian::Stem *result = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_Xapian__StemImplementation, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::StemImplementation *","Xapian::Stem", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< Xapian::StemImplementation * >(argp1);
  {
    try {
      result = (Xapian::Stem *)new Xapian::Stem(arg1);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_new_Stem(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[1];
  int ii;
  
  argc = nargs;
  if (argc > 1) SWIG_fail;
  for (ii = 0; (ii < argc); ++ii) {
    argv[ii] = args[ii];
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__StemImplementation, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_new_Stem__SWIG_1(nargs, args, self);
    }
  }
  if (argc == 1) {
    int _v;
    int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_new_Stem__SWIG_0(nargs, args, self);
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 1, "Stem.new", 
    "    Stem.new(std::string const &language)\n"
    "    Stem.new(Xapian::StemImplementation *p)\n");
  
  return Qnil;
}


SWIGINTERN void
free_Xapian_Stem(Xapian::Stem *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_Stem___call__(int argc, VALUE *argv, VALUE self) {
  Xapian::Stem *arg1 = (Xapian::Stem *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Stem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Stem const *","operator ()", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Stem * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","operator ()", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","operator ()", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      result = ((Xapian::Stem const *)arg1)->operator ()((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Stem_description(int argc, VALUE *argv, VALUE self) {
  Xapian::Stem *arg1 = (Xapian::Stem *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Stem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Stem const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Stem * >(argp1);
  {
    try {
      result = ((Xapian::Stem const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Stem_available_languages(int argc, VALUE *argv, VALUE self) {
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = Xapian::Stem::get_available_languages();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


swig_class SwigClassTermGenerator;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_TermGenerator_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_TermGenerator_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__TermGenerator);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_TermGenerator(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::TermGenerator";
  Xapian::TermGenerator *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::TermGenerator *)new Xapian::TermGenerator();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_TermGenerator(Xapian::TermGenerator *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_TermGenerator_stemmere___(int argc, VALUE *argv, VALUE self) {
  Xapian::TermGenerator *arg1 = (Xapian::TermGenerator *) 0 ;
  Xapian::Stem *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermGenerator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermGenerator *","set_stemmer", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermGenerator * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Stem,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Stem const &","set_stemmer", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Stem const &","set_stemmer", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Stem * >(argp2);
  {
    try {
      (arg1)->set_stemmer((Xapian::Stem const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermGenerator_stoppere_____SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::TermGenerator *arg1 = (Xapian::TermGenerator *) 0 ;
  Xapian::Stopper *arg2 = (Xapian::Stopper *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermGenerator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermGenerator *","set_stopper", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermGenerator * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_Xapian__Stopper, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Stopper const *","set_stopper", 2, argv[0] )); 
  }
  arg2 = reinterpret_cast< Xapian::Stopper * >(argp2);
  {
    try {
      (arg1)->set_stopper((Xapian::Stopper const *)arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermGenerator_stoppere_____SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::TermGenerator *arg1 = (Xapian::TermGenerator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermGenerator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermGenerator *","set_stopper", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermGenerator * >(argp1);
  {
    try {
      (arg1)->set_stopper();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_TermGenerator_stoppere___(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__TermGenerator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_TermGenerator_stoppere_____SWIG_1(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__TermGenerator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_Xapian__Stopper, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_TermGenerator_stoppere_____SWIG_0(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "TermGenerator.stopper=", 
    "    void TermGenerator.stopper=(Xapian::Stopper const *stop)\n"
    "    void TermGenerator.stopper=()\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermGenerator_documente___(int argc, VALUE *argv, VALUE self) {
  Xapian::TermGenerator *arg1 = (Xapian::TermGenerator *) 0 ;
  Xapian::Document *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermGenerator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermGenerator *","set_document", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermGenerator * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Document,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Document const &","set_document", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Document const &","set_document", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Document * >(argp2);
  {
    try {
      (arg1)->set_document((Xapian::Document const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermGenerator_document(int argc, VALUE *argv, VALUE self) {
  Xapian::TermGenerator *arg1 = (Xapian::TermGenerator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::Document *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermGenerator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermGenerator const *","get_document", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermGenerator * >(argp1);
  {
    try {
      result = (Xapian::Document *) &((Xapian::TermGenerator const *)arg1)->get_document();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Xapian__Document, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermGenerator_databasee___(int argc, VALUE *argv, VALUE self) {
  Xapian::TermGenerator *arg1 = (Xapian::TermGenerator *) 0 ;
  Xapian::WritableDatabase *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermGenerator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermGenerator *","set_database", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermGenerator * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__WritableDatabase,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::WritableDatabase const &","set_database", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::WritableDatabase const &","set_database", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::WritableDatabase * >(argp2);
  {
    try {
      (arg1)->set_database((Xapian::WritableDatabase const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermGenerator_set_flags__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::TermGenerator *arg1 = (Xapian::TermGenerator *) 0 ;
  Xapian::TermGenerator::flags arg2 ;
  Xapian::TermGenerator::flags arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  Xapian::TermGenerator::flags result;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermGenerator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermGenerator *","set_flags", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermGenerator * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::TermGenerator::flags","set_flags", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::TermGenerator::flags >(val2);
  ecode3 = SWIG_AsVal_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::TermGenerator::flags","set_flags", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::TermGenerator::flags >(val3);
  {
    try {
      result = (Xapian::TermGenerator::flags)(arg1)->set_flags(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermGenerator_set_flags__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::TermGenerator *arg1 = (Xapian::TermGenerator *) 0 ;
  Xapian::TermGenerator::flags arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  Xapian::TermGenerator::flags result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermGenerator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermGenerator *","set_flags", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermGenerator * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::TermGenerator::flags","set_flags", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::TermGenerator::flags >(val2);
  {
    try {
      result = (Xapian::TermGenerator::flags)(arg1)->set_flags(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_TermGenerator_set_flags(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[4];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 4) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__TermGenerator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_TermGenerator_set_flags__SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__TermGenerator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_TermGenerator_set_flags__SWIG_0(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 4, "TermGenerator.set_flags", 
    "    Xapian::TermGenerator::flags TermGenerator.set_flags(Xapian::TermGenerator::flags toggle, Xapian::TermGenerator::flags mask)\n"
    "    Xapian::TermGenerator::flags TermGenerator.set_flags(Xapian::TermGenerator::flags toggle)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermGenerator_stemming_strategye___(int argc, VALUE *argv, VALUE self) {
  Xapian::TermGenerator *arg1 = (Xapian::TermGenerator *) 0 ;
  Xapian::TermGenerator::stem_strategy arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermGenerator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermGenerator *","set_stemming_strategy", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermGenerator * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::TermGenerator::stem_strategy","set_stemming_strategy", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::TermGenerator::stem_strategy >(val2);
  {
    try {
      (arg1)->set_stemming_strategy(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermGenerator_index_text__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::TermGenerator *arg1 = (Xapian::TermGenerator *) 0 ;
  std::string *arg2 = 0 ;
  Xapian::termcount arg3 ;
  std::string *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  int res4 = SWIG_OLDOBJ ;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermGenerator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermGenerator *","index_text", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermGenerator * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","index_text", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","index_text", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::termcount","index_text", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::termcount >(val3);
  {
    std::string *ptr = (std::string *)0;
    res4 = SWIG_AsPtr_std_string(argv[2], &ptr);
    if (!SWIG_IsOK(res4)) {
      SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "std::string const &","index_text", 4, argv[2] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","index_text", 4, argv[2])); 
    }
    arg4 = ptr;
  }
  {
    try {
      (arg1)->index_text((std::string const &)*arg2,arg3,(std::string const &)*arg4);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res4)) delete arg4;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res4)) delete arg4;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermGenerator_index_text__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::TermGenerator *arg1 = (Xapian::TermGenerator *) 0 ;
  std::string *arg2 = 0 ;
  Xapian::termcount arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermGenerator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermGenerator *","index_text", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermGenerator * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","index_text", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","index_text", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::termcount","index_text", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::termcount >(val3);
  {
    try {
      (arg1)->index_text((std::string const &)*arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermGenerator_index_text__SWIG_2(int argc, VALUE *argv, VALUE self) {
  Xapian::TermGenerator *arg1 = (Xapian::TermGenerator *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermGenerator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermGenerator *","index_text", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermGenerator * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","index_text", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","index_text", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      (arg1)->index_text((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE _wrap_TermGenerator_index_text(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[5];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 5) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__TermGenerator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_TermGenerator_index_text__SWIG_2(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__TermGenerator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_TermGenerator_index_text__SWIG_1(nargs, args, self);
        }
      }
    }
  }
  if (argc == 4) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__TermGenerator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          int res = SWIG_AsPtr_std_string(argv[3], (std::string**)(0));
          _v = SWIG_CheckState(res);
          if (_v) {
            return _wrap_TermGenerator_index_text__SWIG_0(nargs, args, self);
          }
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 5, "TermGenerator.index_text", 
    "    void TermGenerator.index_text(std::string const &text, Xapian::termcount wdf_inc, std::string const &prefix)\n"
    "    void TermGenerator.index_text(std::string const &text, Xapian::termcount wdf_inc)\n"
    "    void TermGenerator.index_text(std::string const &text)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermGenerator_index_text_without_positions__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::TermGenerator *arg1 = (Xapian::TermGenerator *) 0 ;
  std::string *arg2 = 0 ;
  Xapian::termcount arg3 ;
  std::string *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  int res4 = SWIG_OLDOBJ ;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermGenerator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermGenerator *","index_text_without_positions", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermGenerator * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","index_text_without_positions", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","index_text_without_positions", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::termcount","index_text_without_positions", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::termcount >(val3);
  {
    std::string *ptr = (std::string *)0;
    res4 = SWIG_AsPtr_std_string(argv[2], &ptr);
    if (!SWIG_IsOK(res4)) {
      SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "std::string const &","index_text_without_positions", 4, argv[2] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","index_text_without_positions", 4, argv[2])); 
    }
    arg4 = ptr;
  }
  {
    try {
      (arg1)->index_text_without_positions((std::string const &)*arg2,arg3,(std::string const &)*arg4);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res4)) delete arg4;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res4)) delete arg4;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermGenerator_index_text_without_positions__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::TermGenerator *arg1 = (Xapian::TermGenerator *) 0 ;
  std::string *arg2 = 0 ;
  Xapian::termcount arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  unsigned int val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermGenerator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermGenerator *","index_text_without_positions", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermGenerator * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","index_text_without_positions", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","index_text_without_positions", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_unsigned_SS_int(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "Xapian::termcount","index_text_without_positions", 3, argv[1] ));
  } 
  arg3 = static_cast< Xapian::termcount >(val3);
  {
    try {
      (arg1)->index_text_without_positions((std::string const &)*arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermGenerator_index_text_without_positions__SWIG_2(int argc, VALUE *argv, VALUE self) {
  Xapian::TermGenerator *arg1 = (Xapian::TermGenerator *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermGenerator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermGenerator *","index_text_without_positions", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermGenerator * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","index_text_without_positions", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","index_text_without_positions", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      (arg1)->index_text_without_positions((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE _wrap_TermGenerator_index_text_without_positions(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[5];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 5) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__TermGenerator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_TermGenerator_index_text_without_positions__SWIG_2(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__TermGenerator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_TermGenerator_index_text_without_positions__SWIG_1(nargs, args, self);
        }
      }
    }
  }
  if (argc == 4) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__TermGenerator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
      _v = SWIG_CheckState(res);
      if (_v) {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          int res = SWIG_AsPtr_std_string(argv[3], (std::string**)(0));
          _v = SWIG_CheckState(res);
          if (_v) {
            return _wrap_TermGenerator_index_text_without_positions__SWIG_0(nargs, args, self);
          }
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 5, "TermGenerator.index_text_without_positions", 
    "    void TermGenerator.index_text_without_positions(std::string const &text, Xapian::termcount wdf_inc, std::string const &prefix)\n"
    "    void TermGenerator.index_text_without_positions(std::string const &text, Xapian::termcount wdf_inc)\n"
    "    void TermGenerator.index_text_without_positions(std::string const &text)\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermGenerator_increase_termpos__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::TermGenerator *arg1 = (Xapian::TermGenerator *) 0 ;
  Xapian::termcount arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermGenerator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermGenerator *","increase_termpos", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermGenerator * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::termcount","increase_termpos", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::termcount >(val2);
  {
    try {
      (arg1)->increase_termpos(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermGenerator_increase_termpos__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::TermGenerator *arg1 = (Xapian::TermGenerator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermGenerator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermGenerator *","increase_termpos", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermGenerator * >(argp1);
  {
    try {
      (arg1)->increase_termpos();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_TermGenerator_increase_termpos(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[3];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 3) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 1) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__TermGenerator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      return _wrap_TermGenerator_increase_termpos__SWIG_1(nargs, args, self);
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__TermGenerator, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_TermGenerator_increase_termpos__SWIG_0(nargs, args, self);
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 3, "TermGenerator.increase_termpos", 
    "    void TermGenerator.increase_termpos(Xapian::termcount delta)\n"
    "    void TermGenerator.increase_termpos()\n");
  
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermGenerator_termpos(int argc, VALUE *argv, VALUE self) {
  Xapian::TermGenerator *arg1 = (Xapian::TermGenerator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  Xapian::termcount result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermGenerator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermGenerator const *","get_termpos", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermGenerator * >(argp1);
  {
    try {
      result = (Xapian::termcount)((Xapian::TermGenerator const *)arg1)->get_termpos();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermGenerator_set_termpos(int argc, VALUE *argv, VALUE self) {
  Xapian::TermGenerator *arg1 = (Xapian::TermGenerator *) 0 ;
  Xapian::termcount arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermGenerator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermGenerator *","set_termpos", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermGenerator * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::termcount","set_termpos", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::termcount >(val2);
  {
    try {
      (arg1)->set_termpos(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_TermGenerator_description(int argc, VALUE *argv, VALUE self) {
  Xapian::TermGenerator *arg1 = (Xapian::TermGenerator *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__TermGenerator, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::TermGenerator const *","get_description", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::TermGenerator * >(argp1);
  {
    try {
      result = ((Xapian::TermGenerator const *)arg1)->get_description();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


swig_class SwigClassKeyMaker;

SWIGINTERN VALUE
_wrap_KeyMaker___call__(int argc, VALUE *argv, VALUE self) {
  Xapian::KeyMaker *arg1 = (Xapian::KeyMaker *) 0 ;
  Xapian::Document *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  Swig::Director *director = 0;
  bool upcall = false;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__KeyMaker, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::KeyMaker const *","operator ()", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::KeyMaker * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Document,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Document const &","operator ()", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Document const &","operator ()", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Document * >(argp2);
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          Swig::DirectorPureVirtualException::raise("Xapian::KeyMaker::operator ()");
        } else {
          result = ((Xapian::KeyMaker const *)arg1)->operator ()((Xapian::Document const &)*arg2);
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_KeyMaker(Xapian::KeyMaker *arg1) {
    delete arg1;
}

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_KeyMaker_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_KeyMaker_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__KeyMaker);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_KeyMaker(int argc, VALUE *argv, VALUE self) {
  VALUE arg1 = (VALUE) 0 ;
  const char *classname SWIGUNUSED = "Xapian::KeyMaker";
  Xapian::KeyMaker *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  arg1 = self;
  {
    try {
      if ( strcmp(rb_obj_classname(self), classname) != 0 ) {
        /* subclassed */
        result = (Xapian::KeyMaker *)new SwigDirector_KeyMaker(arg1); 
      } else {
        rb_raise(rb_eNameError,"accessing abstract class or protected constructor"); 
        return Qnil;
      }
      
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_disown_KeyMaker(int argc, VALUE *argv, VALUE self) {
  Xapian::KeyMaker *arg1 = (Xapian::KeyMaker *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_Xapian__KeyMaker, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::KeyMaker *","disown_KeyMaker", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< Xapian::KeyMaker * >(argp1);
  {
    Swig::Director *director = SWIG_DIRECTOR_CAST(arg1);
    if (director) director->swig_disown();
  }
  
  return Qnil;
fail:
  return Qnil;
}


swig_class SwigClassMultiValueKeyMaker;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_MultiValueKeyMaker_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_MultiValueKeyMaker_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__MultiValueKeyMaker);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_MultiValueKeyMaker(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::MultiValueKeyMaker";
  Xapian::MultiValueKeyMaker *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::MultiValueKeyMaker *)new Xapian::MultiValueKeyMaker();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MultiValueKeyMaker___call__(int argc, VALUE *argv, VALUE self) {
  Xapian::MultiValueKeyMaker *arg1 = (Xapian::MultiValueKeyMaker *) 0 ;
  Xapian::Document *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MultiValueKeyMaker, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MultiValueKeyMaker const *","operator ()", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MultiValueKeyMaker * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Document,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Document const &","operator ()", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Document const &","operator ()", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Document * >(argp2);
  {
    try {
      result = ((Xapian::MultiValueKeyMaker const *)arg1)->operator ()((Xapian::Document const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MultiValueKeyMaker_add_value__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::MultiValueKeyMaker *arg1 = (Xapian::MultiValueKeyMaker *) 0 ;
  Xapian::valueno arg2 ;
  bool arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MultiValueKeyMaker, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MultiValueKeyMaker *","add_value", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MultiValueKeyMaker * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","add_value", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  ecode3 = SWIG_AsVal_bool(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","add_value", 3, argv[1] ));
  } 
  arg3 = static_cast< bool >(val3);
  {
    try {
      (arg1)->add_value(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MultiValueKeyMaker_add_value__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::MultiValueKeyMaker *arg1 = (Xapian::MultiValueKeyMaker *) 0 ;
  Xapian::valueno arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MultiValueKeyMaker, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MultiValueKeyMaker *","add_value", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MultiValueKeyMaker * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","add_value", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  {
    try {
      (arg1)->add_value(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_MultiValueKeyMaker_add_value(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[4];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 4) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__MultiValueKeyMaker, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_MultiValueKeyMaker_add_value__SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__MultiValueKeyMaker, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_bool(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_MultiValueKeyMaker_add_value__SWIG_0(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 4, "MultiValueKeyMaker.add_value", 
    "    void MultiValueKeyMaker.add_value(Xapian::valueno slot, bool reverse)\n"
    "    void MultiValueKeyMaker.add_value(Xapian::valueno slot)\n");
  
  return Qnil;
}


SWIGINTERN void
free_Xapian_MultiValueKeyMaker(Xapian::MultiValueKeyMaker *arg1) {
    delete arg1;
}

swig_class SwigClassSorter;

SWIGINTERN void
free_Xapian_Sorter(Xapian::Sorter *arg1) {
    delete arg1;
}

swig_class SwigClassMultiValueSorter;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_MultiValueSorter_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_MultiValueSorter_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__MultiValueSorter);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_MultiValueSorter(int argc, VALUE *argv, VALUE self) {
  const char *classname SWIGUNUSED = "Xapian::MultiValueSorter";
  Xapian::MultiValueSorter *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try {
      result = (Xapian::MultiValueSorter *)new Xapian::MultiValueSorter();
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MultiValueSorter___call__(int argc, VALUE *argv, VALUE self) {
  Xapian::MultiValueSorter *arg1 = (Xapian::MultiValueSorter *) 0 ;
  Xapian::Document *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MultiValueSorter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MultiValueSorter const *","operator ()", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MultiValueSorter * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Document,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Document const &","operator ()", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Document const &","operator ()", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Document * >(argp2);
  {
    try {
      result = ((Xapian::MultiValueSorter const *)arg1)->operator ()((Xapian::Document const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MultiValueSorter_add__SWIG_0(int argc, VALUE *argv, VALUE self) {
  Xapian::MultiValueSorter *arg1 = (Xapian::MultiValueSorter *) 0 ;
  Xapian::valueno arg2 ;
  bool arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MultiValueSorter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MultiValueSorter *","add", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MultiValueSorter * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","add", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  ecode3 = SWIG_AsVal_bool(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","add", 3, argv[1] ));
  } 
  arg3 = static_cast< bool >(val3);
  {
    try {
      (arg1)->add(arg2,arg3);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_MultiValueSorter_add__SWIG_1(int argc, VALUE *argv, VALUE self) {
  Xapian::MultiValueSorter *arg1 = (Xapian::MultiValueSorter *) 0 ;
  Xapian::valueno arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__MultiValueSorter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::MultiValueSorter *","add", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::MultiValueSorter * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::valueno","add", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::valueno >(val2);
  {
    try {
      (arg1)->add(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE _wrap_MultiValueSorter_add(int nargs, VALUE *args, VALUE self) {
  int argc;
  VALUE argv[4];
  int ii;
  
  argc = nargs + 1;
  argv[0] = self;
  if (argc > 4) SWIG_fail;
  for (ii = 1; (ii < argc); ++ii) {
    argv[ii] = args[ii-1];
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__MultiValueSorter, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_MultiValueSorter_add__SWIG_1(nargs, args, self);
      }
    }
  }
  if (argc == 3) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Xapian__MultiValueSorter, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        {
          int res = SWIG_AsVal_bool(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
        if (_v) {
          return _wrap_MultiValueSorter_add__SWIG_0(nargs, args, self);
        }
      }
    }
  }
  
fail:
  Ruby_Format_OverloadedError( argc, 4, "MultiValueSorter.add", 
    "    void MultiValueSorter.add(Xapian::valueno slot, bool forward)\n"
    "    void MultiValueSorter.add(Xapian::valueno slot)\n");
  
  return Qnil;
}


SWIGINTERN void
free_Xapian_MultiValueSorter(Xapian::MultiValueSorter *arg1) {
    delete arg1;
}

swig_class SwigClassValueSetMatchDecider;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_ValueSetMatchDecider_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_ValueSetMatchDecider_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__ValueSetMatchDecider);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_ValueSetMatchDecider(int argc, VALUE *argv, VALUE self) {
  Xapian::valueno arg1 ;
  bool arg2 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  const char *classname SWIGUNUSED = "Xapian::ValueSetMatchDecider";
  Xapian::ValueSetMatchDecider *result = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "Xapian::valueno","Xapian::ValueSetMatchDecider", 1, argv[0] ));
  } 
  arg1 = static_cast< Xapian::valueno >(val1);
  ecode2 = SWIG_AsVal_bool(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","Xapian::ValueSetMatchDecider", 2, argv[1] ));
  } 
  arg2 = static_cast< bool >(val2);
  {
    try {
      result = (Xapian::ValueSetMatchDecider *)new Xapian::ValueSetMatchDecider(arg1,arg2);
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueSetMatchDecider_add_value(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueSetMatchDecider *arg1 = (Xapian::ValueSetMatchDecider *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueSetMatchDecider, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueSetMatchDecider *","add_value", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueSetMatchDecider * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","add_value", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","add_value", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      (arg1)->add_value((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueSetMatchDecider_remove_value(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueSetMatchDecider *arg1 = (Xapian::ValueSetMatchDecider *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueSetMatchDecider, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueSetMatchDecider *","remove_value", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueSetMatchDecider * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","remove_value", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","remove_value", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      (arg1)->remove_value((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_ValueSetMatchDecider___call__(int argc, VALUE *argv, VALUE self) {
  Xapian::ValueSetMatchDecider *arg1 = (Xapian::ValueSetMatchDecider *) 0 ;
  Xapian::Document *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  bool result;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__ValueSetMatchDecider, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::ValueSetMatchDecider const *","operator ()", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::ValueSetMatchDecider * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_Xapian__Document,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "Xapian::Document const &","operator ()", 2, argv[0] )); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "Xapian::Document const &","operator ()", 2, argv[0])); 
  }
  arg2 = reinterpret_cast< Xapian::Document * >(argp2);
  {
    try {
      result = (bool)((Xapian::ValueSetMatchDecider const *)arg1)->operator ()((Xapian::Document const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_ValueSetMatchDecider(Xapian::ValueSetMatchDecider *arg1) {
    delete arg1;
}

swig_class SwigClassCompactor;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_Compactor_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_Compactor_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Xapian__Compactor);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_Compactor(int argc, VALUE *argv, VALUE self) {
  VALUE arg1 = (VALUE) 0 ;
  const char *classname SWIGUNUSED = "Xapian::Compactor";
  Xapian::Compactor *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  arg1 = self;
  {
    try {
      if ( strcmp(rb_obj_classname(self), classname) != 0 ) {
        /* subclassed */
        result = (Xapian::Compactor *)new SwigDirector_Compactor(arg1); 
      } else {
        result = (Xapian::Compactor *)new Xapian::Compactor(); 
      }
      
      DATA_PTR(self) = result;
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN void
free_Xapian_Compactor(Xapian::Compactor *arg1) {
    delete arg1;
}

SWIGINTERN VALUE
_wrap_Compactor_set_block_size(int argc, VALUE *argv, VALUE self) {
  Xapian::Compactor *arg1 = (Xapian::Compactor *) 0 ;
  size_t arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Compactor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Compactor *","set_block_size", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Compactor * >(argp1);
  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "size_t","set_block_size", 2, argv[0] ));
  } 
  arg2 = static_cast< size_t >(val2);
  {
    try {
      (arg1)->set_block_size(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Compactor_set_renumber(int argc, VALUE *argv, VALUE self) {
  Xapian::Compactor *arg1 = (Xapian::Compactor *) 0 ;
  bool arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Compactor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Compactor *","set_renumber", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Compactor * >(argp1);
  ecode2 = SWIG_AsVal_bool(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","set_renumber", 2, argv[0] ));
  } 
  arg2 = static_cast< bool >(val2);
  {
    try {
      (arg1)->set_renumber(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Compactor_set_multipass(int argc, VALUE *argv, VALUE self) {
  Xapian::Compactor *arg1 = (Xapian::Compactor *) 0 ;
  bool arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Compactor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Compactor *","set_multipass", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Compactor * >(argp1);
  ecode2 = SWIG_AsVal_bool(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","set_multipass", 2, argv[0] ));
  } 
  arg2 = static_cast< bool >(val2);
  {
    try {
      (arg1)->set_multipass(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Compactor_set_compaction_level(int argc, VALUE *argv, VALUE self) {
  Xapian::Compactor *arg1 = (Xapian::Compactor *) 0 ;
  Xapian::Compactor::compaction_level arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Compactor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Compactor *","set_compaction_level", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Compactor * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "Xapian::Compactor::compaction_level","set_compaction_level", 2, argv[0] ));
  } 
  arg2 = static_cast< Xapian::Compactor::compaction_level >(val2);
  {
    try {
      (arg1)->set_compaction_level(arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Compactor_set_destdir(int argc, VALUE *argv, VALUE self) {
  Xapian::Compactor *arg1 = (Xapian::Compactor *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Compactor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Compactor *","set_destdir", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Compactor * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","set_destdir", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","set_destdir", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      (arg1)->set_destdir((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Compactor_add_source(int argc, VALUE *argv, VALUE self) {
  Xapian::Compactor *arg1 = (Xapian::Compactor *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Compactor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Compactor *","add_source", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Compactor * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","add_source", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","add_source", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    try {
      (arg1)->add_source((std::string const &)*arg2);
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Compactor_compact(int argc, VALUE *argv, VALUE self) {
  Xapian::Compactor *arg1 = (Xapian::Compactor *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Compactor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Compactor *","compact", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Compactor * >(argp1);
  {
    try {
      (arg1)->compact();
    } catch (...) {
      string msg;
      int code = XapianExceptionHandler(msg);
      XapianException(code, msg);
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Compactor_set_status(int argc, VALUE *argv, VALUE self) {
  Xapian::Compactor *arg1 = (Xapian::Compactor *) 0 ;
  std::string *arg2 = 0 ;
  std::string *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  int res3 = SWIG_OLDOBJ ;
  Swig::Director *director = 0;
  bool upcall = false;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Compactor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Compactor *","set_status", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Compactor * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","set_status", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","set_status", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  {
    std::string *ptr = (std::string *)0;
    res3 = SWIG_AsPtr_std_string(argv[1], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "std::string const &","set_status", 3, argv[1] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","set_status", 3, argv[1])); 
    }
    arg3 = ptr;
  }
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          (arg1)->Xapian::Compactor::set_status((std::string const &)*arg2,(std::string const &)*arg3);
        } else {
          (arg1)->set_status((std::string const &)*arg2,(std::string const &)*arg3);
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return Qnil;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Compactor_resolve_duplicate_metadata(int argc, VALUE *argv, VALUE self) {
  Xapian::Compactor *arg1 = (Xapian::Compactor *) 0 ;
  std::string *arg2 = 0 ;
  size_t arg3 ;
  std::string *arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  size_t val3 ;
  int ecode3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  Swig::Director *director = 0;
  bool upcall = false;
  std::string result;
  VALUE vresult = Qnil;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Xapian__Compactor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Compactor *","resolve_duplicate_metadata", 1, self )); 
  }
  arg1 = reinterpret_cast< Xapian::Compactor * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(argv[0], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "std::string const &","resolve_duplicate_metadata", 2, argv[0] )); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "std::string const &","resolve_duplicate_metadata", 2, argv[0])); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_size_t(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "size_t","resolve_duplicate_metadata", 3, argv[1] ));
  } 
  arg3 = static_cast< size_t >(val3);
  res4 = SWIG_ConvertPtr(argv[2], &argp4,SWIGTYPE_p_std__string, 0 |  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "std::string const []","resolve_duplicate_metadata", 4, argv[2] )); 
  } 
  arg4 = reinterpret_cast< std::string * >(argp4);
  director = dynamic_cast<Swig::Director *>(arg1);
  upcall = (director && (director->swig_get_self() == self));
  try {
    {
      try {
        if (upcall) {
          result = (arg1)->Xapian::Compactor::resolve_duplicate_metadata((std::string const &)*arg2,arg3,(std::string const (*))arg4);
        } else {
          result = (arg1)->resolve_duplicate_metadata((std::string const &)*arg2,arg3,(std::string const (*))arg4);
        }
      } catch (...) {
        string msg;
        int code = XapianExceptionHandler(msg);
        XapianException(code, msg);
      }
    }
  } catch (Swig::DirectorException& e) {
    rb_exc_raise(e.getError());
    SWIG_fail;
  }
  vresult = SWIG_From_std_string(static_cast< std::string >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return vresult;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_disown_Compactor(int argc, VALUE *argv, VALUE self) {
  Xapian::Compactor *arg1 = (Xapian::Compactor *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_Xapian__Compactor, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "Xapian::Compactor *","disown_Compactor", 1, argv[0] )); 
  }
  arg1 = reinterpret_cast< Xapian::Compactor * >(argp1);
  {
    Swig::Director *director = SWIG_DIRECTOR_CAST(arg1);
    if (director) director->swig_disown();
  }
  
  return Qnil;
fail:
  return Qnil;
}



/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */

static void *_p_swig__IteratorTo_p_swig__ConstIterator(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((swig::ConstIterator *)  ((swig::Iterator *) x));
}
static void *_p_Xapian__WritableDatabaseTo_p_Xapian__Database(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::Database *)  ((Xapian::WritableDatabase *) x));
}
static void *_p_Xapian__ValueSetMatchDeciderTo_p_Xapian__MatchDecider(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::MatchDecider *)  ((Xapian::ValueSetMatchDecider *) x));
}
static void *_p_Xapian__MultiValueSorterTo_p_Xapian__Sorter(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::Sorter *)  ((Xapian::MultiValueSorter *) x));
}
static void *_p_Xapian__SorterTo_p_Xapian__KeyMaker(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::KeyMaker *)  ((Xapian::Sorter *) x));
}
static void *_p_Xapian__MultiValueSorterTo_p_Xapian__KeyMaker(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::KeyMaker *) (Xapian::Sorter *) ((Xapian::MultiValueSorter *) x));
}
static void *_p_Xapian__MultiValueKeyMakerTo_p_Xapian__KeyMaker(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::KeyMaker *)  ((Xapian::MultiValueKeyMaker *) x));
}
static void *_p_Xapian__ValuePostingSourceTo_p_Xapian__PostingSource(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::PostingSource *)  ((Xapian::ValuePostingSource *) x));
}
static void *_p_Xapian__ValueWeightPostingSourceTo_p_Xapian__PostingSource(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::PostingSource *) (Xapian::ValuePostingSource *) ((Xapian::ValueWeightPostingSource *) x));
}
static void *_p_Xapian__DecreasingValueWeightPostingSourceTo_p_Xapian__PostingSource(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::PostingSource *) (Xapian::ValuePostingSource *)(Xapian::ValueWeightPostingSource *) ((Xapian::DecreasingValueWeightPostingSource *) x));
}
static void *_p_Xapian__ValueMapPostingSourceTo_p_Xapian__PostingSource(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::PostingSource *) (Xapian::ValuePostingSource *) ((Xapian::ValueMapPostingSource *) x));
}
static void *_p_Xapian__FixedWeightPostingSourceTo_p_Xapian__PostingSource(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::PostingSource *)  ((Xapian::FixedWeightPostingSource *) x));
}
static void *_p_Xapian__DecreasingValueWeightPostingSourceTo_p_Xapian__ValueWeightPostingSource(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::ValueWeightPostingSource *)  ((Xapian::DecreasingValueWeightPostingSource *) x));
}
static void *_p_Xapian__ValueWeightPostingSourceTo_p_Xapian__ValuePostingSource(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::ValuePostingSource *)  ((Xapian::ValueWeightPostingSource *) x));
}
static void *_p_Xapian__DecreasingValueWeightPostingSourceTo_p_Xapian__ValuePostingSource(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::ValuePostingSource *) (Xapian::ValueWeightPostingSource *) ((Xapian::DecreasingValueWeightPostingSource *) x));
}
static void *_p_Xapian__ValueMapPostingSourceTo_p_Xapian__ValuePostingSource(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::ValuePostingSource *)  ((Xapian::ValueMapPostingSource *) x));
}
static void *_p_Xapian__BoolWeightTo_p_Xapian__Weight(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::Weight *)  ((Xapian::BoolWeight *) x));
}
static void *_p_Xapian__TradWeightTo_p_Xapian__Weight(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::Weight *)  ((Xapian::TradWeight *) x));
}
static void *_p_Xapian__BM25WeightTo_p_Xapian__Weight(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::Weight *)  ((Xapian::BM25Weight *) x));
}
static void *_p_Xapian__ValueCountMatchSpyTo_p_Xapian__MatchSpy(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::MatchSpy *)  ((Xapian::ValueCountMatchSpy *) x));
}
static void *_p_Xapian__SimpleStopperTo_p_Xapian__Stopper(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::Stopper *)  ((Xapian::SimpleStopper *) x));
}
static void *_p_Xapian__DateValueRangeProcessorTo_p_Xapian__StringValueRangeProcessor(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::StringValueRangeProcessor *)  ((Xapian::DateValueRangeProcessor *) x));
}
static void *_p_Xapian__NumberValueRangeProcessorTo_p_Xapian__StringValueRangeProcessor(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::StringValueRangeProcessor *)  ((Xapian::NumberValueRangeProcessor *) x));
}
static void *_p_Xapian__StringValueRangeProcessorTo_p_Xapian__ValueRangeProcessor(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::ValueRangeProcessor *)  ((Xapian::StringValueRangeProcessor *) x));
}
static void *_p_Xapian__DateValueRangeProcessorTo_p_Xapian__ValueRangeProcessor(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::ValueRangeProcessor *) (Xapian::StringValueRangeProcessor *) ((Xapian::DateValueRangeProcessor *) x));
}
static void *_p_Xapian__NumberValueRangeProcessorTo_p_Xapian__ValueRangeProcessor(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((Xapian::ValueRangeProcessor *) (Xapian::StringValueRangeProcessor *) ((Xapian::NumberValueRangeProcessor *) x));
}
static swig_type_info _swigt__p_Xapian__BM25Weight = {"_p_Xapian__BM25Weight", "Xapian::BM25Weight *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__BoolWeight = {"_p_Xapian__BoolWeight", "Xapian::BoolWeight *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__Compactor = {"_p_Xapian__Compactor", "Xapian::Compactor *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__Database = {"_p_Xapian__Database", "Xapian::Database *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__DateValueRangeProcessor = {"_p_Xapian__DateValueRangeProcessor", "Xapian::DateValueRangeProcessor *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__DecreasingValueWeightPostingSource = {"_p_Xapian__DecreasingValueWeightPostingSource", "Xapian::DecreasingValueWeightPostingSource *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__Document = {"_p_Xapian__Document", "Xapian::Document *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__ESet = {"_p_Xapian__ESet", "Xapian::ESet *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__ESetIterator = {"_p_Xapian__ESetIterator", "Xapian::ESetIterator *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__Enquire = {"_p_Xapian__Enquire", "Xapian::Enquire *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__ExpandDecider = {"_p_Xapian__ExpandDecider", "Xapian::ExpandDecider *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__FixedWeightPostingSource = {"_p_Xapian__FixedWeightPostingSource", "Xapian::FixedWeightPostingSource *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__KeyMaker = {"_p_Xapian__KeyMaker", "Xapian::KeyMaker *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__MSet = {"_p_Xapian__MSet", "Xapian::MSet *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__MSetIterator = {"_p_Xapian__MSetIterator", "Xapian::MSetIterator *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__MatchDecider = {"_p_Xapian__MatchDecider", "Xapian::MatchDecider *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__MatchSpy = {"_p_Xapian__MatchSpy", "Xapian::MatchSpy *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__MultiValueKeyMaker = {"_p_Xapian__MultiValueKeyMaker", "Xapian::MultiValueKeyMaker *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__MultiValueSorter = {"_p_Xapian__MultiValueSorter", "Xapian::MultiValueSorter *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__NumberValueRangeProcessor = {"_p_Xapian__NumberValueRangeProcessor", "Xapian::NumberValueRangeProcessor *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__PositionIterator = {"_p_Xapian__PositionIterator", "Xapian::PositionIterator *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__PostingIterator = {"_p_Xapian__PostingIterator", "Xapian::PostingIterator *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__PostingSource = {"_p_Xapian__PostingSource", "Xapian::PostingSource *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__Query = {"_p_Xapian__Query", "Xapian::Query *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__QueryParser = {"_p_Xapian__QueryParser", "Xapian::QueryParser *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__RSet = {"_p_Xapian__RSet", "Xapian::RSet *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__Registry = {"_p_Xapian__Registry", "Xapian::Registry *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__SimpleStopper = {"_p_Xapian__SimpleStopper", "Xapian::SimpleStopper *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__Sorter = {"_p_Xapian__Sorter", "Xapian::Sorter *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__Stem = {"_p_Xapian__Stem", "Xapian::Stem *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__StemImplementation = {"_p_Xapian__StemImplementation", "Xapian::StemImplementation *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__Stopper = {"_p_Xapian__Stopper", "Xapian::Stopper *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__StringValueRangeProcessor = {"_p_Xapian__StringValueRangeProcessor", "Xapian::StringValueRangeProcessor *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__TermGenerator = {"_p_Xapian__TermGenerator", "Xapian::TermGenerator *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__TermIterator = {"_p_Xapian__TermIterator", "Xapian::TermIterator *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__TradWeight = {"_p_Xapian__TradWeight", "Xapian::TradWeight *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__ValueCountMatchSpy = {"_p_Xapian__ValueCountMatchSpy", "Xapian::ValueCountMatchSpy *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__ValueIterator = {"_p_Xapian__ValueIterator", "Xapian::ValueIterator *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__ValueMapPostingSource = {"_p_Xapian__ValueMapPostingSource", "Xapian::ValueMapPostingSource *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__ValuePostingSource = {"_p_Xapian__ValuePostingSource", "Xapian::ValuePostingSource *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__ValueRangeProcessor = {"_p_Xapian__ValueRangeProcessor", "Xapian::ValueRangeProcessor *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__ValueSetMatchDecider = {"_p_Xapian__ValueSetMatchDecider", "Xapian::ValueSetMatchDecider *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__ValueWeightPostingSource = {"_p_Xapian__ValueWeightPostingSource", "Xapian::ValueWeightPostingSource *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__Weight = {"_p_Xapian__Weight", "Xapian::Weight *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Xapian__WritableDatabase = {"_p_Xapian__WritableDatabase", "Xapian::WritableDatabase *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_compaction_level = {"_p_compaction_level", "compaction_level *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_docid_order = {"_p_docid_order", "docid_order *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_double = {"_p_double", "Xapian::doclength *|double *|Xapian::weight *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_feature_flag = {"_p_feature_flag", "feature_flag *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_first_type = {"_p_first_type", "first_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_int = {"_p_int", "int *|Xapian::doccount_diff *|Xapian::termcount_diff *|Xapian::termpos_diff *|Xapian::valueno_diff *|Xapian::percent *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_op = {"_p_op", "op *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_second_type = {"_p_second_type", "second_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__string = {"_p_std__string", "std::string *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_stem_strategy = {"_p_stem_strategy", "stem_strategy *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_swig__ConstIterator = {"_p_swig__ConstIterator", "swig::ConstIterator *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_swig__GC_VALUE = {"_p_swig__GC_VALUE", "swig::GC_VALUE *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_swig__Iterator = {"_p_swig__Iterator", "swig::Iterator *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "Xapian::timeout *|unsigned int *|Xapian::doccount *|Xapian::termcount *|Xapian::valueno *|Xapian::docid *|Xapian::termpos *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_void = {"_p_void", "VALUE|void *", 0, 0, (void*)0, 0};

static swig_type_info *swig_type_initial[] = {
  &_swigt__p_Xapian__BM25Weight,
  &_swigt__p_Xapian__BoolWeight,
  &_swigt__p_Xapian__Compactor,
  &_swigt__p_Xapian__Database,
  &_swigt__p_Xapian__DateValueRangeProcessor,
  &_swigt__p_Xapian__DecreasingValueWeightPostingSource,
  &_swigt__p_Xapian__Document,
  &_swigt__p_Xapian__ESet,
  &_swigt__p_Xapian__ESetIterator,
  &_swigt__p_Xapian__Enquire,
  &_swigt__p_Xapian__ExpandDecider,
  &_swigt__p_Xapian__FixedWeightPostingSource,
  &_swigt__p_Xapian__KeyMaker,
  &_swigt__p_Xapian__MSet,
  &_swigt__p_Xapian__MSetIterator,
  &_swigt__p_Xapian__MatchDecider,
  &_swigt__p_Xapian__MatchSpy,
  &_swigt__p_Xapian__MultiValueKeyMaker,
  &_swigt__p_Xapian__MultiValueSorter,
  &_swigt__p_Xapian__NumberValueRangeProcessor,
  &_swigt__p_Xapian__PositionIterator,
  &_swigt__p_Xapian__PostingIterator,
  &_swigt__p_Xapian__PostingSource,
  &_swigt__p_Xapian__Query,
  &_swigt__p_Xapian__QueryParser,
  &_swigt__p_Xapian__RSet,
  &_swigt__p_Xapian__Registry,
  &_swigt__p_Xapian__SimpleStopper,
  &_swigt__p_Xapian__Sorter,
  &_swigt__p_Xapian__Stem,
  &_swigt__p_Xapian__StemImplementation,
  &_swigt__p_Xapian__Stopper,
  &_swigt__p_Xapian__StringValueRangeProcessor,
  &_swigt__p_Xapian__TermGenerator,
  &_swigt__p_Xapian__TermIterator,
  &_swigt__p_Xapian__TradWeight,
  &_swigt__p_Xapian__ValueCountMatchSpy,
  &_swigt__p_Xapian__ValueIterator,
  &_swigt__p_Xapian__ValueMapPostingSource,
  &_swigt__p_Xapian__ValuePostingSource,
  &_swigt__p_Xapian__ValueRangeProcessor,
  &_swigt__p_Xapian__ValueSetMatchDecider,
  &_swigt__p_Xapian__ValueWeightPostingSource,
  &_swigt__p_Xapian__Weight,
  &_swigt__p_Xapian__WritableDatabase,
  &_swigt__p_char,
  &_swigt__p_compaction_level,
  &_swigt__p_docid_order,
  &_swigt__p_double,
  &_swigt__p_feature_flag,
  &_swigt__p_first_type,
  &_swigt__p_int,
  &_swigt__p_op,
  &_swigt__p_second_type,
  &_swigt__p_std__string,
  &_swigt__p_stem_strategy,
  &_swigt__p_swig__ConstIterator,
  &_swigt__p_swig__GC_VALUE,
  &_swigt__p_swig__Iterator,
  &_swigt__p_unsigned_int,
  &_swigt__p_void,
};

static swig_cast_info _swigc__p_Xapian__BM25Weight[] = {  {&_swigt__p_Xapian__BM25Weight, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__BoolWeight[] = {  {&_swigt__p_Xapian__BoolWeight, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__Compactor[] = {  {&_swigt__p_Xapian__Compactor, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__Database[] = {  {&_swigt__p_Xapian__Database, 0, 0, 0},  {&_swigt__p_Xapian__WritableDatabase, _p_Xapian__WritableDatabaseTo_p_Xapian__Database, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__DateValueRangeProcessor[] = {  {&_swigt__p_Xapian__DateValueRangeProcessor, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__DecreasingValueWeightPostingSource[] = {  {&_swigt__p_Xapian__DecreasingValueWeightPostingSource, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__Document[] = {  {&_swigt__p_Xapian__Document, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__ESet[] = {  {&_swigt__p_Xapian__ESet, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__ESetIterator[] = {  {&_swigt__p_Xapian__ESetIterator, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__Enquire[] = {  {&_swigt__p_Xapian__Enquire, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__ExpandDecider[] = {  {&_swigt__p_Xapian__ExpandDecider, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__FixedWeightPostingSource[] = {  {&_swigt__p_Xapian__FixedWeightPostingSource, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__KeyMaker[] = {  {&_swigt__p_Xapian__Sorter, _p_Xapian__SorterTo_p_Xapian__KeyMaker, 0, 0},  {&_swigt__p_Xapian__MultiValueSorter, _p_Xapian__MultiValueSorterTo_p_Xapian__KeyMaker, 0, 0},  {&_swigt__p_Xapian__KeyMaker, 0, 0, 0},  {&_swigt__p_Xapian__MultiValueKeyMaker, _p_Xapian__MultiValueKeyMakerTo_p_Xapian__KeyMaker, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__MSet[] = {  {&_swigt__p_Xapian__MSet, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__MSetIterator[] = {  {&_swigt__p_Xapian__MSetIterator, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__MatchDecider[] = {  {&_swigt__p_Xapian__MatchDecider, 0, 0, 0},  {&_swigt__p_Xapian__ValueSetMatchDecider, _p_Xapian__ValueSetMatchDeciderTo_p_Xapian__MatchDecider, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__MatchSpy[] = {  {&_swigt__p_Xapian__MatchSpy, 0, 0, 0},  {&_swigt__p_Xapian__ValueCountMatchSpy, _p_Xapian__ValueCountMatchSpyTo_p_Xapian__MatchSpy, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__MultiValueKeyMaker[] = {  {&_swigt__p_Xapian__MultiValueKeyMaker, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__MultiValueSorter[] = {  {&_swigt__p_Xapian__MultiValueSorter, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__NumberValueRangeProcessor[] = {  {&_swigt__p_Xapian__NumberValueRangeProcessor, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__PositionIterator[] = {  {&_swigt__p_Xapian__PositionIterator, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__PostingIterator[] = {  {&_swigt__p_Xapian__PostingIterator, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__PostingSource[] = {  {&_swigt__p_Xapian__PostingSource, 0, 0, 0},  {&_swigt__p_Xapian__ValuePostingSource, _p_Xapian__ValuePostingSourceTo_p_Xapian__PostingSource, 0, 0},  {&_swigt__p_Xapian__ValueWeightPostingSource, _p_Xapian__ValueWeightPostingSourceTo_p_Xapian__PostingSource, 0, 0},  {&_swigt__p_Xapian__DecreasingValueWeightPostingSource, _p_Xapian__DecreasingValueWeightPostingSourceTo_p_Xapian__PostingSource, 0, 0},  {&_swigt__p_Xapian__ValueMapPostingSource, _p_Xapian__ValueMapPostingSourceTo_p_Xapian__PostingSource, 0, 0},  {&_swigt__p_Xapian__FixedWeightPostingSource, _p_Xapian__FixedWeightPostingSourceTo_p_Xapian__PostingSource, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__Query[] = {  {&_swigt__p_Xapian__Query, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__QueryParser[] = {  {&_swigt__p_Xapian__QueryParser, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__RSet[] = {  {&_swigt__p_Xapian__RSet, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__Registry[] = {  {&_swigt__p_Xapian__Registry, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__SimpleStopper[] = {  {&_swigt__p_Xapian__SimpleStopper, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__Sorter[] = {  {&_swigt__p_Xapian__Sorter, 0, 0, 0},  {&_swigt__p_Xapian__MultiValueSorter, _p_Xapian__MultiValueSorterTo_p_Xapian__Sorter, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__Stem[] = {  {&_swigt__p_Xapian__Stem, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__StemImplementation[] = {  {&_swigt__p_Xapian__StemImplementation, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__Stopper[] = {  {&_swigt__p_Xapian__Stopper, 0, 0, 0},  {&_swigt__p_Xapian__SimpleStopper, _p_Xapian__SimpleStopperTo_p_Xapian__Stopper, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__StringValueRangeProcessor[] = {  {&_swigt__p_Xapian__StringValueRangeProcessor, 0, 0, 0},  {&_swigt__p_Xapian__DateValueRangeProcessor, _p_Xapian__DateValueRangeProcessorTo_p_Xapian__StringValueRangeProcessor, 0, 0},  {&_swigt__p_Xapian__NumberValueRangeProcessor, _p_Xapian__NumberValueRangeProcessorTo_p_Xapian__StringValueRangeProcessor, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__TermGenerator[] = {  {&_swigt__p_Xapian__TermGenerator, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__TermIterator[] = {  {&_swigt__p_Xapian__TermIterator, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__TradWeight[] = {  {&_swigt__p_Xapian__TradWeight, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__ValueCountMatchSpy[] = {  {&_swigt__p_Xapian__ValueCountMatchSpy, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__ValueIterator[] = {  {&_swigt__p_Xapian__ValueIterator, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__ValueMapPostingSource[] = {  {&_swigt__p_Xapian__ValueMapPostingSource, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__ValuePostingSource[] = {  {&_swigt__p_Xapian__ValuePostingSource, 0, 0, 0},  {&_swigt__p_Xapian__ValueWeightPostingSource, _p_Xapian__ValueWeightPostingSourceTo_p_Xapian__ValuePostingSource, 0, 0},  {&_swigt__p_Xapian__DecreasingValueWeightPostingSource, _p_Xapian__DecreasingValueWeightPostingSourceTo_p_Xapian__ValuePostingSource, 0, 0},  {&_swigt__p_Xapian__ValueMapPostingSource, _p_Xapian__ValueMapPostingSourceTo_p_Xapian__ValuePostingSource, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__ValueRangeProcessor[] = {  {&_swigt__p_Xapian__ValueRangeProcessor, 0, 0, 0},  {&_swigt__p_Xapian__StringValueRangeProcessor, _p_Xapian__StringValueRangeProcessorTo_p_Xapian__ValueRangeProcessor, 0, 0},  {&_swigt__p_Xapian__DateValueRangeProcessor, _p_Xapian__DateValueRangeProcessorTo_p_Xapian__ValueRangeProcessor, 0, 0},  {&_swigt__p_Xapian__NumberValueRangeProcessor, _p_Xapian__NumberValueRangeProcessorTo_p_Xapian__ValueRangeProcessor, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__ValueSetMatchDecider[] = {  {&_swigt__p_Xapian__ValueSetMatchDecider, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__ValueWeightPostingSource[] = {  {&_swigt__p_Xapian__ValueWeightPostingSource, 0, 0, 0},  {&_swigt__p_Xapian__DecreasingValueWeightPostingSource, _p_Xapian__DecreasingValueWeightPostingSourceTo_p_Xapian__ValueWeightPostingSource, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__Weight[] = {  {&_swigt__p_Xapian__BoolWeight, _p_Xapian__BoolWeightTo_p_Xapian__Weight, 0, 0},  {&_swigt__p_Xapian__TradWeight, _p_Xapian__TradWeightTo_p_Xapian__Weight, 0, 0},  {&_swigt__p_Xapian__Weight, 0, 0, 0},  {&_swigt__p_Xapian__BM25Weight, _p_Xapian__BM25WeightTo_p_Xapian__Weight, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Xapian__WritableDatabase[] = {  {&_swigt__p_Xapian__WritableDatabase, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_compaction_level[] = {  {&_swigt__p_compaction_level, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_docid_order[] = {  {&_swigt__p_docid_order, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_double[] = {  {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_feature_flag[] = {  {&_swigt__p_feature_flag, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_first_type[] = {  {&_swigt__p_first_type, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_op[] = {  {&_swigt__p_op, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_second_type[] = {  {&_swigt__p_second_type, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__string[] = {  {&_swigt__p_std__string, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_stem_strategy[] = {  {&_swigt__p_stem_strategy, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_swig__ConstIterator[] = {  {&_swigt__p_swig__ConstIterator, 0, 0, 0},  {&_swigt__p_swig__Iterator, _p_swig__IteratorTo_p_swig__ConstIterator, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_swig__GC_VALUE[] = {  {&_swigt__p_swig__GC_VALUE, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_swig__Iterator[] = {  {&_swigt__p_swig__Iterator, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_int[] = {  {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_void[] = {  {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};

static swig_cast_info *swig_cast_initial[] = {
  _swigc__p_Xapian__BM25Weight,
  _swigc__p_Xapian__BoolWeight,
  _swigc__p_Xapian__Compactor,
  _swigc__p_Xapian__Database,
  _swigc__p_Xapian__DateValueRangeProcessor,
  _swigc__p_Xapian__DecreasingValueWeightPostingSource,
  _swigc__p_Xapian__Document,
  _swigc__p_Xapian__ESet,
  _swigc__p_Xapian__ESetIterator,
  _swigc__p_Xapian__Enquire,
  _swigc__p_Xapian__ExpandDecider,
  _swigc__p_Xapian__FixedWeightPostingSource,
  _swigc__p_Xapian__KeyMaker,
  _swigc__p_Xapian__MSet,
  _swigc__p_Xapian__MSetIterator,
  _swigc__p_Xapian__MatchDecider,
  _swigc__p_Xapian__MatchSpy,
  _swigc__p_Xapian__MultiValueKeyMaker,
  _swigc__p_Xapian__MultiValueSorter,
  _swigc__p_Xapian__NumberValueRangeProcessor,
  _swigc__p_Xapian__PositionIterator,
  _swigc__p_Xapian__PostingIterator,
  _swigc__p_Xapian__PostingSource,
  _swigc__p_Xapian__Query,
  _swigc__p_Xapian__QueryParser,
  _swigc__p_Xapian__RSet,
  _swigc__p_Xapian__Registry,
  _swigc__p_Xapian__SimpleStopper,
  _swigc__p_Xapian__Sorter,
  _swigc__p_Xapian__Stem,
  _swigc__p_Xapian__StemImplementation,
  _swigc__p_Xapian__Stopper,
  _swigc__p_Xapian__StringValueRangeProcessor,
  _swigc__p_Xapian__TermGenerator,
  _swigc__p_Xapian__TermIterator,
  _swigc__p_Xapian__TradWeight,
  _swigc__p_Xapian__ValueCountMatchSpy,
  _swigc__p_Xapian__ValueIterator,
  _swigc__p_Xapian__ValueMapPostingSource,
  _swigc__p_Xapian__ValuePostingSource,
  _swigc__p_Xapian__ValueRangeProcessor,
  _swigc__p_Xapian__ValueSetMatchDecider,
  _swigc__p_Xapian__ValueWeightPostingSource,
  _swigc__p_Xapian__Weight,
  _swigc__p_Xapian__WritableDatabase,
  _swigc__p_char,
  _swigc__p_compaction_level,
  _swigc__p_docid_order,
  _swigc__p_double,
  _swigc__p_feature_flag,
  _swigc__p_first_type,
  _swigc__p_int,
  _swigc__p_op,
  _swigc__p_second_type,
  _swigc__p_std__string,
  _swigc__p_stem_strategy,
  _swigc__p_swig__ConstIterator,
  _swigc__p_swig__GC_VALUE,
  _swigc__p_swig__Iterator,
  _swigc__p_unsigned_int,
  _swigc__p_void,
};


/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */

/* -----------------------------------------------------------------------------
 * Type initialization:
 * This problem is tough by the requirement that no dynamic 
 * memory is used. Also, since swig_type_info structures store pointers to 
 * swig_cast_info structures and swig_cast_info structures store pointers back
 * to swig_type_info structures, we need some lookup code at initialization. 
 * The idea is that swig generates all the structures that are needed. 
 * The runtime then collects these partially filled structures. 
 * The SWIG_InitializeModule function takes these initial arrays out of 
 * swig_module, and does all the lookup, filling in the swig_module.types
 * array with the correct data and linking the correct swig_cast_info
 * structures together.
 *
 * The generated swig_type_info structures are assigned staticly to an initial 
 * array. We just loop through that array, and handle each type individually.
 * First we lookup if this type has been already loaded, and if so, use the
 * loaded structure instead of the generated one. Then we have to fill in the
 * cast linked list. The cast data is initially stored in something like a
 * two-dimensional array. Each row corresponds to a type (there are the same
 * number of rows as there are in the swig_type_initial array). Each entry in
 * a column is one of the swig_cast_info structures for that type.
 * The cast_initial array is actually an array of arrays, because each row has
 * a variable number of columns. So to actually build the cast linked list,
 * we find the array of casts associated with the type, and loop through it 
 * adding the casts to the list. The one last trick we need to do is making
 * sure the type pointer in the swig_cast_info struct is correct.
 *
 * First off, we lookup the cast->type name to see if it is already loaded. 
 * There are three cases to handle:
 *  1) If the cast->type has already been loaded AND the type we are adding
 *     casting info to has not been loaded (it is in this module), THEN we
 *     replace the cast->type pointer with the type pointer that has already
 *     been loaded.
 *  2) If BOTH types (the one we are adding casting info to, and the 
 *     cast->type) are loaded, THEN the cast info has already been loaded by
 *     the previous module so we just ignore it.
 *  3) Finally, if cast->type has not already been loaded, then we add that
 *     swig_cast_info to the linked list (because the cast->type) pointer will
 *     be correct.
 * ----------------------------------------------------------------------------- */

#ifdef __cplusplus
extern "C" {
#if 0
} /* c-mode */
#endif
#endif

#if 0
#define SWIGRUNTIME_DEBUG
#endif


SWIGRUNTIME void
SWIG_InitializeModule(void *clientdata) {
  size_t i;
  swig_module_info *module_head, *iter;
  int found, init;

  clientdata = clientdata;

  /* check to see if the circular list has been setup, if not, set it up */
  if (swig_module.next==0) {
    /* Initialize the swig_module */
    swig_module.type_initial = swig_type_initial;
    swig_module.cast_initial = swig_cast_initial;
    swig_module.next = &swig_module;
    init = 1;
  } else {
    init = 0;
  }

  /* Try and load any already created modules */
  module_head = SWIG_GetModule(clientdata);
  if (!module_head) {
    /* This is the first module loaded for this interpreter */
    /* so set the swig module into the interpreter */
    SWIG_SetModule(clientdata, &swig_module);
    module_head = &swig_module;
  } else {
    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
    found=0;
    iter=module_head;
    do {
      if (iter==&swig_module) {
        found=1;
        break;
      }
      iter=iter->next;
    } while (iter!= module_head);

    /* if the is found in the list, then all is done and we may leave */
    if (found) return;
    /* otherwise we must add out module into the list */
    swig_module.next = module_head->next;
    module_head->next = &swig_module;
  }

  /* When multiple interpeters are used, a module could have already been initialized in
     a different interpreter, but not yet have a pointer in this interpreter.
     In this case, we do not want to continue adding types... everything should be
     set up already */
  if (init == 0) return;

  /* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
#endif
  for (i = 0; i < swig_module.size; ++i) {
    swig_type_info *type = 0;
    swig_type_info *ret;
    swig_cast_info *cast;
  
#ifdef SWIGRUNTIME_DEBUG
    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
#endif

    /* if there is another module already loaded */
    if (swig_module.next != &swig_module) {
      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
    }
    if (type) {
      /* Overwrite clientdata field */
#ifdef SWIGRUNTIME_DEBUG
      printf("SWIG_InitializeModule: found type %s\n", type->name);
#endif
      if (swig_module.type_initial[i]->clientdata) {
	type->clientdata = swig_module.type_initial[i]->clientdata;
#ifdef SWIGRUNTIME_DEBUG
      printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
#endif
      }
    } else {
      type = swig_module.type_initial[i];
    }

    /* Insert casting types */
    cast = swig_module.cast_initial[i];
    while (cast->type) {
    
      /* Don't need to add information already in the list */
      ret = 0;
#ifdef SWIGRUNTIME_DEBUG
      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
#endif
      if (swig_module.next != &swig_module) {
        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
#ifdef SWIGRUNTIME_DEBUG
	if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
#endif
      }
      if (ret) {
	if (type == swig_module.type_initial[i]) {
#ifdef SWIGRUNTIME_DEBUG
	  printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
#endif
	  cast->type = ret;
	  ret = 0;
	} else {
	  /* Check for casting already in the list */
	  swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
#ifdef SWIGRUNTIME_DEBUG
	  if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
#endif
	  if (!ocast) ret = 0;
	}
      }

      if (!ret) {
#ifdef SWIGRUNTIME_DEBUG
	printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
#endif
        if (type->cast) {
          type->cast->prev = cast;
          cast->next = type->cast;
        }
        type->cast = cast;
      }
      cast++;
    }
    /* Set entry in modules->types array equal to the type */
    swig_module.types[i] = type;
  }
  swig_module.types[i] = 0;

#ifdef SWIGRUNTIME_DEBUG
  printf("**** SWIG_InitializeModule: Cast List ******\n");
  for (i = 0; i < swig_module.size; ++i) {
    int j = 0;
    swig_cast_info *cast = swig_module.cast_initial[i];
    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
    while (cast->type) {
      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
      cast++;
      ++j;
    }
  printf("---- Total casts: %d\n",j);
  }
  printf("**** SWIG_InitializeModule: Cast List ******\n");
#endif
}

/* This function will propagate the clientdata field of type to
* any new swig_type_info structures that have been added into the list
* of equivalent types.  It is like calling
* SWIG_TypeClientData(type, clientdata) a second time.
*/
SWIGRUNTIME void
SWIG_PropagateClientData(void) {
  size_t i;
  swig_cast_info *equiv;
  static int init_run = 0;

  if (init_run) return;
  init_run = 1;

  for (i = 0; i < swig_module.size; i++) {
    if (swig_module.types[i]->clientdata) {
      equiv = swig_module.types[i]->cast;
      while (equiv) {
        if (!equiv->converter) {
          if (equiv->type && !equiv->type->clientdata)
            SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
        }
        equiv = equiv->next;
      }
    }
  }
}

#ifdef __cplusplus
#if 0
{ /* c-mode */
#endif
}
#endif

/*

*/
#ifdef __cplusplus
extern "C"
#endif
SWIGEXPORT void Init__xapian(void) {
  size_t i;
  
  SWIG_InitRuntime();
  mXapian = rb_define_module("Xapian");
  
  SWIG_InitializeModule(0);
  for (i = 0; i < swig_module.size; i++) {
    SWIG_define_class(swig_module.types[i]);
  }
  
  SWIG_RubyInitializeTrackings();
  
  SwigClassGC_VALUE.klass = rb_define_class_under(mXapian, "GC_VALUE", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_swig__GC_VALUE, (void *) &SwigClassGC_VALUE);
  rb_undef_alloc_func(SwigClassGC_VALUE.klass);
  rb_define_method(SwigClassGC_VALUE.klass, "inspect", VALUEFUNC(_wrap_GC_VALUE_inspect), -1);
  rb_define_method(SwigClassGC_VALUE.klass, "to_s", VALUEFUNC(_wrap_GC_VALUE_to_s), -1);
  SwigClassGC_VALUE.mark = 0;
  SwigClassGC_VALUE.trackObjects = 0;
  
  swig::GC_VALUE::initialize();
  
  
  SwigClassConstIterator.klass = rb_define_class_under(mXapian, "ConstIterator", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_swig__ConstIterator, (void *) &SwigClassConstIterator);
  rb_undef_alloc_func(SwigClassConstIterator.klass);
  rb_define_method(SwigClassConstIterator.klass, "value", VALUEFUNC(_wrap_ConstIterator_value), -1);
  rb_define_method(SwigClassConstIterator.klass, "dup", VALUEFUNC(_wrap_ConstIterator_dup), -1);
  rb_define_method(SwigClassConstIterator.klass, "inspect", VALUEFUNC(_wrap_ConstIterator_inspect), -1);
  rb_define_method(SwigClassConstIterator.klass, "to_s", VALUEFUNC(_wrap_ConstIterator_to_s), -1);
  rb_define_method(SwigClassConstIterator.klass, "next", VALUEFUNC(_wrap_ConstIterator_next), -1);
  rb_define_method(SwigClassConstIterator.klass, "previous", VALUEFUNC(_wrap_ConstIterator_previous), -1);
  rb_define_method(SwigClassConstIterator.klass, "==", VALUEFUNC(_wrap_ConstIterator___eq__), -1);
  rb_define_method(SwigClassConstIterator.klass, "+", VALUEFUNC(_wrap_ConstIterator___add__), -1);
  rb_define_method(SwigClassConstIterator.klass, "-", VALUEFUNC(_wrap_ConstIterator___sub__), -1);
  SwigClassConstIterator.mark = 0;
  SwigClassConstIterator.destroy = (void (*)(void *)) free_swig_ConstIterator;
  SwigClassConstIterator.trackObjects = 0;
  
  SwigClassIterator.klass = rb_define_class_under(mXapian, "Iterator", ((swig_class *) SWIGTYPE_p_swig__ConstIterator->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_swig__Iterator, (void *) &SwigClassIterator);
  rb_undef_alloc_func(SwigClassIterator.klass);
  rb_define_method(SwigClassIterator.klass, "value=", VALUEFUNC(_wrap_Iterator_valuee___), -1);
  rb_define_method(SwigClassIterator.klass, "dup", VALUEFUNC(_wrap_Iterator_dup), -1);
  rb_define_method(SwigClassIterator.klass, "next", VALUEFUNC(_wrap_Iterator_next), -1);
  rb_define_method(SwigClassIterator.klass, "previous", VALUEFUNC(_wrap_Iterator_previous), -1);
  rb_define_method(SwigClassIterator.klass, "inspect", VALUEFUNC(_wrap_Iterator_inspect), -1);
  rb_define_method(SwigClassIterator.klass, "to_s", VALUEFUNC(_wrap_Iterator_to_s), -1);
  rb_define_method(SwigClassIterator.klass, "==", VALUEFUNC(_wrap_Iterator___eq__), -1);
  rb_define_method(SwigClassIterator.klass, "+", VALUEFUNC(_wrap_Iterator___add__), -1);
  rb_define_method(SwigClassIterator.klass, "-", VALUEFUNC(_wrap_Iterator___sub__), -1);
  SwigClassIterator.mark = 0;
  SwigClassIterator.destroy = (void (*)(void *)) free_swig_Iterator;
  SwigClassIterator.trackObjects = 0;
  rb_define_singleton_method(mXapian, "BAD_VALUENO", VALUEFUNC(_wrap_BAD_VALUENO_get), 0);
  rb_define_module_function(mXapian, "version_string", VALUEFUNC(_wrap_version_string), -1);
  rb_define_module_function(mXapian, "major_version", VALUEFUNC(_wrap_major_version), -1);
  rb_define_module_function(mXapian, "minor_version", VALUEFUNC(_wrap_minor_version), -1);
  rb_define_module_function(mXapian, "revision", VALUEFUNC(_wrap_revision), -1);
  
  SwigClassPositionIterator.klass = rb_define_class_under(mXapian, "PositionIterator", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__PositionIterator, (void *) &SwigClassPositionIterator);
  rb_define_alloc_func(SwigClassPositionIterator.klass, _wrap_PositionIterator_allocate);
  rb_define_method(SwigClassPositionIterator.klass, "initialize", VALUEFUNC(_wrap_new_PositionIterator), -1);
  rb_define_method(SwigClassPositionIterator.klass, "termpos", VALUEFUNC(_wrap_PositionIterator_termpos), -1);
  rb_define_method(SwigClassPositionIterator.klass, "next", VALUEFUNC(_wrap_PositionIterator_next), -1);
  rb_define_method(SwigClassPositionIterator.klass, "equals", VALUEFUNC(_wrap_PositionIterator_equals), -1);
  rb_define_method(SwigClassPositionIterator.klass, "skip_to", VALUEFUNC(_wrap_PositionIterator_skip_to), -1);
  rb_define_method(SwigClassPositionIterator.klass, "description", VALUEFUNC(_wrap_PositionIterator_description), -1);
  SwigClassPositionIterator.mark = 0;
  SwigClassPositionIterator.destroy = (void (*)(void *)) free_Xapian_PositionIterator;
  SwigClassPositionIterator.trackObjects = 0;
  
  SwigClassPostingIterator.klass = rb_define_class_under(mXapian, "PostingIterator", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__PostingIterator, (void *) &SwigClassPostingIterator);
  rb_define_alloc_func(SwigClassPostingIterator.klass, _wrap_PostingIterator_allocate);
  rb_define_method(SwigClassPostingIterator.klass, "initialize", VALUEFUNC(_wrap_new_PostingIterator), -1);
  rb_define_method(SwigClassPostingIterator.klass, "skip_to", VALUEFUNC(_wrap_PostingIterator_skip_to), -1);
  rb_define_method(SwigClassPostingIterator.klass, "doclength", VALUEFUNC(_wrap_PostingIterator_doclength), -1);
  rb_define_method(SwigClassPostingIterator.klass, "wdf", VALUEFUNC(_wrap_PostingIterator_wdf), -1);
  rb_define_method(SwigClassPostingIterator.klass, "_dangerous_positionlist_begin", VALUEFUNC(_wrap_PostingIterator__dangerous_positionlist_begin), -1);
  rb_define_method(SwigClassPostingIterator.klass, "_dangerous_positionlist_end", VALUEFUNC(_wrap_PostingIterator__dangerous_positionlist_end), -1);
  rb_define_method(SwigClassPostingIterator.klass, "description", VALUEFUNC(_wrap_PostingIterator_description), -1);
  rb_define_method(SwigClassPostingIterator.klass, "docid", VALUEFUNC(_wrap_PostingIterator_docid), -1);
  rb_define_method(SwigClassPostingIterator.klass, "next", VALUEFUNC(_wrap_PostingIterator_next), -1);
  rb_define_method(SwigClassPostingIterator.klass, "equals", VALUEFUNC(_wrap_PostingIterator_equals), -1);
  SwigClassPostingIterator.mark = 0;
  SwigClassPostingIterator.destroy = (void (*)(void *)) free_Xapian_PostingIterator;
  SwigClassPostingIterator.trackObjects = 0;
  rb_define_module_function(mXapian, "==", VALUEFUNC(_wrap___eq__), -1);
  
  SwigClassTermIterator.klass = rb_define_class_under(mXapian, "TermIterator", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__TermIterator, (void *) &SwigClassTermIterator);
  rb_define_alloc_func(SwigClassTermIterator.klass, _wrap_TermIterator_allocate);
  rb_define_method(SwigClassTermIterator.klass, "initialize", VALUEFUNC(_wrap_new_TermIterator), -1);
  rb_define_method(SwigClassTermIterator.klass, "term", VALUEFUNC(_wrap_TermIterator_term), -1);
  rb_define_method(SwigClassTermIterator.klass, "next", VALUEFUNC(_wrap_TermIterator_next), -1);
  rb_define_method(SwigClassTermIterator.klass, "equals", VALUEFUNC(_wrap_TermIterator_equals), -1);
  rb_define_method(SwigClassTermIterator.klass, "skip_to", VALUEFUNC(_wrap_TermIterator_skip_to), -1);
  rb_define_method(SwigClassTermIterator.klass, "wdf", VALUEFUNC(_wrap_TermIterator_wdf), -1);
  rb_define_method(SwigClassTermIterator.klass, "termfreq", VALUEFUNC(_wrap_TermIterator_termfreq), -1);
  rb_define_method(SwigClassTermIterator.klass, "positionlist_count", VALUEFUNC(_wrap_TermIterator_positionlist_count), -1);
  rb_define_method(SwigClassTermIterator.klass, "_dangerous_positionlist_begin", VALUEFUNC(_wrap_TermIterator__dangerous_positionlist_begin), -1);
  rb_define_method(SwigClassTermIterator.klass, "_dangerous_positionlist_end", VALUEFUNC(_wrap_TermIterator__dangerous_positionlist_end), -1);
  rb_define_method(SwigClassTermIterator.klass, "description", VALUEFUNC(_wrap_TermIterator_description), -1);
  SwigClassTermIterator.mark = 0;
  SwigClassTermIterator.destroy = (void (*)(void *)) free_Xapian_TermIterator;
  SwigClassTermIterator.trackObjects = 0;
  
  SwigClassValueIterator.klass = rb_define_class_under(mXapian, "ValueIterator", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__ValueIterator, (void *) &SwigClassValueIterator);
  rb_define_alloc_func(SwigClassValueIterator.klass, _wrap_ValueIterator_allocate);
  rb_define_method(SwigClassValueIterator.klass, "initialize", VALUEFUNC(_wrap_new_ValueIterator), -1);
  rb_define_method(SwigClassValueIterator.klass, "value", VALUEFUNC(_wrap_ValueIterator_value), -1);
  rb_define_method(SwigClassValueIterator.klass, "next", VALUEFUNC(_wrap_ValueIterator_next), -1);
  rb_define_method(SwigClassValueIterator.klass, "equals", VALUEFUNC(_wrap_ValueIterator_equals), -1);
  rb_define_method(SwigClassValueIterator.klass, "docid", VALUEFUNC(_wrap_ValueIterator_docid), -1);
  rb_define_method(SwigClassValueIterator.klass, "valueno", VALUEFUNC(_wrap_ValueIterator_valueno), -1);
  rb_define_method(SwigClassValueIterator.klass, "skip_to", VALUEFUNC(_wrap_ValueIterator_skip_to), -1);
  rb_define_method(SwigClassValueIterator.klass, "check", VALUEFUNC(_wrap_ValueIterator_check), -1);
  rb_define_method(SwigClassValueIterator.klass, "description", VALUEFUNC(_wrap_ValueIterator_description), -1);
  SwigClassValueIterator.mark = 0;
  SwigClassValueIterator.destroy = (void (*)(void *)) free_Xapian_ValueIterator;
  SwigClassValueIterator.trackObjects = 0;
  
  SwigClassDocument.klass = rb_define_class_under(mXapian, "Document", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__Document, (void *) &SwigClassDocument);
  rb_define_alloc_func(SwigClassDocument.klass, _wrap_Document_allocate);
  rb_define_method(SwigClassDocument.klass, "initialize", VALUEFUNC(_wrap_new_Document), -1);
  rb_define_method(SwigClassDocument.klass, "value", VALUEFUNC(_wrap_Document_value), -1);
  rb_define_method(SwigClassDocument.klass, "add_value", VALUEFUNC(_wrap_Document_add_value), -1);
  rb_define_method(SwigClassDocument.klass, "remove_value", VALUEFUNC(_wrap_Document_remove_value), -1);
  rb_define_method(SwigClassDocument.klass, "clear_values", VALUEFUNC(_wrap_Document_clear_values), -1);
  rb_define_method(SwigClassDocument.klass, "data", VALUEFUNC(_wrap_Document_data), -1);
  rb_define_method(SwigClassDocument.klass, "data=", VALUEFUNC(_wrap_Document_datae___), -1);
  rb_define_method(SwigClassDocument.klass, "add_posting", VALUEFUNC(_wrap_Document_add_posting), -1);
  rb_define_method(SwigClassDocument.klass, "add_term", VALUEFUNC(_wrap_Document_add_term), -1);
  rb_define_method(SwigClassDocument.klass, "add_boolean_term", VALUEFUNC(_wrap_Document_add_boolean_term), -1);
  rb_define_method(SwigClassDocument.klass, "remove_posting", VALUEFUNC(_wrap_Document_remove_posting), -1);
  rb_define_method(SwigClassDocument.klass, "remove_term", VALUEFUNC(_wrap_Document_remove_term), -1);
  rb_define_method(SwigClassDocument.klass, "clear_terms", VALUEFUNC(_wrap_Document_clear_terms), -1);
  rb_define_method(SwigClassDocument.klass, "termlist_count", VALUEFUNC(_wrap_Document_termlist_count), -1);
  rb_define_method(SwigClassDocument.klass, "_dangerous_termlist_begin", VALUEFUNC(_wrap_Document__dangerous_termlist_begin), -1);
  rb_define_method(SwigClassDocument.klass, "_dangerous_termlist_end", VALUEFUNC(_wrap_Document__dangerous_termlist_end), -1);
  rb_define_method(SwigClassDocument.klass, "values_count", VALUEFUNC(_wrap_Document_values_count), -1);
  rb_define_method(SwigClassDocument.klass, "_dangerous_values_begin", VALUEFUNC(_wrap_Document__dangerous_values_begin), -1);
  rb_define_method(SwigClassDocument.klass, "_dangerous_values_end", VALUEFUNC(_wrap_Document__dangerous_values_end), -1);
  rb_define_method(SwigClassDocument.klass, "docid", VALUEFUNC(_wrap_Document_docid), -1);
  rb_define_method(SwigClassDocument.klass, "serialise", VALUEFUNC(_wrap_Document_serialise), -1);
  rb_define_singleton_method(SwigClassDocument.klass, "unserialise", VALUEFUNC(_wrap_Document_unserialise), -1);
  rb_define_method(SwigClassDocument.klass, "description", VALUEFUNC(_wrap_Document_description), -1);
  SwigClassDocument.mark = 0;
  SwigClassDocument.destroy = (void (*)(void *)) free_Xapian_Document;
  SwigClassDocument.trackObjects = 0;
  rb_define_module_function(mXapian, "disown_PostingSource", VALUEFUNC(_wrap_disown_PostingSource), -1);
  
  SwigClassPostingSource.klass = rb_define_class_under(mXapian, "PostingSource", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__PostingSource, (void *) &SwigClassPostingSource);
  rb_define_alloc_func(SwigClassPostingSource.klass, _wrap_PostingSource_allocate);
  rb_define_protected_method(SwigClassPostingSource.klass, "initialize", VALUEFUNC(_wrap_new_PostingSource), -1);
  rb_define_method(SwigClassPostingSource.klass, "get_termfreq_min", VALUEFUNC(_wrap_PostingSource_get_termfreq_min), -1);
  rb_define_method(SwigClassPostingSource.klass, "get_termfreq_est", VALUEFUNC(_wrap_PostingSource_get_termfreq_est), -1);
  rb_define_method(SwigClassPostingSource.klass, "get_termfreq_max", VALUEFUNC(_wrap_PostingSource_get_termfreq_max), -1);
  rb_define_method(SwigClassPostingSource.klass, "get_maxweight", VALUEFUNC(_wrap_PostingSource_get_maxweight), -1);
  rb_define_method(SwigClassPostingSource.klass, "weight", VALUEFUNC(_wrap_PostingSource_weight), -1);
  rb_define_method(SwigClassPostingSource.klass, "docid", VALUEFUNC(_wrap_PostingSource_docid), -1);
  rb_define_method(SwigClassPostingSource.klass, "next", VALUEFUNC(_wrap_PostingSource_next), -1);
  rb_define_method(SwigClassPostingSource.klass, "skip_to", VALUEFUNC(_wrap_PostingSource_skip_to), -1);
  rb_define_method(SwigClassPostingSource.klass, "check", VALUEFUNC(_wrap_PostingSource_check), -1);
  rb_define_method(SwigClassPostingSource.klass, "at_end", VALUEFUNC(_wrap_PostingSource_at_end), -1);
  rb_define_method(SwigClassPostingSource.klass, "name", VALUEFUNC(_wrap_PostingSource_name), -1);
  rb_define_method(SwigClassPostingSource.klass, "init", VALUEFUNC(_wrap_PostingSource_init), -1);
  rb_define_method(SwigClassPostingSource.klass, "description", VALUEFUNC(_wrap_PostingSource_description), -1);
  SwigClassPostingSource.mark = 0;
  SwigClassPostingSource.destroy = (void (*)(void *)) free_Xapian_PostingSource;
  SwigClassPostingSource.trackObjects = 0;
  
  SwigClassValuePostingSource.klass = rb_define_class_under(mXapian, "ValuePostingSource", ((swig_class *) SWIGTYPE_p_Xapian__PostingSource->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__ValuePostingSource, (void *) &SwigClassValuePostingSource);
  rb_define_alloc_func(SwigClassValuePostingSource.klass, _wrap_ValuePostingSource_allocate);
  rb_define_method(SwigClassValuePostingSource.klass, "initialize", VALUEFUNC(_wrap_new_ValuePostingSource), -1);
  rb_define_method(SwigClassValuePostingSource.klass, "get_termfreq_min", VALUEFUNC(_wrap_ValuePostingSource_get_termfreq_min), -1);
  rb_define_method(SwigClassValuePostingSource.klass, "get_termfreq_est", VALUEFUNC(_wrap_ValuePostingSource_get_termfreq_est), -1);
  rb_define_method(SwigClassValuePostingSource.klass, "get_termfreq_max", VALUEFUNC(_wrap_ValuePostingSource_get_termfreq_max), -1);
  rb_define_method(SwigClassValuePostingSource.klass, "next", VALUEFUNC(_wrap_ValuePostingSource_next), -1);
  rb_define_method(SwigClassValuePostingSource.klass, "skip_to", VALUEFUNC(_wrap_ValuePostingSource_skip_to), -1);
  rb_define_method(SwigClassValuePostingSource.klass, "check", VALUEFUNC(_wrap_ValuePostingSource_check), -1);
  rb_define_method(SwigClassValuePostingSource.klass, "at_end", VALUEFUNC(_wrap_ValuePostingSource_at_end), -1);
  rb_define_method(SwigClassValuePostingSource.klass, "docid", VALUEFUNC(_wrap_ValuePostingSource_docid), -1);
  rb_define_method(SwigClassValuePostingSource.klass, "init", VALUEFUNC(_wrap_ValuePostingSource_init), -1);
  SwigClassValuePostingSource.mark = 0;
  SwigClassValuePostingSource.destroy = (void (*)(void *)) free_Xapian_ValuePostingSource;
  SwigClassValuePostingSource.trackObjects = 0;
  
  SwigClassValueWeightPostingSource.klass = rb_define_class_under(mXapian, "ValueWeightPostingSource", ((swig_class *) SWIGTYPE_p_Xapian__ValuePostingSource->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__ValueWeightPostingSource, (void *) &SwigClassValueWeightPostingSource);
  rb_define_alloc_func(SwigClassValueWeightPostingSource.klass, _wrap_ValueWeightPostingSource_allocate);
  rb_define_method(SwigClassValueWeightPostingSource.klass, "initialize", VALUEFUNC(_wrap_new_ValueWeightPostingSource), -1);
  rb_define_method(SwigClassValueWeightPostingSource.klass, "weight", VALUEFUNC(_wrap_ValueWeightPostingSource_weight), -1);
  rb_define_method(SwigClassValueWeightPostingSource.klass, "name", VALUEFUNC(_wrap_ValueWeightPostingSource_name), -1);
  rb_define_method(SwigClassValueWeightPostingSource.klass, "init", VALUEFUNC(_wrap_ValueWeightPostingSource_init), -1);
  rb_define_method(SwigClassValueWeightPostingSource.klass, "description", VALUEFUNC(_wrap_ValueWeightPostingSource_description), -1);
  SwigClassValueWeightPostingSource.mark = 0;
  SwigClassValueWeightPostingSource.destroy = (void (*)(void *)) free_Xapian_ValueWeightPostingSource;
  SwigClassValueWeightPostingSource.trackObjects = 0;
  
  SwigClassDecreasingValueWeightPostingSource.klass = rb_define_class_under(mXapian, "DecreasingValueWeightPostingSource", ((swig_class *) SWIGTYPE_p_Xapian__ValueWeightPostingSource->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__DecreasingValueWeightPostingSource, (void *) &SwigClassDecreasingValueWeightPostingSource);
  rb_define_alloc_func(SwigClassDecreasingValueWeightPostingSource.klass, _wrap_DecreasingValueWeightPostingSource_allocate);
  rb_define_method(SwigClassDecreasingValueWeightPostingSource.klass, "initialize", VALUEFUNC(_wrap_new_DecreasingValueWeightPostingSource), -1);
  rb_define_method(SwigClassDecreasingValueWeightPostingSource.klass, "weight", VALUEFUNC(_wrap_DecreasingValueWeightPostingSource_weight), -1);
  rb_define_method(SwigClassDecreasingValueWeightPostingSource.klass, "name", VALUEFUNC(_wrap_DecreasingValueWeightPostingSource_name), -1);
  rb_define_method(SwigClassDecreasingValueWeightPostingSource.klass, "init", VALUEFUNC(_wrap_DecreasingValueWeightPostingSource_init), -1);
  rb_define_method(SwigClassDecreasingValueWeightPostingSource.klass, "next", VALUEFUNC(_wrap_DecreasingValueWeightPostingSource_next), -1);
  rb_define_method(SwigClassDecreasingValueWeightPostingSource.klass, "skip_to", VALUEFUNC(_wrap_DecreasingValueWeightPostingSource_skip_to), -1);
  rb_define_method(SwigClassDecreasingValueWeightPostingSource.klass, "check", VALUEFUNC(_wrap_DecreasingValueWeightPostingSource_check), -1);
  rb_define_method(SwigClassDecreasingValueWeightPostingSource.klass, "description", VALUEFUNC(_wrap_DecreasingValueWeightPostingSource_description), -1);
  SwigClassDecreasingValueWeightPostingSource.mark = 0;
  SwigClassDecreasingValueWeightPostingSource.destroy = (void (*)(void *)) free_Xapian_DecreasingValueWeightPostingSource;
  SwigClassDecreasingValueWeightPostingSource.trackObjects = 0;
  
  SwigClassValueMapPostingSource.klass = rb_define_class_under(mXapian, "ValueMapPostingSource", ((swig_class *) SWIGTYPE_p_Xapian__ValuePostingSource->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__ValueMapPostingSource, (void *) &SwigClassValueMapPostingSource);
  rb_define_alloc_func(SwigClassValueMapPostingSource.klass, _wrap_ValueMapPostingSource_allocate);
  rb_define_method(SwigClassValueMapPostingSource.klass, "initialize", VALUEFUNC(_wrap_new_ValueMapPostingSource), -1);
  rb_define_method(SwigClassValueMapPostingSource.klass, "add_mapping", VALUEFUNC(_wrap_ValueMapPostingSource_add_mapping), -1);
  rb_define_method(SwigClassValueMapPostingSource.klass, "clear_mappings", VALUEFUNC(_wrap_ValueMapPostingSource_clear_mappings), -1);
  rb_define_method(SwigClassValueMapPostingSource.klass, "set_default_weight", VALUEFUNC(_wrap_ValueMapPostingSource_set_default_weight), -1);
  rb_define_method(SwigClassValueMapPostingSource.klass, "weight", VALUEFUNC(_wrap_ValueMapPostingSource_weight), -1);
  rb_define_method(SwigClassValueMapPostingSource.klass, "name", VALUEFUNC(_wrap_ValueMapPostingSource_name), -1);
  rb_define_method(SwigClassValueMapPostingSource.klass, "init", VALUEFUNC(_wrap_ValueMapPostingSource_init), -1);
  rb_define_method(SwigClassValueMapPostingSource.klass, "description", VALUEFUNC(_wrap_ValueMapPostingSource_description), -1);
  SwigClassValueMapPostingSource.mark = 0;
  SwigClassValueMapPostingSource.destroy = (void (*)(void *)) free_Xapian_ValueMapPostingSource;
  SwigClassValueMapPostingSource.trackObjects = 0;
  
  SwigClassFixedWeightPostingSource.klass = rb_define_class_under(mXapian, "FixedWeightPostingSource", ((swig_class *) SWIGTYPE_p_Xapian__PostingSource->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__FixedWeightPostingSource, (void *) &SwigClassFixedWeightPostingSource);
  rb_define_alloc_func(SwigClassFixedWeightPostingSource.klass, _wrap_FixedWeightPostingSource_allocate);
  rb_define_method(SwigClassFixedWeightPostingSource.klass, "initialize", VALUEFUNC(_wrap_new_FixedWeightPostingSource), -1);
  rb_define_method(SwigClassFixedWeightPostingSource.klass, "get_termfreq_min", VALUEFUNC(_wrap_FixedWeightPostingSource_get_termfreq_min), -1);
  rb_define_method(SwigClassFixedWeightPostingSource.klass, "get_termfreq_est", VALUEFUNC(_wrap_FixedWeightPostingSource_get_termfreq_est), -1);
  rb_define_method(SwigClassFixedWeightPostingSource.klass, "get_termfreq_max", VALUEFUNC(_wrap_FixedWeightPostingSource_get_termfreq_max), -1);
  rb_define_method(SwigClassFixedWeightPostingSource.klass, "weight", VALUEFUNC(_wrap_FixedWeightPostingSource_weight), -1);
  rb_define_method(SwigClassFixedWeightPostingSource.klass, "next", VALUEFUNC(_wrap_FixedWeightPostingSource_next), -1);
  rb_define_method(SwigClassFixedWeightPostingSource.klass, "skip_to", VALUEFUNC(_wrap_FixedWeightPostingSource_skip_to), -1);
  rb_define_method(SwigClassFixedWeightPostingSource.klass, "check", VALUEFUNC(_wrap_FixedWeightPostingSource_check), -1);
  rb_define_method(SwigClassFixedWeightPostingSource.klass, "at_end", VALUEFUNC(_wrap_FixedWeightPostingSource_at_end), -1);
  rb_define_method(SwigClassFixedWeightPostingSource.klass, "docid", VALUEFUNC(_wrap_FixedWeightPostingSource_docid), -1);
  rb_define_method(SwigClassFixedWeightPostingSource.klass, "name", VALUEFUNC(_wrap_FixedWeightPostingSource_name), -1);
  rb_define_method(SwigClassFixedWeightPostingSource.klass, "init", VALUEFUNC(_wrap_FixedWeightPostingSource_init), -1);
  rb_define_method(SwigClassFixedWeightPostingSource.klass, "description", VALUEFUNC(_wrap_FixedWeightPostingSource_description), -1);
  SwigClassFixedWeightPostingSource.mark = 0;
  SwigClassFixedWeightPostingSource.destroy = (void (*)(void *)) free_Xapian_FixedWeightPostingSource;
  SwigClassFixedWeightPostingSource.trackObjects = 0;
  
  SwigClassMSet.klass = rb_define_class_under(mXapian, "MSet", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__MSet, (void *) &SwigClassMSet);
  rb_define_alloc_func(SwigClassMSet.klass, _wrap_MSet_allocate);
  rb_define_method(SwigClassMSet.klass, "initialize", VALUEFUNC(_wrap_new_MSet), -1);
  rb_define_method(SwigClassMSet.klass, "fetch", VALUEFUNC(_wrap_MSet_fetch), -1);
  rb_define_method(SwigClassMSet.klass, "convert_to_percent", VALUEFUNC(_wrap_MSet_convert_to_percent), -1);
  rb_define_method(SwigClassMSet.klass, "termfreq", VALUEFUNC(_wrap_MSet_termfreq), -1);
  rb_define_method(SwigClassMSet.klass, "termweight", VALUEFUNC(_wrap_MSet_termweight), -1);
  rb_define_method(SwigClassMSet.klass, "firstitem", VALUEFUNC(_wrap_MSet_firstitem), -1);
  rb_define_method(SwigClassMSet.klass, "matches_lower_bound", VALUEFUNC(_wrap_MSet_matches_lower_bound), -1);
  rb_define_method(SwigClassMSet.klass, "matches_estimated", VALUEFUNC(_wrap_MSet_matches_estimated), -1);
  rb_define_method(SwigClassMSet.klass, "matches_upper_bound", VALUEFUNC(_wrap_MSet_matches_upper_bound), -1);
  rb_define_method(SwigClassMSet.klass, "get_uncollapsed_matches_lower_bound", VALUEFUNC(_wrap_MSet_get_uncollapsed_matches_lower_bound), -1);
  rb_define_method(SwigClassMSet.klass, "get_uncollapsed_matches_estimated", VALUEFUNC(_wrap_MSet_get_uncollapsed_matches_estimated), -1);
  rb_define_method(SwigClassMSet.klass, "get_uncollapsed_matches_upper_bound", VALUEFUNC(_wrap_MSet_get_uncollapsed_matches_upper_bound), -1);
  rb_define_method(SwigClassMSet.klass, "max_possible", VALUEFUNC(_wrap_MSet_max_possible), -1);
  rb_define_method(SwigClassMSet.klass, "max_attained", VALUEFUNC(_wrap_MSet_max_attained), -1);
  rb_define_method(SwigClassMSet.klass, "size", VALUEFUNC(_wrap_MSet_size), -1);
  rb_define_method(SwigClassMSet.klass, "empty?", VALUEFUNC(_wrap_MSet_emptyq___), -1);
  rb_define_method(SwigClassMSet.klass, "_begin", VALUEFUNC(_wrap_MSet__begin), -1);
  rb_define_method(SwigClassMSet.klass, "_end", VALUEFUNC(_wrap_MSet__end), -1);
  rb_define_method(SwigClassMSet.klass, "_back", VALUEFUNC(_wrap_MSet__back), -1);
  rb_define_method(SwigClassMSet.klass, "hit", VALUEFUNC(_wrap_MSet_hit), -1);
  rb_define_method(SwigClassMSet.klass, "document_percentage", VALUEFUNC(_wrap_MSet_document_percentage), -1);
  rb_define_method(SwigClassMSet.klass, "document", VALUEFUNC(_wrap_MSet_document), -1);
  rb_define_method(SwigClassMSet.klass, "docid", VALUEFUNC(_wrap_MSet_docid), -1);
  rb_define_method(SwigClassMSet.klass, "description", VALUEFUNC(_wrap_MSet_description), -1);
  SwigClassMSet.mark = 0;
  SwigClassMSet.destroy = (void (*)(void *)) free_Xapian_MSet;
  SwigClassMSet.trackObjects = 0;
  
  SwigClassMSetIterator.klass = rb_define_class_under(mXapian, "MSetIterator", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__MSetIterator, (void *) &SwigClassMSetIterator);
  rb_define_alloc_func(SwigClassMSetIterator.klass, _wrap_MSetIterator_allocate);
  rb_define_method(SwigClassMSetIterator.klass, "initialize", VALUEFUNC(_wrap_new_MSetIterator), -1);
  rb_define_method(SwigClassMSetIterator.klass, "docid", VALUEFUNC(_wrap_MSetIterator_docid), -1);
  rb_define_method(SwigClassMSetIterator.klass, "next", VALUEFUNC(_wrap_MSetIterator_next), -1);
  rb_define_method(SwigClassMSetIterator.klass, "prev", VALUEFUNC(_wrap_MSetIterator_prev), -1);
  rb_define_method(SwigClassMSetIterator.klass, "equals", VALUEFUNC(_wrap_MSetIterator_equals), -1);
  rb_define_method(SwigClassMSetIterator.klass, "document", VALUEFUNC(_wrap_MSetIterator_document), -1);
  rb_define_method(SwigClassMSetIterator.klass, "rank", VALUEFUNC(_wrap_MSetIterator_rank), -1);
  rb_define_method(SwigClassMSetIterator.klass, "weight", VALUEFUNC(_wrap_MSetIterator_weight), -1);
  rb_define_method(SwigClassMSetIterator.klass, "get_collapse_key", VALUEFUNC(_wrap_MSetIterator_get_collapse_key), -1);
  rb_define_method(SwigClassMSetIterator.klass, "collapse_count", VALUEFUNC(_wrap_MSetIterator_collapse_count), -1);
  rb_define_method(SwigClassMSetIterator.klass, "percent", VALUEFUNC(_wrap_MSetIterator_percent), -1);
  rb_define_method(SwigClassMSetIterator.klass, "description", VALUEFUNC(_wrap_MSetIterator_description), -1);
  SwigClassMSetIterator.mark = 0;
  SwigClassMSetIterator.destroy = (void (*)(void *)) free_Xapian_MSetIterator;
  SwigClassMSetIterator.trackObjects = 0;
  
  SwigClassESet.klass = rb_define_class_under(mXapian, "ESet", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__ESet, (void *) &SwigClassESet);
  rb_define_alloc_func(SwigClassESet.klass, _wrap_ESet_allocate);
  rb_define_method(SwigClassESet.klass, "initialize", VALUEFUNC(_wrap_new_ESet), -1);
  rb_define_method(SwigClassESet.klass, "ebound", VALUEFUNC(_wrap_ESet_ebound), -1);
  rb_define_method(SwigClassESet.klass, "size", VALUEFUNC(_wrap_ESet_size), -1);
  rb_define_method(SwigClassESet.klass, "empty?", VALUEFUNC(_wrap_ESet_emptyq___), -1);
  rb_define_method(SwigClassESet.klass, "_begin", VALUEFUNC(_wrap_ESet__begin), -1);
  rb_define_method(SwigClassESet.klass, "_end", VALUEFUNC(_wrap_ESet__end), -1);
  rb_define_method(SwigClassESet.klass, "_back", VALUEFUNC(_wrap_ESet__back), -1);
  rb_define_method(SwigClassESet.klass, "description", VALUEFUNC(_wrap_ESet_description), -1);
  SwigClassESet.mark = 0;
  SwigClassESet.destroy = (void (*)(void *)) free_Xapian_ESet;
  SwigClassESet.trackObjects = 0;
  
  SwigClassESetIterator.klass = rb_define_class_under(mXapian, "ESetIterator", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__ESetIterator, (void *) &SwigClassESetIterator);
  rb_define_alloc_func(SwigClassESetIterator.klass, _wrap_ESetIterator_allocate);
  rb_define_method(SwigClassESetIterator.klass, "initialize", VALUEFUNC(_wrap_new_ESetIterator), -1);
  rb_define_method(SwigClassESetIterator.klass, "term", VALUEFUNC(_wrap_ESetIterator_term), -1);
  rb_define_method(SwigClassESetIterator.klass, "next", VALUEFUNC(_wrap_ESetIterator_next), -1);
  rb_define_method(SwigClassESetIterator.klass, "prev", VALUEFUNC(_wrap_ESetIterator_prev), -1);
  rb_define_method(SwigClassESetIterator.klass, "equals", VALUEFUNC(_wrap_ESetIterator_equals), -1);
  rb_define_method(SwigClassESetIterator.klass, "weight", VALUEFUNC(_wrap_ESetIterator_weight), -1);
  rb_define_method(SwigClassESetIterator.klass, "description", VALUEFUNC(_wrap_ESetIterator_description), -1);
  SwigClassESetIterator.mark = 0;
  SwigClassESetIterator.destroy = (void (*)(void *)) free_Xapian_ESetIterator;
  SwigClassESetIterator.trackObjects = 0;
  
  SwigClassRSet.klass = rb_define_class_under(mXapian, "RSet", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__RSet, (void *) &SwigClassRSet);
  rb_define_alloc_func(SwigClassRSet.klass, _wrap_RSet_allocate);
  rb_define_method(SwigClassRSet.klass, "initialize", VALUEFUNC(_wrap_new_RSet), -1);
  rb_define_method(SwigClassRSet.klass, "size", VALUEFUNC(_wrap_RSet_size), -1);
  rb_define_method(SwigClassRSet.klass, "empty?", VALUEFUNC(_wrap_RSet_emptyq___), -1);
  rb_define_method(SwigClassRSet.klass, "add_document", VALUEFUNC(_wrap_RSet_add_document), -1);
  rb_define_method(SwigClassRSet.klass, "remove_document", VALUEFUNC(_wrap_RSet_remove_document), -1);
  rb_define_method(SwigClassRSet.klass, "contains", VALUEFUNC(_wrap_RSet_contains), -1);
  rb_define_method(SwigClassRSet.klass, "description", VALUEFUNC(_wrap_RSet_description), -1);
  SwigClassRSet.mark = 0;
  SwigClassRSet.destroy = (void (*)(void *)) free_Xapian_RSet;
  SwigClassRSet.trackObjects = 0;
  rb_define_module_function(mXapian, "disown_MatchDecider", VALUEFUNC(_wrap_disown_MatchDecider), -1);
  
  SwigClassMatchDecider.klass = rb_define_class_under(mXapian, "MatchDecider", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__MatchDecider, (void *) &SwigClassMatchDecider);
  rb_define_alloc_func(SwigClassMatchDecider.klass, _wrap_MatchDecider_allocate);
  rb_define_method(SwigClassMatchDecider.klass, "initialize", VALUEFUNC(_wrap_new_MatchDecider), -1);
  rb_define_method(SwigClassMatchDecider.klass, "call", VALUEFUNC(_wrap_MatchDecider___call__), -1);
  SwigClassMatchDecider.mark = 0;
  SwigClassMatchDecider.destroy = (void (*)(void *)) free_Xapian_MatchDecider;
  SwigClassMatchDecider.trackObjects = 0;
  rb_define_module_function(mXapian, "disown_ExpandDecider", VALUEFUNC(_wrap_disown_ExpandDecider), -1);
  
  SwigClassExpandDecider.klass = rb_define_class_under(mXapian, "ExpandDecider", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__ExpandDecider, (void *) &SwigClassExpandDecider);
  rb_define_alloc_func(SwigClassExpandDecider.klass, _wrap_ExpandDecider_allocate);
  rb_define_method(SwigClassExpandDecider.klass, "initialize", VALUEFUNC(_wrap_new_ExpandDecider), -1);
  rb_define_method(SwigClassExpandDecider.klass, "call", VALUEFUNC(_wrap_ExpandDecider___call__), -1);
  SwigClassExpandDecider.mark = 0;
  SwigClassExpandDecider.destroy = (void (*)(void *)) free_Xapian_ExpandDecider;
  SwigClassExpandDecider.trackObjects = 0;
  
  SwigClassEnquire.klass = rb_define_class_under(mXapian, "Enquire", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__Enquire, (void *) &SwigClassEnquire);
  rb_define_alloc_func(SwigClassEnquire.klass, _wrap_Enquire_allocate);
  rb_define_method(SwigClassEnquire.klass, "initialize", VALUEFUNC(_wrap_new_Enquire), -1);
  rb_define_method(SwigClassEnquire.klass, "query!", VALUEFUNC(_wrap_Enquire_queryN___), -1);
  rb_define_method(SwigClassEnquire.klass, "query=", VALUEFUNC(_wrap_Enquire_querye___), -1);
  rb_define_method(SwigClassEnquire.klass, "query", VALUEFUNC(_wrap_Enquire_query), -1);
  rb_define_method(SwigClassEnquire.klass, "add_matchspy", VALUEFUNC(_wrap_Enquire_add_matchspy), -1);
  rb_define_method(SwigClassEnquire.klass, "clear_matchspies", VALUEFUNC(_wrap_Enquire_clear_matchspies), -1);
  rb_define_method(SwigClassEnquire.klass, "weighting_scheme=", VALUEFUNC(_wrap_Enquire_weighting_schemee___), -1);
  rb_define_method(SwigClassEnquire.klass, "collapse_key=", VALUEFUNC(_wrap_Enquire_collapse_keye___), -1);
  rb_define_const(SwigClassEnquire.klass, "ASCENDING", SWIG_From_int(static_cast< int >(Xapian::Enquire::ASCENDING)));
  rb_define_const(SwigClassEnquire.klass, "DESCENDING", SWIG_From_int(static_cast< int >(Xapian::Enquire::DESCENDING)));
  rb_define_const(SwigClassEnquire.klass, "DONT_CARE", SWIG_From_int(static_cast< int >(Xapian::Enquire::DONT_CARE)));
  rb_define_method(SwigClassEnquire.klass, "docid_order=", VALUEFUNC(_wrap_Enquire_docid_ordere___), -1);
  rb_define_method(SwigClassEnquire.klass, "cutoff!", VALUEFUNC(_wrap_Enquire_cutoffN___), -1);
  rb_define_method(SwigClassEnquire.klass, "sort_by_relevance!", VALUEFUNC(_wrap_Enquire_sort_by_relevanceN___), -1);
  rb_define_method(SwigClassEnquire.klass, "sort_by_value!", VALUEFUNC(_wrap_Enquire_sort_by_valueN___), -1);
  rb_define_method(SwigClassEnquire.klass, "sort_by_value_then_relevance!", VALUEFUNC(_wrap_Enquire_sort_by_value_then_relevanceN___), -1);
  rb_define_method(SwigClassEnquire.klass, "sort_by_relevance_then_value!", VALUEFUNC(_wrap_Enquire_sort_by_relevance_then_valueN___), -1);
  rb_define_method(SwigClassEnquire.klass, "set_sort_by_key", VALUEFUNC(_wrap_Enquire_set_sort_by_key), -1);
  rb_define_method(SwigClassEnquire.klass, "set_sort_by_key_then_relevance", VALUEFUNC(_wrap_Enquire_set_sort_by_key_then_relevance), -1);
  rb_define_method(SwigClassEnquire.klass, "set_sort_by_relevance_then_key", VALUEFUNC(_wrap_Enquire_set_sort_by_relevance_then_key), -1);
  rb_define_const(SwigClassEnquire.klass, "INCLUDE_QUERY_TERMS", SWIG_From_int(static_cast< int >(Xapian::Enquire::INCLUDE_QUERY_TERMS)));
  rb_define_const(SwigClassEnquire.klass, "USE_EXACT_TERMFREQ", SWIG_From_int(static_cast< int >(Xapian::Enquire::USE_EXACT_TERMFREQ)));
  rb_define_method(SwigClassEnquire.klass, "mset", VALUEFUNC(_wrap_Enquire_mset), -1);
  rb_define_method(SwigClassEnquire.klass, "eset", VALUEFUNC(_wrap_Enquire_eset), -1);
  rb_define_method(SwigClassEnquire.klass, "_dangerous_matching_terms_begin", VALUEFUNC(_wrap_Enquire__dangerous_matching_terms_begin), -1);
  rb_define_method(SwigClassEnquire.klass, "_dangerous_matching_terms_end", VALUEFUNC(_wrap_Enquire__dangerous_matching_terms_end), -1);
  rb_define_method(SwigClassEnquire.klass, "description", VALUEFUNC(_wrap_Enquire_description), -1);
  SwigClassEnquire.mark = 0;
  SwigClassEnquire.destroy = (void (*)(void *)) free_Xapian_Enquire;
  SwigClassEnquire.trackObjects = 0;
  
  SwigClassRegistry.klass = rb_define_class_under(mXapian, "Registry", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__Registry, (void *) &SwigClassRegistry);
  rb_define_alloc_func(SwigClassRegistry.klass, _wrap_Registry_allocate);
  rb_define_method(SwigClassRegistry.klass, "initialize", VALUEFUNC(_wrap_new_Registry), -1);
  rb_define_method(SwigClassRegistry.klass, "register_weighting_scheme", VALUEFUNC(_wrap_Registry_register_weighting_scheme), -1);
  rb_define_method(SwigClassRegistry.klass, "get_weighting_scheme", VALUEFUNC(_wrap_Registry_get_weighting_scheme), -1);
  rb_define_method(SwigClassRegistry.klass, "register_posting_source", VALUEFUNC(_wrap_Registry_register_posting_source), -1);
  rb_define_method(SwigClassRegistry.klass, "get_posting_source", VALUEFUNC(_wrap_Registry_get_posting_source), -1);
  rb_define_method(SwigClassRegistry.klass, "register_match_spy", VALUEFUNC(_wrap_Registry_register_match_spy), -1);
  rb_define_method(SwigClassRegistry.klass, "get_match_spy", VALUEFUNC(_wrap_Registry_get_match_spy), -1);
  SwigClassRegistry.mark = 0;
  SwigClassRegistry.destroy = (void (*)(void *)) free_Xapian_Registry;
  SwigClassRegistry.trackObjects = 0;
  
  SwigClassWeight.klass = rb_define_class_under(mXapian, "Weight", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__Weight, (void *) &SwigClassWeight);
  rb_undef_alloc_func(SwigClassWeight.klass);
  rb_define_method(SwigClassWeight.klass, "name", VALUEFUNC(_wrap_Weight_name), -1);
  rb_define_method(SwigClassWeight.klass, "sumpart", VALUEFUNC(_wrap_Weight_sumpart), -1);
  rb_define_method(SwigClassWeight.klass, "maxpart", VALUEFUNC(_wrap_Weight_maxpart), -1);
  rb_define_method(SwigClassWeight.klass, "sumextra", VALUEFUNC(_wrap_Weight_sumextra), -1);
  rb_define_method(SwigClassWeight.klass, "maxextra", VALUEFUNC(_wrap_Weight_maxextra), -1);
  rb_define_method(SwigClassWeight.klass, "get_sumpart_needs_doclength_", VALUEFUNC(_wrap_Weight_get_sumpart_needs_doclength_), -1);
  rb_define_method(SwigClassWeight.klass, "get_sumpart_needs_wdf_", VALUEFUNC(_wrap_Weight_get_sumpart_needs_wdf_), -1);
  SwigClassWeight.mark = 0;
  SwigClassWeight.destroy = (void (*)(void *)) free_Xapian_Weight;
  SwigClassWeight.trackObjects = 0;
  
  SwigClassBoolWeight.klass = rb_define_class_under(mXapian, "BoolWeight", ((swig_class *) SWIGTYPE_p_Xapian__Weight->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__BoolWeight, (void *) &SwigClassBoolWeight);
  rb_define_alloc_func(SwigClassBoolWeight.klass, _wrap_BoolWeight_allocate);
  rb_define_method(SwigClassBoolWeight.klass, "initialize", VALUEFUNC(_wrap_new_BoolWeight), -1);
  rb_define_method(SwigClassBoolWeight.klass, "name", VALUEFUNC(_wrap_BoolWeight_name), -1);
  rb_define_method(SwigClassBoolWeight.klass, "sumpart", VALUEFUNC(_wrap_BoolWeight_sumpart), -1);
  rb_define_method(SwigClassBoolWeight.klass, "maxpart", VALUEFUNC(_wrap_BoolWeight_maxpart), -1);
  rb_define_method(SwigClassBoolWeight.klass, "sumextra", VALUEFUNC(_wrap_BoolWeight_sumextra), -1);
  rb_define_method(SwigClassBoolWeight.klass, "maxextra", VALUEFUNC(_wrap_BoolWeight_maxextra), -1);
  SwigClassBoolWeight.mark = 0;
  SwigClassBoolWeight.destroy = (void (*)(void *)) free_Xapian_BoolWeight;
  SwigClassBoolWeight.trackObjects = 0;
  
  SwigClassBM25Weight.klass = rb_define_class_under(mXapian, "BM25Weight", ((swig_class *) SWIGTYPE_p_Xapian__Weight->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__BM25Weight, (void *) &SwigClassBM25Weight);
  rb_define_alloc_func(SwigClassBM25Weight.klass, _wrap_BM25Weight_allocate);
  rb_define_method(SwigClassBM25Weight.klass, "initialize", VALUEFUNC(_wrap_new_BM25Weight), -1);
  rb_define_method(SwigClassBM25Weight.klass, "name", VALUEFUNC(_wrap_BM25Weight_name), -1);
  rb_define_method(SwigClassBM25Weight.klass, "sumpart", VALUEFUNC(_wrap_BM25Weight_sumpart), -1);
  rb_define_method(SwigClassBM25Weight.klass, "maxpart", VALUEFUNC(_wrap_BM25Weight_maxpart), -1);
  rb_define_method(SwigClassBM25Weight.klass, "sumextra", VALUEFUNC(_wrap_BM25Weight_sumextra), -1);
  rb_define_method(SwigClassBM25Weight.klass, "maxextra", VALUEFUNC(_wrap_BM25Weight_maxextra), -1);
  SwigClassBM25Weight.mark = 0;
  SwigClassBM25Weight.destroy = (void (*)(void *)) free_Xapian_BM25Weight;
  SwigClassBM25Weight.trackObjects = 0;
  
  SwigClassTradWeight.klass = rb_define_class_under(mXapian, "TradWeight", ((swig_class *) SWIGTYPE_p_Xapian__Weight->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__TradWeight, (void *) &SwigClassTradWeight);
  rb_define_alloc_func(SwigClassTradWeight.klass, _wrap_TradWeight_allocate);
  rb_define_method(SwigClassTradWeight.klass, "initialize", VALUEFUNC(_wrap_new_TradWeight), -1);
  rb_define_method(SwigClassTradWeight.klass, "name", VALUEFUNC(_wrap_TradWeight_name), -1);
  rb_define_method(SwigClassTradWeight.klass, "sumpart", VALUEFUNC(_wrap_TradWeight_sumpart), -1);
  rb_define_method(SwigClassTradWeight.klass, "maxpart", VALUEFUNC(_wrap_TradWeight_maxpart), -1);
  rb_define_method(SwigClassTradWeight.klass, "sumextra", VALUEFUNC(_wrap_TradWeight_sumextra), -1);
  rb_define_method(SwigClassTradWeight.klass, "maxextra", VALUEFUNC(_wrap_TradWeight_maxextra), -1);
  SwigClassTradWeight.mark = 0;
  SwigClassTradWeight.destroy = (void (*)(void *)) free_Xapian_TradWeight;
  SwigClassTradWeight.trackObjects = 0;
  rb_define_module_function(mXapian, "disown_MatchSpy", VALUEFUNC(_wrap_disown_MatchSpy), -1);
  
  SwigClassMatchSpy.klass = rb_define_class_under(mXapian, "MatchSpy", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__MatchSpy, (void *) &SwigClassMatchSpy);
  rb_define_alloc_func(SwigClassMatchSpy.klass, _wrap_MatchSpy_allocate);
  rb_define_protected_method(SwigClassMatchSpy.klass, "initialize", VALUEFUNC(_wrap_new_MatchSpy), -1);
  rb_define_method(SwigClassMatchSpy.klass, "call", VALUEFUNC(_wrap_MatchSpy___call__), -1);
  rb_define_method(SwigClassMatchSpy.klass, "name", VALUEFUNC(_wrap_MatchSpy_name), -1);
  rb_define_method(SwigClassMatchSpy.klass, "merge_results", VALUEFUNC(_wrap_MatchSpy_merge_results), -1);
  rb_define_method(SwigClassMatchSpy.klass, "description", VALUEFUNC(_wrap_MatchSpy_description), -1);
  SwigClassMatchSpy.mark = 0;
  SwigClassMatchSpy.destroy = (void (*)(void *)) free_Xapian_MatchSpy;
  SwigClassMatchSpy.trackObjects = 0;
  
  SwigClassValueCountMatchSpy.klass = rb_define_class_under(mXapian, "ValueCountMatchSpy", ((swig_class *) SWIGTYPE_p_Xapian__MatchSpy->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__ValueCountMatchSpy, (void *) &SwigClassValueCountMatchSpy);
  rb_define_alloc_func(SwigClassValueCountMatchSpy.klass, _wrap_ValueCountMatchSpy_allocate);
  rb_define_method(SwigClassValueCountMatchSpy.klass, "initialize", VALUEFUNC(_wrap_new_ValueCountMatchSpy), -1);
  rb_define_method(SwigClassValueCountMatchSpy.klass, "get_total", VALUEFUNC(_wrap_ValueCountMatchSpy_get_total), -1);
  rb_define_method(SwigClassValueCountMatchSpy.klass, "_dangerous_values_begin", VALUEFUNC(_wrap_ValueCountMatchSpy__dangerous_values_begin), -1);
  rb_define_method(SwigClassValueCountMatchSpy.klass, "_dangerous_values_end", VALUEFUNC(_wrap_ValueCountMatchSpy__dangerous_values_end), -1);
  rb_define_method(SwigClassValueCountMatchSpy.klass, "_dangerous_top_values_begin", VALUEFUNC(_wrap_ValueCountMatchSpy__dangerous_top_values_begin), -1);
  rb_define_method(SwigClassValueCountMatchSpy.klass, "_dangerous_top_values_end", VALUEFUNC(_wrap_ValueCountMatchSpy__dangerous_top_values_end), -1);
  rb_define_method(SwigClassValueCountMatchSpy.klass, "call", VALUEFUNC(_wrap_ValueCountMatchSpy___call__), -1);
  rb_define_method(SwigClassValueCountMatchSpy.klass, "name", VALUEFUNC(_wrap_ValueCountMatchSpy_name), -1);
  rb_define_method(SwigClassValueCountMatchSpy.klass, "merge_results", VALUEFUNC(_wrap_ValueCountMatchSpy_merge_results), -1);
  rb_define_method(SwigClassValueCountMatchSpy.klass, "description", VALUEFUNC(_wrap_ValueCountMatchSpy_description), -1);
  SwigClassValueCountMatchSpy.mark = 0;
  SwigClassValueCountMatchSpy.destroy = (void (*)(void *)) free_Xapian_ValueCountMatchSpy;
  SwigClassValueCountMatchSpy.trackObjects = 0;
  
  SwigClassDatabase.klass = rb_define_class_under(mXapian, "Database", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__Database, (void *) &SwigClassDatabase);
  rb_define_alloc_func(SwigClassDatabase.klass, _wrap_Database_allocate);
  rb_define_method(SwigClassDatabase.klass, "initialize", VALUEFUNC(_wrap_new_Database), -1);
  rb_define_method(SwigClassDatabase.klass, "add_database", VALUEFUNC(_wrap_Database_add_database), -1);
  rb_define_method(SwigClassDatabase.klass, "reopen", VALUEFUNC(_wrap_Database_reopen), -1);
  rb_define_method(SwigClassDatabase.klass, "close", VALUEFUNC(_wrap_Database_close), -1);
  rb_define_method(SwigClassDatabase.klass, "description", VALUEFUNC(_wrap_Database_description), -1);
  rb_define_method(SwigClassDatabase.klass, "_dangerous_postlist_begin", VALUEFUNC(_wrap_Database__dangerous_postlist_begin), -1);
  rb_define_method(SwigClassDatabase.klass, "_dangerous_postlist_end", VALUEFUNC(_wrap_Database__dangerous_postlist_end), -1);
  rb_define_method(SwigClassDatabase.klass, "_dangerous_termlist_begin", VALUEFUNC(_wrap_Database__dangerous_termlist_begin), -1);
  rb_define_method(SwigClassDatabase.klass, "_dangerous_termlist_end", VALUEFUNC(_wrap_Database__dangerous_termlist_end), -1);
  rb_define_method(SwigClassDatabase.klass, "_dangerous_positionlist_begin", VALUEFUNC(_wrap_Database__dangerous_positionlist_begin), -1);
  rb_define_method(SwigClassDatabase.klass, "_dangerous_positionlist_end", VALUEFUNC(_wrap_Database__dangerous_positionlist_end), -1);
  rb_define_method(SwigClassDatabase.klass, "_dangerous_allterms_begin", VALUEFUNC(_wrap_Database__dangerous_allterms_begin), -1);
  rb_define_method(SwigClassDatabase.klass, "_dangerous_allterms_end", VALUEFUNC(_wrap_Database__dangerous_allterms_end), -1);
  rb_define_method(SwigClassDatabase.klass, "doccount", VALUEFUNC(_wrap_Database_doccount), -1);
  rb_define_method(SwigClassDatabase.klass, "lastdocid", VALUEFUNC(_wrap_Database_lastdocid), -1);
  rb_define_method(SwigClassDatabase.klass, "avlength", VALUEFUNC(_wrap_Database_avlength), -1);
  rb_define_method(SwigClassDatabase.klass, "termfreq", VALUEFUNC(_wrap_Database_termfreq), -1);
  rb_define_method(SwigClassDatabase.klass, "term_exists", VALUEFUNC(_wrap_Database_term_exists), -1);
  rb_define_method(SwigClassDatabase.klass, "collection_freq", VALUEFUNC(_wrap_Database_collection_freq), -1);
  rb_define_method(SwigClassDatabase.klass, "get_value_freq", VALUEFUNC(_wrap_Database_get_value_freq), -1);
  rb_define_method(SwigClassDatabase.klass, "get_value_lower_bound", VALUEFUNC(_wrap_Database_get_value_lower_bound), -1);
  rb_define_method(SwigClassDatabase.klass, "get_value_upper_bound", VALUEFUNC(_wrap_Database_get_value_upper_bound), -1);
  rb_define_method(SwigClassDatabase.klass, "get_doclength_lower_bound", VALUEFUNC(_wrap_Database_get_doclength_lower_bound), -1);
  rb_define_method(SwigClassDatabase.klass, "get_doclength_upper_bound", VALUEFUNC(_wrap_Database_get_doclength_upper_bound), -1);
  rb_define_method(SwigClassDatabase.klass, "get_wdf_upper_bound", VALUEFUNC(_wrap_Database_get_wdf_upper_bound), -1);
  rb_define_method(SwigClassDatabase.klass, "_dangerous_valuestream_begin", VALUEFUNC(_wrap_Database__dangerous_valuestream_begin), -1);
  rb_define_method(SwigClassDatabase.klass, "_dangerous_valuestream_end", VALUEFUNC(_wrap_Database__dangerous_valuestream_end), -1);
  rb_define_method(SwigClassDatabase.klass, "doclength", VALUEFUNC(_wrap_Database_doclength), -1);
  rb_define_method(SwigClassDatabase.klass, "keep_alive", VALUEFUNC(_wrap_Database_keep_alive), -1);
  rb_define_method(SwigClassDatabase.klass, "document", VALUEFUNC(_wrap_Database_document), -1);
  rb_define_method(SwigClassDatabase.klass, "get_spelling_suggestion", VALUEFUNC(_wrap_Database_get_spelling_suggestion), -1);
  rb_define_method(SwigClassDatabase.klass, "spellings_begin", VALUEFUNC(_wrap_Database_spellings_begin), -1);
  rb_define_method(SwigClassDatabase.klass, "spellings_end", VALUEFUNC(_wrap_Database_spellings_end), -1);
  rb_define_method(SwigClassDatabase.klass, "synonyms_begin", VALUEFUNC(_wrap_Database_synonyms_begin), -1);
  rb_define_method(SwigClassDatabase.klass, "synonyms_end", VALUEFUNC(_wrap_Database_synonyms_end), -1);
  rb_define_method(SwigClassDatabase.klass, "synonym_keys_begin", VALUEFUNC(_wrap_Database_synonym_keys_begin), -1);
  rb_define_method(SwigClassDatabase.klass, "synonym_keys_end", VALUEFUNC(_wrap_Database_synonym_keys_end), -1);
  rb_define_method(SwigClassDatabase.klass, "get_metadata", VALUEFUNC(_wrap_Database_get_metadata), -1);
  rb_define_method(SwigClassDatabase.klass, "metadata_keys_begin", VALUEFUNC(_wrap_Database_metadata_keys_begin), -1);
  rb_define_method(SwigClassDatabase.klass, "metadata_keys_end", VALUEFUNC(_wrap_Database_metadata_keys_end), -1);
  rb_define_method(SwigClassDatabase.klass, "get_uuid", VALUEFUNC(_wrap_Database_get_uuid), -1);
  rb_define_method(SwigClassDatabase.klass, "has_positions", VALUEFUNC(_wrap_Database_has_positions), -1);
  SwigClassDatabase.mark = 0;
  SwigClassDatabase.destroy = (void (*)(void *)) free_Xapian_Database;
  SwigClassDatabase.trackObjects = 0;
  
  SwigClassWritableDatabase.klass = rb_define_class_under(mXapian, "WritableDatabase", ((swig_class *) SWIGTYPE_p_Xapian__Database->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__WritableDatabase, (void *) &SwigClassWritableDatabase);
  rb_define_alloc_func(SwigClassWritableDatabase.klass, _wrap_WritableDatabase_allocate);
  rb_define_method(SwigClassWritableDatabase.klass, "initialize", VALUEFUNC(_wrap_new_WritableDatabase), -1);
  rb_define_method(SwigClassWritableDatabase.klass, "commit", VALUEFUNC(_wrap_WritableDatabase_commit), -1);
  rb_define_method(SwigClassWritableDatabase.klass, "flush", VALUEFUNC(_wrap_WritableDatabase_flush), -1);
  rb_define_method(SwigClassWritableDatabase.klass, "begin_transaction", VALUEFUNC(_wrap_WritableDatabase_begin_transaction), -1);
  rb_define_method(SwigClassWritableDatabase.klass, "commit_transaction", VALUEFUNC(_wrap_WritableDatabase_commit_transaction), -1);
  rb_define_method(SwigClassWritableDatabase.klass, "cancel_transaction", VALUEFUNC(_wrap_WritableDatabase_cancel_transaction), -1);
  rb_define_method(SwigClassWritableDatabase.klass, "add_document", VALUEFUNC(_wrap_WritableDatabase_add_document), -1);
  rb_define_method(SwigClassWritableDatabase.klass, "delete_document", VALUEFUNC(_wrap_WritableDatabase_delete_document), -1);
  rb_define_method(SwigClassWritableDatabase.klass, "replace_document", VALUEFUNC(_wrap_WritableDatabase_replace_document), -1);
  rb_define_method(SwigClassWritableDatabase.klass, "add_spelling", VALUEFUNC(_wrap_WritableDatabase_add_spelling), -1);
  rb_define_method(SwigClassWritableDatabase.klass, "remove_spelling", VALUEFUNC(_wrap_WritableDatabase_remove_spelling), -1);
  rb_define_method(SwigClassWritableDatabase.klass, "add_synonym", VALUEFUNC(_wrap_WritableDatabase_add_synonym), -1);
  rb_define_method(SwigClassWritableDatabase.klass, "remove_synonym", VALUEFUNC(_wrap_WritableDatabase_remove_synonym), -1);
  rb_define_method(SwigClassWritableDatabase.klass, "clear_synonyms", VALUEFUNC(_wrap_WritableDatabase_clear_synonyms), -1);
  rb_define_method(SwigClassWritableDatabase.klass, "set_metadata", VALUEFUNC(_wrap_WritableDatabase_set_metadata), -1);
  rb_define_method(SwigClassWritableDatabase.klass, "description", VALUEFUNC(_wrap_WritableDatabase_description), -1);
  SwigClassWritableDatabase.mark = 0;
  SwigClassWritableDatabase.destroy = (void (*)(void *)) free_Xapian_WritableDatabase;
  SwigClassWritableDatabase.trackObjects = 0;
  rb_define_const(mXapian, "DB_CREATE_OR_OPEN", SWIG_From_int(static_cast< int >(Xapian::DB_CREATE_OR_OPEN)));
  rb_define_const(mXapian, "DB_CREATE", SWIG_From_int(static_cast< int >(Xapian::DB_CREATE)));
  rb_define_const(mXapian, "DB_CREATE_OR_OVERWRITE", SWIG_From_int(static_cast< int >(Xapian::DB_CREATE_OR_OVERWRITE)));
  rb_define_const(mXapian, "DB_OPEN", SWIG_From_int(static_cast< int >(Xapian::DB_OPEN)));
  rb_define_module_function(mXapian, "open_stub", VALUEFUNC(_wrap_open_stub), -1);
  rb_define_module_function(mXapian, "brass_open", VALUEFUNC(_wrap_brass_open), -1);
  rb_define_module_function(mXapian, "chert_open", VALUEFUNC(_wrap_chert_open), -1);
  rb_define_module_function(mXapian, "flint_open", VALUEFUNC(_wrap_flint_open), -1);
  rb_define_module_function(mXapian, "inmemory_open", VALUEFUNC(_wrap_inmemory_open), -1);
  rb_define_module_function(mXapian, "remote_open", VALUEFUNC(_wrap_remote_open), -1);
  rb_define_module_function(mXapian, "remote_open_writable", VALUEFUNC(_wrap_remote_open_writable), -1);
  
  SwigClassQuery.klass = rb_define_class_under(mXapian, "Query", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__Query, (void *) &SwigClassQuery);
  rb_define_alloc_func(SwigClassQuery.klass, _wrap_Query_allocate);
  rb_define_method(SwigClassQuery.klass, "initialize", VALUEFUNC(_wrap_new_Query), -1);
  rb_define_const(SwigClassQuery.klass, "OP_AND", SWIG_From_int(static_cast< int >(Xapian::Query::OP_AND)));
  rb_define_const(SwigClassQuery.klass, "OP_OR", SWIG_From_int(static_cast< int >(Xapian::Query::OP_OR)));
  rb_define_const(SwigClassQuery.klass, "OP_AND_NOT", SWIG_From_int(static_cast< int >(Xapian::Query::OP_AND_NOT)));
  rb_define_const(SwigClassQuery.klass, "OP_XOR", SWIG_From_int(static_cast< int >(Xapian::Query::OP_XOR)));
  rb_define_const(SwigClassQuery.klass, "OP_AND_MAYBE", SWIG_From_int(static_cast< int >(Xapian::Query::OP_AND_MAYBE)));
  rb_define_const(SwigClassQuery.klass, "OP_FILTER", SWIG_From_int(static_cast< int >(Xapian::Query::OP_FILTER)));
  rb_define_const(SwigClassQuery.klass, "OP_NEAR", SWIG_From_int(static_cast< int >(Xapian::Query::OP_NEAR)));
  rb_define_const(SwigClassQuery.klass, "OP_PHRASE", SWIG_From_int(static_cast< int >(Xapian::Query::OP_PHRASE)));
  rb_define_const(SwigClassQuery.klass, "OP_VALUE_RANGE", SWIG_From_int(static_cast< int >(Xapian::Query::OP_VALUE_RANGE)));
  rb_define_const(SwigClassQuery.klass, "OP_SCALE_WEIGHT", SWIG_From_int(static_cast< int >(Xapian::Query::OP_SCALE_WEIGHT)));
  rb_define_const(SwigClassQuery.klass, "OP_ELITE_SET", SWIG_From_int(static_cast< int >(Xapian::Query::OP_ELITE_SET)));
  rb_define_const(SwigClassQuery.klass, "OP_VALUE_GE", SWIG_From_int(static_cast< int >(Xapian::Query::OP_VALUE_GE)));
  rb_define_const(SwigClassQuery.klass, "OP_VALUE_LE", SWIG_From_int(static_cast< int >(Xapian::Query::OP_VALUE_LE)));
  rb_define_const(SwigClassQuery.klass, "OP_SYNONYM", SWIG_From_int(static_cast< int >(Xapian::Query::OP_SYNONYM)));
  rb_define_method(SwigClassQuery.klass, "length", VALUEFUNC(_wrap_Query_length), -1);
  rb_define_method(SwigClassQuery.klass, "_dangerous_terms_begin", VALUEFUNC(_wrap_Query__dangerous_terms_begin), -1);
  rb_define_method(SwigClassQuery.klass, "_dangerous_terms_end", VALUEFUNC(_wrap_Query__dangerous_terms_end), -1);
  rb_define_method(SwigClassQuery.klass, "empty?", VALUEFUNC(_wrap_Query_emptyq___), -1);
  rb_define_method(SwigClassQuery.klass, "serialise", VALUEFUNC(_wrap_Query_serialise), -1);
  rb_define_singleton_method(SwigClassQuery.klass, "unserialise", VALUEFUNC(_wrap_Query_unserialise), -1);
  rb_define_method(SwigClassQuery.klass, "description", VALUEFUNC(_wrap_Query_description), -1);
  SwigClassQuery.mark = 0;
  SwigClassQuery.destroy = (void (*)(void *)) free_Xapian_Query;
  SwigClassQuery.trackObjects = 0;
  rb_define_module_function(mXapian, "disown_Stopper", VALUEFUNC(_wrap_disown_Stopper), -1);
  
  SwigClassStopper.klass = rb_define_class_under(mXapian, "Stopper", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__Stopper, (void *) &SwigClassStopper);
  rb_define_alloc_func(SwigClassStopper.klass, _wrap_Stopper_allocate);
  rb_define_method(SwigClassStopper.klass, "initialize", VALUEFUNC(_wrap_new_Stopper), -1);
  rb_define_method(SwigClassStopper.klass, "call", VALUEFUNC(_wrap_Stopper___call__), -1);
  rb_define_method(SwigClassStopper.klass, "description", VALUEFUNC(_wrap_Stopper_description), -1);
  SwigClassStopper.mark = 0;
  SwigClassStopper.destroy = (void (*)(void *)) free_Xapian_Stopper;
  SwigClassStopper.trackObjects = 0;
  
  SwigClassSimpleStopper.klass = rb_define_class_under(mXapian, "SimpleStopper", ((swig_class *) SWIGTYPE_p_Xapian__Stopper->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__SimpleStopper, (void *) &SwigClassSimpleStopper);
  rb_define_alloc_func(SwigClassSimpleStopper.klass, _wrap_SimpleStopper_allocate);
  rb_define_method(SwigClassSimpleStopper.klass, "initialize", VALUEFUNC(_wrap_new_SimpleStopper), -1);
  rb_define_method(SwigClassSimpleStopper.klass, "add", VALUEFUNC(_wrap_SimpleStopper_add), -1);
  rb_define_method(SwigClassSimpleStopper.klass, "call", VALUEFUNC(_wrap_SimpleStopper___call__), -1);
  rb_define_method(SwigClassSimpleStopper.klass, "description", VALUEFUNC(_wrap_SimpleStopper_description), -1);
  SwigClassSimpleStopper.mark = 0;
  SwigClassSimpleStopper.destroy = (void (*)(void *)) free_Xapian_SimpleStopper;
  SwigClassSimpleStopper.trackObjects = 0;
  rb_define_module_function(mXapian, "disown_ValueRangeProcessor", VALUEFUNC(_wrap_disown_ValueRangeProcessor), -1);
  
  SwigClassValueRangeProcessor.klass = rb_define_class_under(mXapian, "ValueRangeProcessor", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__ValueRangeProcessor, (void *) &SwigClassValueRangeProcessor);
  rb_define_alloc_func(SwigClassValueRangeProcessor.klass, _wrap_ValueRangeProcessor_allocate);
  rb_define_method(SwigClassValueRangeProcessor.klass, "initialize", VALUEFUNC(_wrap_new_ValueRangeProcessor), -1);
  rb_define_method(SwigClassValueRangeProcessor.klass, "call", VALUEFUNC(_wrap_ValueRangeProcessor___call__), -1);
  SwigClassValueRangeProcessor.mark = 0;
  SwigClassValueRangeProcessor.destroy = (void (*)(void *)) free_Xapian_ValueRangeProcessor;
  SwigClassValueRangeProcessor.trackObjects = 0;
  
  SwigClassStringValueRangeProcessor.klass = rb_define_class_under(mXapian, "StringValueRangeProcessor", ((swig_class *) SWIGTYPE_p_Xapian__ValueRangeProcessor->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__StringValueRangeProcessor, (void *) &SwigClassStringValueRangeProcessor);
  rb_define_alloc_func(SwigClassStringValueRangeProcessor.klass, _wrap_StringValueRangeProcessor_allocate);
  rb_define_method(SwigClassStringValueRangeProcessor.klass, "initialize", VALUEFUNC(_wrap_new_StringValueRangeProcessor), -1);
  rb_define_method(SwigClassStringValueRangeProcessor.klass, "call", VALUEFUNC(_wrap_StringValueRangeProcessor___call__), -1);
  SwigClassStringValueRangeProcessor.mark = 0;
  SwigClassStringValueRangeProcessor.destroy = (void (*)(void *)) free_Xapian_StringValueRangeProcessor;
  SwigClassStringValueRangeProcessor.trackObjects = 0;
  
  SwigClassDateValueRangeProcessor.klass = rb_define_class_under(mXapian, "DateValueRangeProcessor", ((swig_class *) SWIGTYPE_p_Xapian__StringValueRangeProcessor->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__DateValueRangeProcessor, (void *) &SwigClassDateValueRangeProcessor);
  rb_define_alloc_func(SwigClassDateValueRangeProcessor.klass, _wrap_DateValueRangeProcessor_allocate);
  rb_define_method(SwigClassDateValueRangeProcessor.klass, "initialize", VALUEFUNC(_wrap_new_DateValueRangeProcessor), -1);
  rb_define_method(SwigClassDateValueRangeProcessor.klass, "call", VALUEFUNC(_wrap_DateValueRangeProcessor___call__), -1);
  SwigClassDateValueRangeProcessor.mark = 0;
  SwigClassDateValueRangeProcessor.destroy = (void (*)(void *)) free_Xapian_DateValueRangeProcessor;
  SwigClassDateValueRangeProcessor.trackObjects = 0;
  
  SwigClassNumberValueRangeProcessor.klass = rb_define_class_under(mXapian, "NumberValueRangeProcessor", ((swig_class *) SWIGTYPE_p_Xapian__StringValueRangeProcessor->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__NumberValueRangeProcessor, (void *) &SwigClassNumberValueRangeProcessor);
  rb_define_alloc_func(SwigClassNumberValueRangeProcessor.klass, _wrap_NumberValueRangeProcessor_allocate);
  rb_define_method(SwigClassNumberValueRangeProcessor.klass, "initialize", VALUEFUNC(_wrap_new_NumberValueRangeProcessor), -1);
  rb_define_method(SwigClassNumberValueRangeProcessor.klass, "call", VALUEFUNC(_wrap_NumberValueRangeProcessor___call__), -1);
  SwigClassNumberValueRangeProcessor.mark = 0;
  SwigClassNumberValueRangeProcessor.destroy = (void (*)(void *)) free_Xapian_NumberValueRangeProcessor;
  SwigClassNumberValueRangeProcessor.trackObjects = 0;
  
  SwigClassQueryParser.klass = rb_define_class_under(mXapian, "QueryParser", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__QueryParser, (void *) &SwigClassQueryParser);
  rb_define_alloc_func(SwigClassQueryParser.klass, _wrap_QueryParser_allocate);
  rb_define_method(SwigClassQueryParser.klass, "initialize", VALUEFUNC(_wrap_new_QueryParser), -1);
  rb_define_const(SwigClassQueryParser.klass, "FLAG_BOOLEAN", SWIG_From_int(static_cast< int >(Xapian::QueryParser::FLAG_BOOLEAN)));
  rb_define_const(SwigClassQueryParser.klass, "FLAG_PHRASE", SWIG_From_int(static_cast< int >(Xapian::QueryParser::FLAG_PHRASE)));
  rb_define_const(SwigClassQueryParser.klass, "FLAG_LOVEHATE", SWIG_From_int(static_cast< int >(Xapian::QueryParser::FLAG_LOVEHATE)));
  rb_define_const(SwigClassQueryParser.klass, "FLAG_BOOLEAN_ANY_CASE", SWIG_From_int(static_cast< int >(Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE)));
  rb_define_const(SwigClassQueryParser.klass, "FLAG_WILDCARD", SWIG_From_int(static_cast< int >(Xapian::QueryParser::FLAG_WILDCARD)));
  rb_define_const(SwigClassQueryParser.klass, "FLAG_PURE_NOT", SWIG_From_int(static_cast< int >(Xapian::QueryParser::FLAG_PURE_NOT)));
  rb_define_const(SwigClassQueryParser.klass, "FLAG_PARTIAL", SWIG_From_int(static_cast< int >(Xapian::QueryParser::FLAG_PARTIAL)));
  rb_define_const(SwigClassQueryParser.klass, "FLAG_SPELLING_CORRECTION", SWIG_From_int(static_cast< int >(Xapian::QueryParser::FLAG_SPELLING_CORRECTION)));
  rb_define_const(SwigClassQueryParser.klass, "FLAG_SYNONYM", SWIG_From_int(static_cast< int >(Xapian::QueryParser::FLAG_SYNONYM)));
  rb_define_const(SwigClassQueryParser.klass, "FLAG_AUTO_SYNONYMS", SWIG_From_int(static_cast< int >(Xapian::QueryParser::FLAG_AUTO_SYNONYMS)));
  rb_define_const(SwigClassQueryParser.klass, "FLAG_AUTO_MULTIWORD_SYNONYMS", SWIG_From_int(static_cast< int >(Xapian::QueryParser::FLAG_AUTO_MULTIWORD_SYNONYMS)));
  rb_define_const(SwigClassQueryParser.klass, "FLAG_DEFAULT", SWIG_From_int(static_cast< int >(Xapian::QueryParser::FLAG_DEFAULT)));
  rb_define_const(SwigClassQueryParser.klass, "STEM_NONE", SWIG_From_int(static_cast< int >(Xapian::QueryParser::STEM_NONE)));
  rb_define_const(SwigClassQueryParser.klass, "STEM_SOME", SWIG_From_int(static_cast< int >(Xapian::QueryParser::STEM_SOME)));
  rb_define_const(SwigClassQueryParser.klass, "STEM_ALL", SWIG_From_int(static_cast< int >(Xapian::QueryParser::STEM_ALL)));
  rb_define_const(SwigClassQueryParser.klass, "STEM_ALL_Z", SWIG_From_int(static_cast< int >(Xapian::QueryParser::STEM_ALL_Z)));
  rb_define_method(SwigClassQueryParser.klass, "stemmer=", VALUEFUNC(_wrap_QueryParser_stemmere___), -1);
  rb_define_method(SwigClassQueryParser.klass, "stemming_strategy=", VALUEFUNC(_wrap_QueryParser_stemming_strategye___), -1);
  rb_define_method(SwigClassQueryParser.klass, "stopper=", VALUEFUNC(_wrap_QueryParser_stoppere___), -1);
  rb_define_method(SwigClassQueryParser.klass, "default_op=", VALUEFUNC(_wrap_QueryParser_default_ope___), -1);
  rb_define_method(SwigClassQueryParser.klass, "default_op", VALUEFUNC(_wrap_QueryParser_default_op), -1);
  rb_define_method(SwigClassQueryParser.klass, "database=", VALUEFUNC(_wrap_QueryParser_databasee___), -1);
  rb_define_method(SwigClassQueryParser.klass, "set_max_wildcard_expansion", VALUEFUNC(_wrap_QueryParser_set_max_wildcard_expansion), -1);
  rb_define_method(SwigClassQueryParser.klass, "parse_query", VALUEFUNC(_wrap_QueryParser_parse_query), -1);
  rb_define_method(SwigClassQueryParser.klass, "add_prefix", VALUEFUNC(_wrap_QueryParser_add_prefix), -1);
  rb_define_method(SwigClassQueryParser.klass, "add_boolean_prefix", VALUEFUNC(_wrap_QueryParser_add_boolean_prefix), -1);
  rb_define_method(SwigClassQueryParser.klass, "stoplist_begin", VALUEFUNC(_wrap_QueryParser_stoplist_begin), -1);
  rb_define_method(SwigClassQueryParser.klass, "stoplist_end", VALUEFUNC(_wrap_QueryParser_stoplist_end), -1);
  rb_define_method(SwigClassQueryParser.klass, "unstem_begin", VALUEFUNC(_wrap_QueryParser_unstem_begin), -1);
  rb_define_method(SwigClassQueryParser.klass, "unstem_end", VALUEFUNC(_wrap_QueryParser_unstem_end), -1);
  rb_define_method(SwigClassQueryParser.klass, "add_valuerangeprocessor", VALUEFUNC(_wrap_QueryParser_add_valuerangeprocessor), -1);
  rb_define_method(SwigClassQueryParser.klass, "get_corrected_query_string", VALUEFUNC(_wrap_QueryParser_get_corrected_query_string), -1);
  rb_define_method(SwigClassQueryParser.klass, "description", VALUEFUNC(_wrap_QueryParser_description), -1);
  SwigClassQueryParser.mark = 0;
  SwigClassQueryParser.destroy = (void (*)(void *)) free_Xapian_QueryParser;
  SwigClassQueryParser.trackObjects = 0;
  rb_define_module_function(mXapian, "sortable_serialise", VALUEFUNC(_wrap_sortable_serialise), -1);
  rb_define_module_function(mXapian, "sortable_unserialise", VALUEFUNC(_wrap_sortable_unserialise), -1);
  rb_define_module_function(mXapian, "disown_StemImplementation", VALUEFUNC(_wrap_disown_StemImplementation), -1);
  
  SwigClassStemImplementation.klass = rb_define_class_under(mXapian, "StemImplementation", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__StemImplementation, (void *) &SwigClassStemImplementation);
  rb_define_alloc_func(SwigClassStemImplementation.klass, _wrap_StemImplementation_allocate);
  rb_define_method(SwigClassStemImplementation.klass, "initialize", VALUEFUNC(_wrap_new_StemImplementation), -1);
  rb_define_method(SwigClassStemImplementation.klass, "call", VALUEFUNC(_wrap_StemImplementation___call__), -1);
  rb_define_method(SwigClassStemImplementation.klass, "description", VALUEFUNC(_wrap_StemImplementation_description), -1);
  SwigClassStemImplementation.mark = 0;
  SwigClassStemImplementation.destroy = (void (*)(void *)) free_Xapian_StemImplementation;
  SwigClassStemImplementation.trackObjects = 0;
  
  SwigClassStem.klass = rb_define_class_under(mXapian, "Stem", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__Stem, (void *) &SwigClassStem);
  rb_define_alloc_func(SwigClassStem.klass, _wrap_Stem_allocate);
  rb_define_method(SwigClassStem.klass, "initialize", VALUEFUNC(_wrap_new_Stem), -1);
  rb_define_method(SwigClassStem.klass, "call", VALUEFUNC(_wrap_Stem___call__), -1);
  rb_define_method(SwigClassStem.klass, "description", VALUEFUNC(_wrap_Stem_description), -1);
  rb_define_singleton_method(SwigClassStem.klass, "available_languages", VALUEFUNC(_wrap_Stem_available_languages), -1);
  SwigClassStem.mark = 0;
  SwigClassStem.destroy = (void (*)(void *)) free_Xapian_Stem;
  SwigClassStem.trackObjects = 0;
  
  SwigClassTermGenerator.klass = rb_define_class_under(mXapian, "TermGenerator", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__TermGenerator, (void *) &SwigClassTermGenerator);
  rb_define_alloc_func(SwigClassTermGenerator.klass, _wrap_TermGenerator_allocate);
  rb_define_method(SwigClassTermGenerator.klass, "initialize", VALUEFUNC(_wrap_new_TermGenerator), -1);
  rb_define_method(SwigClassTermGenerator.klass, "stemmer=", VALUEFUNC(_wrap_TermGenerator_stemmere___), -1);
  rb_define_method(SwigClassTermGenerator.klass, "stopper=", VALUEFUNC(_wrap_TermGenerator_stoppere___), -1);
  rb_define_method(SwigClassTermGenerator.klass, "document=", VALUEFUNC(_wrap_TermGenerator_documente___), -1);
  rb_define_method(SwigClassTermGenerator.klass, "document", VALUEFUNC(_wrap_TermGenerator_document), -1);
  rb_define_method(SwigClassTermGenerator.klass, "database=", VALUEFUNC(_wrap_TermGenerator_databasee___), -1);
  rb_define_const(SwigClassTermGenerator.klass, "FLAG_SPELLING", SWIG_From_int(static_cast< int >(Xapian::TermGenerator::FLAG_SPELLING)));
  rb_define_const(SwigClassTermGenerator.klass, "STEM_NONE", SWIG_From_int(static_cast< int >(Xapian::TermGenerator::STEM_NONE)));
  rb_define_const(SwigClassTermGenerator.klass, "STEM_SOME", SWIG_From_int(static_cast< int >(Xapian::TermGenerator::STEM_SOME)));
  rb_define_const(SwigClassTermGenerator.klass, "STEM_ALL", SWIG_From_int(static_cast< int >(Xapian::TermGenerator::STEM_ALL)));
  rb_define_const(SwigClassTermGenerator.klass, "STEM_ALL_Z", SWIG_From_int(static_cast< int >(Xapian::TermGenerator::STEM_ALL_Z)));
  rb_define_method(SwigClassTermGenerator.klass, "set_flags", VALUEFUNC(_wrap_TermGenerator_set_flags), -1);
  rb_define_method(SwigClassTermGenerator.klass, "stemming_strategy=", VALUEFUNC(_wrap_TermGenerator_stemming_strategye___), -1);
  rb_define_method(SwigClassTermGenerator.klass, "index_text", VALUEFUNC(_wrap_TermGenerator_index_text), -1);
  rb_define_method(SwigClassTermGenerator.klass, "index_text_without_positions", VALUEFUNC(_wrap_TermGenerator_index_text_without_positions), -1);
  rb_define_method(SwigClassTermGenerator.klass, "increase_termpos", VALUEFUNC(_wrap_TermGenerator_increase_termpos), -1);
  rb_define_method(SwigClassTermGenerator.klass, "termpos", VALUEFUNC(_wrap_TermGenerator_termpos), -1);
  rb_define_method(SwigClassTermGenerator.klass, "set_termpos", VALUEFUNC(_wrap_TermGenerator_set_termpos), -1);
  rb_define_method(SwigClassTermGenerator.klass, "description", VALUEFUNC(_wrap_TermGenerator_description), -1);
  SwigClassTermGenerator.mark = 0;
  SwigClassTermGenerator.destroy = (void (*)(void *)) free_Xapian_TermGenerator;
  SwigClassTermGenerator.trackObjects = 0;
  rb_define_module_function(mXapian, "disown_KeyMaker", VALUEFUNC(_wrap_disown_KeyMaker), -1);
  
  SwigClassKeyMaker.klass = rb_define_class_under(mXapian, "KeyMaker", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__KeyMaker, (void *) &SwigClassKeyMaker);
  rb_define_alloc_func(SwigClassKeyMaker.klass, _wrap_KeyMaker_allocate);
  rb_define_method(SwigClassKeyMaker.klass, "initialize", VALUEFUNC(_wrap_new_KeyMaker), -1);
  rb_define_method(SwigClassKeyMaker.klass, "call", VALUEFUNC(_wrap_KeyMaker___call__), -1);
  SwigClassKeyMaker.mark = 0;
  SwigClassKeyMaker.destroy = (void (*)(void *)) free_Xapian_KeyMaker;
  SwigClassKeyMaker.trackObjects = 0;
  
  SwigClassMultiValueKeyMaker.klass = rb_define_class_under(mXapian, "MultiValueKeyMaker", ((swig_class *) SWIGTYPE_p_Xapian__KeyMaker->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__MultiValueKeyMaker, (void *) &SwigClassMultiValueKeyMaker);
  rb_define_alloc_func(SwigClassMultiValueKeyMaker.klass, _wrap_MultiValueKeyMaker_allocate);
  rb_define_method(SwigClassMultiValueKeyMaker.klass, "initialize", VALUEFUNC(_wrap_new_MultiValueKeyMaker), -1);
  rb_define_method(SwigClassMultiValueKeyMaker.klass, "call", VALUEFUNC(_wrap_MultiValueKeyMaker___call__), -1);
  rb_define_method(SwigClassMultiValueKeyMaker.klass, "add_value", VALUEFUNC(_wrap_MultiValueKeyMaker_add_value), -1);
  SwigClassMultiValueKeyMaker.mark = 0;
  SwigClassMultiValueKeyMaker.destroy = (void (*)(void *)) free_Xapian_MultiValueKeyMaker;
  SwigClassMultiValueKeyMaker.trackObjects = 0;
  
  SwigClassSorter.klass = rb_define_class_under(mXapian, "Sorter", ((swig_class *) SWIGTYPE_p_Xapian__KeyMaker->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__Sorter, (void *) &SwigClassSorter);
  rb_undef_alloc_func(SwigClassSorter.klass);
  SwigClassSorter.mark = 0;
  SwigClassSorter.destroy = (void (*)(void *)) free_Xapian_Sorter;
  SwigClassSorter.trackObjects = 0;
  
  SwigClassMultiValueSorter.klass = rb_define_class_under(mXapian, "MultiValueSorter", ((swig_class *) SWIGTYPE_p_Xapian__Sorter->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__MultiValueSorter, (void *) &SwigClassMultiValueSorter);
  rb_define_alloc_func(SwigClassMultiValueSorter.klass, _wrap_MultiValueSorter_allocate);
  rb_define_method(SwigClassMultiValueSorter.klass, "initialize", VALUEFUNC(_wrap_new_MultiValueSorter), -1);
  rb_define_method(SwigClassMultiValueSorter.klass, "call", VALUEFUNC(_wrap_MultiValueSorter___call__), -1);
  rb_define_method(SwigClassMultiValueSorter.klass, "add", VALUEFUNC(_wrap_MultiValueSorter_add), -1);
  SwigClassMultiValueSorter.mark = 0;
  SwigClassMultiValueSorter.destroy = (void (*)(void *)) free_Xapian_MultiValueSorter;
  SwigClassMultiValueSorter.trackObjects = 0;
  
  SwigClassValueSetMatchDecider.klass = rb_define_class_under(mXapian, "ValueSetMatchDecider", ((swig_class *) SWIGTYPE_p_Xapian__MatchDecider->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__ValueSetMatchDecider, (void *) &SwigClassValueSetMatchDecider);
  rb_define_alloc_func(SwigClassValueSetMatchDecider.klass, _wrap_ValueSetMatchDecider_allocate);
  rb_define_method(SwigClassValueSetMatchDecider.klass, "initialize", VALUEFUNC(_wrap_new_ValueSetMatchDecider), -1);
  rb_define_method(SwigClassValueSetMatchDecider.klass, "add_value", VALUEFUNC(_wrap_ValueSetMatchDecider_add_value), -1);
  rb_define_method(SwigClassValueSetMatchDecider.klass, "remove_value", VALUEFUNC(_wrap_ValueSetMatchDecider_remove_value), -1);
  rb_define_method(SwigClassValueSetMatchDecider.klass, "call", VALUEFUNC(_wrap_ValueSetMatchDecider___call__), -1);
  SwigClassValueSetMatchDecider.mark = 0;
  SwigClassValueSetMatchDecider.destroy = (void (*)(void *)) free_Xapian_ValueSetMatchDecider;
  SwigClassValueSetMatchDecider.trackObjects = 0;
  rb_define_module_function(mXapian, "disown_Compactor", VALUEFUNC(_wrap_disown_Compactor), -1);
  
  SwigClassCompactor.klass = rb_define_class_under(mXapian, "Compactor", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_Xapian__Compactor, (void *) &SwigClassCompactor);
  rb_define_alloc_func(SwigClassCompactor.klass, _wrap_Compactor_allocate);
  rb_define_method(SwigClassCompactor.klass, "initialize", VALUEFUNC(_wrap_new_Compactor), -1);
  rb_define_const(SwigClassCompactor.klass, "STANDARD", SWIG_From_int(static_cast< int >(Xapian::Compactor::STANDARD)));
  rb_define_const(SwigClassCompactor.klass, "FULL", SWIG_From_int(static_cast< int >(Xapian::Compactor::FULL)));
  rb_define_const(SwigClassCompactor.klass, "FULLER", SWIG_From_int(static_cast< int >(Xapian::Compactor::FULLER)));
  rb_define_method(SwigClassCompactor.klass, "set_block_size", VALUEFUNC(_wrap_Compactor_set_block_size), -1);
  rb_define_method(SwigClassCompactor.klass, "set_renumber", VALUEFUNC(_wrap_Compactor_set_renumber), -1);
  rb_define_method(SwigClassCompactor.klass, "set_multipass", VALUEFUNC(_wrap_Compactor_set_multipass), -1);
  rb_define_method(SwigClassCompactor.klass, "set_compaction_level", VALUEFUNC(_wrap_Compactor_set_compaction_level), -1);
  rb_define_method(SwigClassCompactor.klass, "set_destdir", VALUEFUNC(_wrap_Compactor_set_destdir), -1);
  rb_define_method(SwigClassCompactor.klass, "add_source", VALUEFUNC(_wrap_Compactor_add_source), -1);
  rb_define_method(SwigClassCompactor.klass, "compact", VALUEFUNC(_wrap_Compactor_compact), -1);
  rb_define_method(SwigClassCompactor.klass, "set_status", VALUEFUNC(_wrap_Compactor_set_status), -1);
  rb_define_method(SwigClassCompactor.klass, "resolve_duplicate_metadata", VALUEFUNC(_wrap_Compactor_resolve_duplicate_metadata), -1);
  SwigClassCompactor.mark = 0;
  SwigClassCompactor.destroy = (void (*)(void *)) free_Xapian_Compactor;
  SwigClassCompactor.trackObjects = 0;
  
  // Define MatchAll and MatchNothing as constants in class Xapian::Query.
  rb_define_const(SwigClassQuery.klass, "MatchAll", SWIG_NewPointerObj(SWIG_as_voidptr(new Xapian::Query("")), SWIGTYPE_p_Xapian__Query, 0));;
  rb_define_const(SwigClassQuery.klass, "MatchNothing", SWIG_NewPointerObj(SWIG_as_voidptr(new Xapian::Query()), SWIGTYPE_p_Xapian__Query, 0));;
  
}

