[Xapian-discuss] PHP termpos issue
Mike Ragalie
ragalie at fas.harvard.edu
Thu Aug 23 19:40:38 BST 2007
Thanks Olly.
The latter formulation is working for me now; I didn't realize that the
TermGenerator doesn't attach position information to stemmed terms. Once I
wrote my own parser and used add_posting() to add position information to
the stemmed terms, positionlist_begin() and end() worked properly :)
Thanks again,
-Mike
On 8/23/07, Olly Betts <olly at survex.com> wrote:
>
> On Sun, Aug 19, 2007 at 10:53:18PM -0500, Mike Ragalie wrote:
> > I just started playing around with Xapian using the php bindings and am
> > having some trouble getting the term positions for terms returned by a
> > query.
> > [snip]
> > When I run the script, I get this: "InvalidOperationError:
> > VectorTermList::positionlist_begin() isn't meaningful"
>
> This isn't supported (at the C++ level).
>
> It's unclear to me what the most natural semantics would be. It
> wouldn't be too hard for it just to return all the positions at which
> the term occurred, but perhaps it's more natural for it to return the
> positions which were relevant to the query run (so for a phrase search
> it would only show where the the term matched as part of the phrase).
> That's not something we currently know, so we'd have to write the code
> to work this out.
>
> > I tried using $database->positionlist_begin($curdoc->get_docid(),
> $curterm)
> > as well, but when I used that the while loop simply didn't run.
>
> That should work if you want all the positions. It's hard to say why
> it didn't for you without seeing the code you had. Here's a post with
> some suitable C++ code if that helps:
>
> http://article.gmane.org/gmane.comp.search.xapian.general/2187
>
> Cheers,
> Olly
>
>
--
Michael Ragalie
Chair, Student Affairs Committee
Harvard Undergraduate Council
Email: ragalie at fas.harvard.edu
Mobile: 262.358.1364
More information about the Xapian-discuss
mailing list