Anyway to get document postings directly from hit?

Issue #455 resolved
infinitisp created an issue

Quick question: I want to get the postings for the document directly from the hit for the document. This is what I'm current doing, but wondering if I am missing a better way to get it directly from the hit, without having to use skip_to:

if text in hit.matched_terms():
    return hit.[reader/searcher].postings(fieldname, text).skip_to(hit.docnum).spans()
    return None

I also don't quite understand the difference between reader.postings and searcher.postings... they seem to do the same thing, but haven't wrapped my head around the code differences (is this in the docs somewhere?).

And small comment while I'm at it: it would be nice if we could store only the start characters of tokens, rather than both start and end (saves some space and only marginally less useful).

Thanks for this, and for the awesome package!

Comments (2)

  1. infinitisp reporter

    Nevermind! Resolving this. I finally understand the underlying relationship between queries and matchers (and that the whole thing is a bit of a red herring) and realize my first attempt at doing what I was trying to do (do some proximity measurement stuff for ranking) was silly.

  2. Log in to comment