[Xapian-devel] debug with simplequery1

Olly Betts olly at survex.com
Thu Jun 5 04:56:51 BST 2014


On Thu, Jun 05, 2014 at 10:46:07AM +0800, Hurricane Tong wrote:
> But I didn't find the code where the files concerning with test
> simplequery1 get indexed.

The code to create a suitable database for the backend we're running the
testcase for is in tests/harness/.

But I think you might do better to start more simply - for example, try
indexing a single document to a brass database:

$ rm -rf tmp.db
$ echo hello world | XAPIAN_PREFER_BRASS=1 examples/simpleindex tmp.db

Then you can look at it with delve:

$ bin/xapian-delve tmp.db 
UUID = 1636c618-30c9-47ac-9cd7-f2073a18136f
number of documents = 1
average document length = 4
document length lower bound = 4
document length upper bound = 4
highest document id ever used = 1
has positional information = true

(You'll have a different UUID)

And dump out the document length list (there's a bug in recent trunk
which I've just fixed - if you have assertions on this command will
fail, and you'll need the fix from commit 181fcf4):

$ bin/xapian-delve tmp.db -t '' -1 -v
Posting List for term '' (termfreq 1, collfreq 1, wdf_max 0):
1 1 4

The "-t ''" means "show the doclength postlist"; "-1" means "one entry
per line"; "-v" means "show more info".

The last column is the doclength (the other two are always 1 for the
doclength postlist).  It is 4 because we index each term both stemmed
and unstemmed.

If that works, try it with a second document:

$ rm -rf tmp.db
$ printf 'hello world\n\nsecond doc' | XAPIAN_PREFER_BRASS=1 examples/simpleindex tmp.db

And so on...

> but I failed.
> When I set a break point at L1556 of brass_postlist.cc( the function merge_doclen_changes ),
> I get
> (gdb) b brass_postlist.cc:1556
> No source file named brass_postlist.cc.

The source file is: backends/brass/brass_postlist.cc

Cheers,
    Olly



More information about the Xapian-devel mailing list