[Xapian-discuss] use TermGenerator to get the term
Ying Liu
liux0395 at umn.edu
Thu Oct 29 23:37:31 GMT 2009
Well, the ESet perl package is not available now.
I am playing around with the perl modules of Document, TermGenerator,
TermIterator, PositionIterator, and PostingIterator. I still have the
same question. How can I get the term by the term position? I can move
the index to be begin or end of the term, and I can move the index to
the next term by alphabetical order and get the term. But how can I
index the terms of a document and get a term by the term position. I
just start with Xapian, Thank you for your help.
Ying
Ying Liu wrote:
> Hello all,
>
> I have a question about use the TermGenerator alone by Perl. Someone
> asked this question before and his code is in C++.
> (http://lists.xapian.org/pipermail/xapian-discuss/2008-November/006109.html).
> My code is in Perl. Can I get the term by the position just by
> TermGenerator?
>
> my $analyzer = Search::Xapian::TermGenerator->new;
> $analyzer->index_text("hello Xapian world");
> my $curr_position = $analyzer->get_termpos();
> $analyzer->set_termpos(2); $curr_position = $analyzer->get_termpos();
> $analyzer->increase_termpos(1);
> $curr_position = $analyzer->get_termpos();
>
> If I set the document and then use $doc to iterate the term list,
> terms are order alphabetically. I don't know how to use the positer().
>
> $analyzer->set_document($doc);
> my $termlist_begin = $doc->termlist_begin();
> $termlist_begin++;
> my $term = $termlist_begin->get_document();
>
>
> Btw, if I want to use ESet, how to assign the text, similar method
> like index_text for ESet?
>
> Thank you,
> Ying
>
> _______________________________________________
> 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