databasexapian

How can I edit the data section of an Omindex produced database document by editing the omegaScript?


I have been able to set up and search through some documents from a database using this tutorial:

a) http://www.ibm.com/developerworks/opensource/library/os-xapianomega/index.html?cmp=dw&cpb=dwope&ct=dwnew&cr=dwnen&ccy=zz&csr=110410

The data field is added to every document in the indexing process started with this bash call:

$ omindex --db info --url information /mnt/data0/Information

The call indexes all the files in the dir at /mnt/data0/Information and saves it at a database named info. According to the last section in the documentation here:

http://xapian.org/docs/omega/overview.html

According to the above documentation, you can set the fields that go into the data field of a document by editing the OmegaScript Template but I have not been able to find this template anywhere. I am hoping I can get some guidance from someone who is familiar with editing an OmegaScript to set up the data field.

I ultimately want data to have the following fields:

sample caption type

The standard ones without the url field.


Solution

  • OmegaScript templates are used by omega to render search results (in its web interface), and are stored in the template_dir as mentioned in the IBM tutorial section on the Omega web interface. omindex will have created the fields you require — that documentation also mentions that the OmegaScript command you want to extract those fields is $field{}, which is documented along with all the OmegaScript commands.

    So to just display the three fields you would want a fragment of OmegaScript something like:

    $hitlist{
    Sample: $field{sample}
    Caption: $field{caption}
    MIME type: $field{type}
    
    }
    

    (which isn't formatted as HTML, but has the advantage of being hopefully clearer as to what is happening).