--
You received this message because you are subscribed to the Google Groups "Whoosh" group.
To post to this group, send email to who...@googlegroups.com.
To unsubscribe from this group, send email to whoosh+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/whoosh?hl=en.
Yes, this page has the basic information you want. I need to go back and
expand the documentation though! Let me know if you have any questions. :)
The basic usage is:
searcher = myindex.searcher()
# Get the document number for the forum topic
topic_docnum = searcher.document_number(id=topic_id)
# Get the iterator of key terms from the "content" field, or
# whatever you called the field containing the main text.
keyterms = searcher.key_terms([topic_docnum], "content", numterms=5)
# Create a query from the key terms
from whoosh import query
q = query.Or([query.Term("content", kt) for kt in keyterms])
# Get the results of the query
results = searcher.search(q, limit=10)
# Display the documents in the results, but skip the original topic
for i, fields in enumerate(results):
if results.docnum(i) != topic_docnum:
print fields
Cheers,
Matt