Hello Olly, I read about Xapian and SWIG and the bindings that Xapian has with other languages. According to what I've read, I understand that 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. Thanks and Regards, Anish Kanchan Student, University of Mumbai On Sun, Feb 23, 2014 at 11:50 AM, Olly Betts <olly at survex.com> wrote:> Hi Anish, > > On Sat, Feb 22, 2014 at 05:47:44PM +0530, Anish Kanchan wrote: > > I wish to participate in the Google Summer of Code program. I good at > Java, > > PHP and C++. I went through all the projects and I feel that the skills > > required for Bindings Improvement project closely match mine. > > > > I would like to solve any existing bugs in this project if they exist. > > This is an issue with the java bindings (on trunk) which shouldn't be > complex to solve: > > http://trac.xapian.org/ticket/616 > > If you've not used SWIG before, that would be a relatively gentle > introduction to it. > > > Also, could you please tell me which other areas I'll have to do research > > on in order to be fit to implement this project. This would then enable > me > > to write an effective proposal as well. > > Do you have an idea which language(s) you'd want to work on? > > There's not a huge number of things to do for Java, so that alone is > probably too lightweight a project, and you'd probably want to combine > it with something else (which doesn't have to be related). > > The PHP project idea is a lot more substantial, since it involves > updating how SWIG wraps PHP code. A good way to learn more about > that would probably be to try wrapping a Xapian class or two by hand > using the PHP API we want to change SWIG to use: > > http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/ > > Once you have a hand-written wrapper, you can work towards making SWIG > generate the same code. > > Cheers, > Olly >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.xapian.org/pipermail/xapian-devel/attachments/20140225/40ccc46f/attachment-0002.html>
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
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-0002.html>