[Xapian-discuss] xapian-bindings compile creates 34mb xapian_wrap.o file?

James Aylett james-xapian at tartarus.org
Tue Oct 19 09:03:53 BST 2004


On Mon, Oct 18, 2004 at 09:43:29PM +0100, Olly Betts wrote:

> The tcl8 bindings originally date back to the BrightStation days.  James
> got them working again fairly recently, but I think he said he doesn't
> know much tcl8 (and I don't either).

I don't, but at one point this worked:

----------------------------------------------------------------------
#!/usr/bin/tclsh

load [file join "/s1/james/local/lib/tcl8.3" xapian.so]
set db [xapian::open
/s1/james/projects/xapian/xapian/xapian-bindings/python/db\
/]
xapian::Enquire enq $db
xapian::Query qu "wibbl"
enq set_query qu
# We now have an Enquire object on our database, so should be able
# to get the MSet (the set of matches) from that - we'll get the
# first ten matches:
set mset [enq get_mset 0 10]
set mi [$mset begin]
while { ! [$mi equals [$mset end]] } {
    puts -nonewline "ID "
    puts -nonewline [$mi get_docid]
    puts -nonewline " "
    puts -nonewline [$mi get_percent]
    puts -nonewline " "
    puts [[$mi get_document] get_data]
    $mi next
}
----------------------------------------------------------------------

However it doesn't now - the xapian:: prefix has disappeared from the
wrapper. Assuming you're using --enable-maintainer-mode, applying the
following patch to xapian-bindings/tcl8/Makefile.am will work:

----------------------------------------------------------------------
@@ -21,6 +21,6 @@ xapian_la_LIBADD = $(XAPIAN_LIBS)
 BUILT_SOURCES = xapian_wrap.cc

 xapian_wrap.cc: ../xapian.i util.i extra.i
-       $(SWIG) -I/usr/include -I$(srcdir) $(XAPIAN_CXXFLAGS) -c++
-tcl8 -o $@ $(srcdir)/../xapian.i
+       $(SWIG) -namespace -I/usr/include -I$(srcdir)
$(XAPIAN_CXXFLAGS) -c++ -tcl8 -o $@ $(srcdir)/../xapian.i

 CLEANFILES = $(BUILT_SOURCES)
----------------------------------------------------------------------

> If you don't know TCL, using C++ would probably be simpler:
> 
> http://www.postgresql.org/docs/7.4/interactive/xfunc-c.html
> 
> The first sentence reads:
> 
>     User-defined functions can be written in C (or a language that can be
>     made compatible with C, such as C++)

Or Postgresql supports both Perl and Python these days, for which
there are reasonable wrappers. (If the Python ones lack anything
that's useful to you, I should be able to add it fairly quickly - I
think Perl is reasonably up to date, but can't really speak for it.)

J

-- 
/--------------------------------------------------------------------------\
  James Aylett                                                  xapian.org
  james at tartarus.org                               uncertaintydivision.org



More information about the Xapian-discuss mailing list