[Xapian-discuss] Using Omega and/or Xapian and how to get started

James Aylett james-xapian at tartarus.org
Fri Aug 5 17:40:05 BST 2005


On Fri, Aug 05, 2005 at 06:07:27PM +0200, F. Bos wrote:

> Let me start with putting new documents into the Xapian database. As
> you advised I will try to update the Xapian database immediately
> after updating the Mysql database. You suggest to do this using
> scriptindex input files.  I've read the document on scriptindex but
> scriptindex input files get little attention in that. I don't think
> I'm getting it right. If I'd like to add boolean search
> possibilities and weight would I create a file like this?:

> id=ghq147 boolean=Q unique=Q
> title=Sample Record weight=3
> value=This is a multi-line
> =value.  Note how each newline
> =is escaped. boolean=XTEST    
> format=HTML

No, you're getting confused between scriptindex's two different
files. (This isn't uncommon :-)

scriptindex takes an INDEX SCRIPT, a file which describes /how/ to
index a document, and in INPUT FILE, a file containing the raw data
for the documents you're going to create. So you actually want
something like:

INPUT FILE
----------------------------------------------------------------------
id=ghq147
title=Sample Record
value=This is a multi-line
=value.  Note how each newline
= is escaped.
format=HTML
----------------------------------------------------------------------

INDEX SCRIPT
----------------------------------------------------------------------
id : field=id boolean=Q unique=Q
title : field=caption weight=3 index
value : index truncate=200 field=sample
type : field=type boolean=XT
----------------------------------------------------------------------

> And how can I index probabilistically when using scriptindex files? 

The scriptindex ``index'' command does probabilistic term indexing;
see the docs/scriptindex.txt document that ships with omega.

> I also don't see any examples of how to call Omega from PHP so that
> Omega runs the file and updates the Xapian db. How do I get Omega to
> process a scriptindex file?

You call scriptindex to process the pair of scriptindex files. See the
PHP manual on how to invoke other processes.

> On the other hand I also don't quite understand how to call Omega
> from PHP so that it'll produce an output file (in XML as you
> suggested) for a certain query. Do I need to make an Omega script
> template that generates the file?  And how would I call this script
> from within PHP?

You need to make an Omega template for the XML file, or use the
shipped ``xml'' template. Then you request the XML from omega using
the omega CGI URL, wherever you've set that up to be.

> Are there any examples available of the way that PHP interacts with
> Omega? I think I would be able to understand this a lot better if I
> had some examples of a PHP script that generates a scriptindex file
> and gets Omega to process it and an example of PHP requesting Omega
> to produce an output file for a query.

This is no different to PHP requesting XML from any other URL, and
there are plenty of examples of that on the web.

James

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



More information about the Xapian-discuss mailing list