[Xapian-discuss] get position terms from a query result

Richard Boulton richard at lemurconsulting.com
Wed Jul 11 15:40:20 BST 2007


...lorenzo wrote:
> is there any way to obtain, after a phrasal query, the position of the 
> terms
> found?
> i'll try to be more clear with an example.
> if i search for "milk coffe brain" phrase, and i have a result in document
> 5, is there any way to get the position (that xapian knows...) of this term
> ( e.g. milk in pos 147, coffe 148 and brain 149)?

I'm afraid there isn't currently any way to get this: at the moment, 
you'll need to open the document, get the position lists for the terms 
from it, and look for the phrase yourself.

It would be nice to have API support for doing this, but it probably 
wouldn't be able to directly reuse the information determined during the 
initial match process, because this would require quite a bit of 
restructuring of the matcher, and would also increase the memory usage 
during the match.

Also, note that if the query is of the form "a OR (b PHRASE c)" we may 
not have a matching phrase, so the API would need to be flexible enough 
to represent this.

-- 
Richard



More information about the Xapian-discuss mailing list