2

If there a way using Whoosh to return the documents that have a field matching exactly the terms in a query?

For example, say I have a schema that has a autograph field that has three possible values; Autograph, Partial autograph, and No Autograph. If I do a standard query autograph:autograph, I get all the records. Because the term autograph is in all records. I have tried doing something like Term('autograph', 'autograph') and applying that to the filter key word argument for the search function, but I end up getting the same results.

Am I doing something wrong?

chadgh
  • 9,063
  • 8
  • 38
  • 54

1 Answers1

-1

I have come up with a solution, It works.

First off, I redefined by schema so that autograph was an ID field in whoosh. Then I added a filter to the search call using a Regex query.

This works, but I am not going to accept it as the answer in hopes that there is a more elegant solution for filtering results.

chadgh
  • 9,063
  • 8
  • 38
  • 54