I am working with the library WHOOSH in order to make query on my documents but my understanding is limited.
As the documentation expose I have the folowing dodument "whoosh is a very beautiful library" and my query is 'whoosh library'~2. I expect the searcher fail because the distance in between "whoosh" and "library" is greater than 2.
Next enclosed a mimale code to exprime the problème I have. hsdlhhd
import tempfile
from whoosh.fields import Schema, TEXT, ID, NUMERIC
from whoosh.index import create_in
from whoosh.qparser import QueryParser
from whoosh.query import *
index = tempfile.mkdtemp()
schema = Schema(text=TEXT(stored=True))
ix = create_in(index, schema)
writer = ix.writer()
writer.add_document(text="whoosh is a very beautiful library")
writer.commit(optimize=True)
parser = QueryParser("text", schema=ix.schema)
query = parser.parse("'whoosh library'~2")
with ix.searcher() as searcher:
results = searcher.search(query)
for hit in results:
print(hit)