from whoosh.qparser import QueryParser from whoosh.index import open_dir index = open_dir("my_index") # Create a QueryParser object for the "content" field parser = QueryParser("content", schema=index.schema) # Parse the query string "hello" query = parser.parse("hello") # Search for documents containing the query with index.searcher() as searcher: results = searcher.search(query) for result in results: print(result)
from whoosh.qparser import QueryParser from whoosh.index import open_dir index = open_dir("my_index") # Create a QueryParser object for the "content" field parser = QueryParser("content", schema=index.schema) # Parse the query string "hello OR \"goodbye world\"" query = parser.parse("hello OR \"goodbye world\"") # Search for documents containing the query with index.searcher() as searcher: results = searcher.search(query) for result in results: print(result)Package/library: Whoosh.