hg tip not working?

9 views
Skip to first unread message

clach04

unread,
Oct 30, 2011, 6:16:37 PM10/30/11
to Whoosh
I just tried the latest code from bitbucket and search isn't working
for me in my application.

I just tried the quickstart at http://packages.python.org/Whoosh/quickstart.html
and once the index dir is created:



import os
try:
os.mkdir("indexdir")
except OSError:
pass # assume already exists...


and modified the search to use a unicode string:

query = QueryParser("content", ix.schema).parse(u"first")

I get :

Traceback (most recent call last):
File "whoosh_doc_demo.py", line 25, in <module>
print results[0]
File "......fullpath..../whoosh/searching.py", line 1266, in
__getitem__
return Hit(self, self.top_n[n][1], n, self.top_n[n][0])
IndexError: list index out of range

clach04

unread,
Nov 29, 2011, 11:49:03 PM11/29/11
to Whoosh
On Oct 30, 2:16 pm, clach04 <clac...@gmail.com> wrote:
> I just tried the latest code from bitbucket and search isn't working
> for me in my application.
>
> I just tried the quickstart athttp://packages.python.org/Whoosh/quickstart.html

> and once the index dir is created:

Here is my complete script (the demo in the docs needs updating as it
doesn't work at the moment):

#------------
import os

from whoosh.index import create_in
from whoosh.fields import *
from whoosh.qparser import QueryParser

try:
os.mkdir("indexdir")
except OSError:
pass # assume already exists...

schema = Schema(title=TEXT(stored=True), path=ID(stored=True),
content=TEXT)
ix = create_in("indexdir", schema)
writer = ix.writer()
writer.add_document(title=u"First document", path=u"/a",
content=u"This is the first document we've
added!")
writer.add_document(title=u"Second document", path=u"/b",
content=u"The second one is even more
interesting!")
writer.commit()


with ix.searcher() as searcher:


query = QueryParser("content", ix.schema).parse(u"first")

results = searcher.search(query)
print results[0]
#------------

Reply all
Reply to author
Forward
0 new messages