[Xapian-discuss] Omega and indexing documents
R. Mattes
rm at seid-online.de
Wed Aug 10 20:01:05 BST 2005
On Wed, 2005-08-10 at 15:12 -0300, Christiano Anderson wrote:
> Hello,
>
> I am trying to build a script in Python to add documents to a database.
> After that I am trying to use Omega to search into this database, but
> Omega cannot retrieve any information from it. I have read omindex.cc
> but I thing I am doing something wrong or something is missing.
>
> This is the script I am using to index:
>
> ------- index.py -------
> import xapian
> db = xapian.WritableDatabase("teste01", xapian.DB_CREATE_OR_OPEN)
> doc = xapian.Document()
>
> record = """caption=Test page
> sample=This is a test
> size=4554
> url=http://www.test.com
> """
>
> doc.set_data(record)
> doc.add_term("Ttext/html")
> doc.add_term("Hhttp://www.test.com")
>
> doc.add_posting(record, 1)
> db.add_document(doc)
> ------ EOF -------
>
> When I open the database with get_data() function, I can retrieve the
> following information:
>
> ---
> caption=Test page
> sample=This is a test
> size=4554
> url=http://www.test.com
> ---
This _looks_ o.k. (but make shure your newlines are really '\n').
> But Omega doesn't return anything when I submit a 'test' search.
How do you perform your 'test' search. Testing with Omega is a bit
tricky since Omega will parse your Querystring (and most likely
stem the terms ...). Why don't you add:
doc.add_term(Rtuxtux)
and then search for "Tuxtux". Note: The capital will force the Query-
parser into parsing the term as a "raw" term and prepend the 'R' tag
(read omaga/docs/termprefixes.txt if this isn't clear).
HTH Ralf Mattes
> Can
> someone point me where is the mistake? Am I using the add_term function
> on the right way?
>
> Thanks
>
> Christiano
>
>
>
>
> _______________________________________________
> Xapian-discuss mailing list
> Xapian-discuss at lists.xapian.org
> http://lists.xapian.org/mailman/listinfo/xapian-discuss
More information about the Xapian-discuss
mailing list