Hello Guys,
First place, I want to thank u for excellence work, now I can biuld my
ownd google :). I spent 2 days to figuring out all system, I had
problem with indexing documents becouse for test I used:
$database = new XapianWritableDatabase(XAPIAN_DB_FILE,
Xapian::DB_CREATE_OR_OVERWRITE );
after that, database was created, all docs was indexed, but..
$database->get_doccount() has return 0, strange, but after changing to
DB_CREATE_OR_OPEN, everything was working almost perfect. Now when Im
indexing documents, I've to index them twice.
When I use $database->flush(); (and there is no any files yet) I get
error: DatabaseError: Error reading from file. After second indexing
everything is working fine (hocus-pocus).
Ok. Next thing is prefix, I dont know how its should work or maybe I
dont undestand idea.
I way:
indexing:
$doc->add_term('XP'.$value['shopid']);
searching:
$filter_query = new XapianQuery( "XP{$shopid}" );
$query = new XapianQuery(XapianQuery::OP_FILTER, array($query,$filter_query));
Parsed query is: Xapian::Query((XP623 AND product:(pos=1))) 1 results found: 1:
100% docid=214 []
II way:
indexing:
indexer->index_text($value['shopid'], 2, 'shopid');
searching:
$qp->add_prefix( 'shopid', 'S' );
$query = $qp->parse_query($query_string);
$slift = new XapianQuery( "S{$shopid}" );
$query = new XapianQuery( XapianQuery::OP_AND, $slift, $query);
result: Parsed query is: Xapian::Query((S623 AND product:(pos=1))) 0 results
found
Could anyone explain me if Im wrong or sth, I thought, that when Im
setting term with prefix (shopid), and than searching with
added prefix (S), than it should replace S to shopid and find like
here:
http://xapian.org/docs/apidoc/html/classXapian_1_1QueryParser.html#dfd545b4ac739adc2e4171169a500f33
for me it deosnt work ;/ I dont know why. First way is working, but
this doesnt work like prefix, only a normal term juz like
'XX_phrase_XX'
Could you provide me an axample, or tell, what Im doing wrong? Thanks.
--
Best regards,
Rafi mailto:webdeveloper at poczta.onet.pl