2

How do I get an indexed document or document field value by document number (doc id) using Whoosh?

For example, if I get a set of matches by matcher=myquery.matcher(s); I can get matched doc num by matcher.id. How could we retrieve the document information by the doc num ?

I can't find any method in whoosh.reading.IndexReader allowing me to retrieve doc by docnum.

AlG
  • 14,697
  • 4
  • 41
  • 54
user3786340
  • 190
  • 1
  • 8

1 Answers1

3

Find one solution via Whoosh documentation. Document information can be further retrieved by stored_fields method in whoosh.searching.Searcher. An example usage to get doc title by docnum can be achieved searcher.stored_fields(matcher.id())["title"]

user3786340
  • 190
  • 1
  • 8