<div dir="ltr"><div>I think there is a development in the bug #616. </div><div><br></div><div>The exception obtained is:</div><div><br></div><div>Exception in thread "main" java.lang.IllegalArgumentException: No enum class org.xapian.TermGenerator$flags with value 0<br>
 at org.xapian.TermGenerator$flags.swigToEnum(TermGenerator.java:143)<br> at org.xapian.TermGenerator.setFlags(TermGenerator.java:71)<br> at org.xapian.examples.SimpleIndex.main(SimpleIndex.java:54)</div><div><br></div><div>
Error seems to occur in the swigToEnum method.</div><div>So I checked <a href="http://www.swig.org/Doc2.0/SWIGDocumentation.html#Java_enum_classes">http://www.swig.org/Doc2.0/SWIGDocumentation.html#Java_enum_classes</a></div>
<div>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. </div>
<div><br></div><div>Now when </div><div><br></div><div>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.</div>
<div><br></div><div>So it is unable to find a type with value 0 (FLAG_SPELLING has value 128) and hence throws the exception.</div><div><br></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr"><div>Thanks and Regards,</div>
<div>Anish Kanchan</div><div><div>Student, University of Mumbai</div><div><br></div></div></div></div>
<br><br><div class="gmail_quote">On Tue, Feb 25, 2014 at 6:06 AM, Olly Betts <span dir="ltr"><<a href="mailto:olly@survex.com" target="_blank">olly@survex.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid">
<div>On Tue, Feb 25, 2014 at 02:45:28AM +0530, Anish Kanchan wrote:<br>
> Xapian is a search engine library written in C/C++. It can be<br>
> integrated with web applications which handle large amount of data.<br>
> But since the web applications may be written in a variety of languages a<br>
> binding is required for the web app to be able to connect to the xapian<br>
> software. And SWIG plays a role in generating intermediate code for the web<br>
> app to link with the bindings.<br>
><br>
> I'd like to know if what I've understood is correct.<br>
<br>
</div>Yes.<br>
<br>
Scripting languages generally provide a C API which allows you to write<br>
a wrapper, but trying to maintain such wrappers by hand for a large API<br>
is quite a lot of work.  SWIG helps to automate that job by generating<br>
wrapper code which uses the available C API for you.<br>
<br>
Often we can add a new method to the C++ API and need to do nothing<br>
extra to have it available in the bindings.  Sometimes it gets wrapped,<br>
but we need to give SWIG some help to wrap it in the best way.<br>
<br>
You might find this talk I gave at Kiwi PyCon 2011 helpful - there<br>
are slides and recorded audio there:<br>
<br>
<a href="http://survex.com/~olly/talks/pythonic-swig/" target="_blank">http://survex.com/~olly/talks/pythonic-swig/</a><br>
<br>
Cheers,<br>
    Olly<br>
</blockquote></div><br></div></div>