Olly Betts | 4 Feb 2006 09:00
Favicon
Gravatar

Re: xapian python bindings

I'm cc:-ing my reply to xapian-devel, since others may have an opinion.
In particular, James has probably done most work on the python bindings.

On Fri, Jan 27, 2006 at 03:56:23PM -0800, Jason Toffaletti wrote:
> I'm curious if boost::python has been considered for creating more
> pythonic bindings to Xapian. I've used it to wrap several C++ libraries
> and found the resulting python bindings to be much nicer than SWIG.

First off, I'm a relative novice at python, so you'll need to explain
what you mean by "more pythonic" if you want me to understand why
boost::python might be better.  Note that the SVN sources have a
number of improvements for python (and other languages) over 0.9.2 -
snapshots available here if you want to take a look:

http://www.oligarchy.co.uk/xapian/trunk/

I'd not heard of boost::python before.  The disadvantages compared to
SWIG would appear to be:

* We already have working SWIG bindings for python.

* James and I have a reasonable understanding of how to wrap stuff
  using SWIG.

* boost::python would require its own interface description, which is
  yet another place to need to add a new method.  We already need to add
  it to xapian.i for SWIG, to the Java JNI bindings in several places,
  and to the appropriate .xs file for Perl, in addition to changing
  the C++ code and headers.  SWIG's xapian.i is trivial to update in
  many cases - just copying the method prototype over generally works.
(Continue reading)

Mikael Johansson | 14 Feb 2006 00:03

Problem with overloading add type casts of numeric strings in PHP bindings

Overloaded methods are mapped in PHP to their implementation (_SWIG_0, 
_SWIG_1, ..) based on the types and number of arguments the user supplies. 
However, if one overload accept a string and another an integer the bindings 
fail to separate them since PHP treats numeric strings much the same as 
integers.

The problem is illustrated in WritableDatabase_replace_document() which 
takes either the docid or an unique term found in the document, ie the same 
number of arguments. The check for a number if implemented as IS_STRING in 
the sence of a numeric string which effectivly prevents the application from 
reaching the next section which checks for IS_STRING in the sence of a term 
and executes the intended overload. The solution would be to change the 
integer test from

_v = (Z_TYPE_PP(argv[1]) == IS_LONG ||
  Z_TYPE_PP(argv[1]) == IS_DOUBLE ||
  Z_TYPE_PP(argv[1]) == IS_STRING) ? 1 : 0;

to

_v = (Z_TYPE_PP(argv[1]) == IS_LONG ||
  Z_TYPE_PP(argv[1]) == IS_DOUBLE) ? 1 : 0;

Thus forcing the user to typecast his parameters when in doubt (PHP does 
support casts), before invoking the Xapian methods, to ensure that the 
correct overload is executed. For example

  WritableDatabase_replace_document($handle, (int)$docid, $document); // 
Replace by docid
  WritableDatabase_replace_document($handle, (string)$uniqueterm, 
(Continue reading)

Olly Betts | 14 Feb 2006 10:58
Favicon
Gravatar

Re: Problem with overloading add type casts of numeric strings in PHP bindings

On Tue, Feb 14, 2006 at 12:03:48AM +0100, Mikael Johansson wrote:
> Overloaded methods are mapped in PHP to their implementation (_SWIG_0, 
> _SWIG_1, ..) based on the types and number of arguments the user supplies. 
> However, if one overload accept a string and another an integer the 
> bindings fail to separate them since PHP treats numeric strings much the 
> same as integers.

I've responded in bugzilla (short version: should be fixed in SVN):

http://xapian.org/cgi-bin/bugzilla/show_bug.cgi?id=68

> Other than that the new bindings with emulated overloads are great, much 
> kudos.

All the credit is due to Kevin Ruland, who's recently taken on the role
of SWIG PHP maintainer.

Cheers,
    Olly
Olly Betts | 20 Feb 2006 13:29
Favicon
Gravatar

Re: Building Xapian

On Thu, Feb 16, 2006 at 10:19:27AM -0500, Josh Rabinowitz wrote:
> [[ THIS is OFFLIST ]]

It really is much better to email one of the lists rather than mailing
an individual developer directly.  If I'm busy or away and so unable to
answer list mail, I won't be magically able to answer a mail just
because it was sent to a different address, whereas if you mail the list
someone else will probably be able to help.

You also managed to mail me at an address I don't advertise to the
outside world, so ended up in my big bucket of spam for several days I'm
afraid...

> I've tried to build the 'cutting edge' svn version of Xapian, but had trouble
> with the automake/autoconf/libtool toolchain. What OS and version do you
> develop on?  Perhaps the easiest way for me to get xapian dev builds going
> would be to replicate your scenario.

The HACKING file in the top-level of the xapian-core sources should
detail everything you need to know.  I personally develop primarily on
Linux (Debian and Ubuntu), but any reasonably up-to-date Unix-like OS
should be fine for development.

If there's something HACKING doesn't cover, let us know and we'll try to
fix that.

Cheers,
    Olly
Sungsoo Kim | 3 Mar 2006 16:20
Picon

xapian-0.9.4 queryparser build errors after applying utf-8 patch

I have encountered the following build errors after applying xapian-qp-utf8-0.9.2.patch.
There is no build error before the patch.

- CentOS 4.2 64 bit version (RHEL 4.0.2 compatible)
- AMD Opteron dual processor

Can anybody tell me what I am missing?

Thanks!


Sungsoo Kim


--------------------------------------------------


[root <at> saturn queryparser]# make
make  all-am
make[1]: Entering directory `/usr/src/redhat/BUILD/xapian-core-0.9.4/queryparser'
if /bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../include
-I../include -I../common -I../api -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   -Wall -W
-Wredundant-decls -Wundef -Wpointer-arith -Wcast-qual -Wcast-align -Wno-multichar
-Wno-long-long -fno-gnu-keywords -O2 -g -pipe -m64 -MT queryparser_internal.lo -MD -MP -MF
".deps/queryparser_internal.Tpo" -c -o queryparser_internal.lo queryparser_internal.cc; \
then mv -f ".deps/queryparser_internal.Tpo" ".deps/queryparser_internal.Plo"; else rm -f
".deps/queryparser_internal.Tpo"; exit 1; fi
 g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I../include -I../common -I../api
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Wall -W -Wredundant-decls -Wundef
-Wpointer-arith -Wcast-qual -Wcast-align -Wno-multichar -Wno-long-long -fno-gnu-keywords -O2 -g
(Continue reading)

Sungsoo Kim | 3 Mar 2006 16:56
Picon

Re: xapian-0.9.4 queryparser build errors after applying utf-8 patch

I have solved the problem by changing the path in Makefile.in from /usr/lib/* to /usr/lib64/*.
Sorry for any inconvenience!

Thanks!


Sungsoo Kim
_______________________________________________
Xapian-devel mailing list
Xapian-devel <at> lists.xapian.org
http://lists.xapian.org/mailman/listinfo/xapian-devel

Gmane