I am trying to build a search engine, I started with Whoosh. The tutorial and
web based materials are fine. Web has sizable question and answers. The initial
experiments seem going fine. But I want to handle files located in various
parts of my machine. I found "from whoosh.filedb.filestore import FileStorage",
but I am looking for a simple example to start with. I tried something as
below, it may be giving some result but is it going okay? If any one may please
see and correct if required?
>>> txt_file1=open("/python27/whooshtext1.txt","r").read()
>>> txt_file2=open("/python27/whooshtext3.txt","r").read()
>>> writer.add_document(title=u"First document", path=
>>> unicode("indexdir"+os.sep+"a"),content=u"txt_file1")
>>> writer.add_document(title=u"Second document", path=
>>> unicode("indexdir"+os.sep+"b"),content=u"txt_file2")
>>> writer.commit()
>>> with ix.searcher() as searcher:
query = QueryParser("content", ix.schema).parse("flood")
results = searcher.search(query)
print results
for result in results:
print result
<Top 0 Results for Term('content', u'flood') runtime=0.000124042337439>
>>>
--
https://mail.python.org/mailman/listinfo/python-list