[Xapian-devel] Summer of Code help

Anish Kanchan anishgkanchan at gmail.com
Thu Feb 27 11:52:13 GMT 2014


I think there is a development in the bug #616.

The exception obtained is:

Exception in thread "main" java.lang.IllegalArgumentException: No enum
class org.xapian.TermGenerator$flags with value 0
 at org.xapian.TermGenerator$flags.swigToEnum(TermGenerator.java:143)
 at org.xapian.TermGenerator.setFlags(TermGenerator.java:71)
 at org.xapian.examples.SimpleIndex.main(SimpleIndex.java:54)

Error seems to occur in the swigToEnum method.
So I checked
http://www.swig.org/Doc2.0/SWIGDocumentation.html#Java_enum_classes
We could expect a similar class to get built in our case except that
'flags' would have only one type in it ie.'FLAG_SPELLING'. And the rest of
the values in the class would get set accordingly.

Now when

flags(0) is executed, the swigToEnum method will run with 0 as a parameter.
And this method tries to return a type whose value matches the value of the
passed parameter.

So it is unable to find a type with value 0 (FLAG_SPELLING has value
128) and hence throws the exception.


Thanks and Regards,
Anish Kanchan
Student, University of Mumbai



On Tue, Feb 25, 2014 at 6:06 AM, Olly Betts <olly at survex.com> wrote:

> On Tue, Feb 25, 2014 at 02:45:28AM +0530, Anish Kanchan wrote:
> > Xapian is a search engine library written in C/C++. It can be
> > integrated with web applications which handle large amount of data.
> > But since the web applications may be written in a variety of languages a
> > binding is required for the web app to be able to connect to the xapian
> > software. And SWIG plays a role in generating intermediate code for the
> web
> > app to link with the bindings.
> >
> > I'd like to know if what I've understood is correct.
>
> Yes.
>
> Scripting languages generally provide a C API which allows you to write
> a wrapper, but trying to maintain such wrappers by hand for a large API
> is quite a lot of work.  SWIG helps to automate that job by generating
> wrapper code which uses the available C API for you.
>
> Often we can add a new method to the C++ API and need to do nothing
> extra to have it available in the bindings.  Sometimes it gets wrapped,
> but we need to give SWIG some help to wrap it in the best way.
>
> You might find this talk I gave at Kiwi PyCon 2011 helpful - there
> are slides and recorded audio there:
>
> http://survex.com/~olly/talks/pythonic-swig/
>
> Cheers,
>     Olly
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xapian.org/pipermail/xapian-devel/attachments/20140227/b179a616/attachment.html>


More information about the Xapian-devel mailing list