Show all hits in results () object Whoosh
I'm new to python and whoosh, so maybe this makes it difficult for me to print all the images returned after searching .
Here's my code:
from whoosh.qparser import QueryParser
with ix.searcher() as searcher:
query = QueryParser("title", ix.schema).parse("hd")
results = searcher.search(query)
print results[0]
print results
print len(results), 'resultados'
Here's the output:
<Hit {'brand': u'Best Buy', 'title': u'best buy easy snap hd', 'superpadre': u'audio foto video', 'familia': u'videocamaras', 'detalle_short': u'Easy Snap HD es una pequena videocamara con grabacion en alta definicion ideada para poder llevarla a cualquier lugar. Su ligero peso y su visor TFT LCD de 2,7 con'}>
<Top 10 Results for Term('title', u'hd') runtime=0.000622987747192>
18 resultados
+3
source to share
3 answers
It looks like you are already on the right track. But in reality there can only be one result.
According to the whoosh docs , calling:
Len (Results)
like you gives you the total number of search hits.
So, if the result displays "1 resultados", that's probably all that is indexed.
0
source to share