0

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.

velasco622
  • 85
  • 6

1 Answers1

1

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).

James Aylett
  • 3,332
  • 19
  • 20
  • I see, so OmegaScript is essentially like JavaScript; It's used to produce/display dynamic content from the database on the search site. I was confused and thought OmegaScript could be used to specify how something is indexed by omindex. To set up omindex indexing there's a lot of information [**here**](http://xapian.org/docs/omega/scriptindex.html) – velasco622 Jul 25 '14 at 14:26
  • OmegaScript is really a templating language, so it's more like mustache or something. The documentation about indexing you linked to is about scriptindex, which is an alternative to omindex which is useful when you aren't indexing things in a file system, but maybe pulling data out of a database, and telling omega how to index it. That unfortunately isn't terribly obvious from the documentation :-/ – James Aylett Jul 25 '14 at 16:30