1

I have a collection of documents and I want to create a search engine for my website. The documents are static and in another question, they suggested me Whoosh. However, I cannot even setup through the documentation help code.

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

   # Create an index
   schema = Schema(content=TEXT)

   ix = create_in("indexdir", schema)

   writer = ix.writer()

   writer.add_document(content=u"This is the first document we've added!")
   writer.add_document(content=u"The second one is even more interesting!")

   writer.commit()

And here is the Error:

ix = create_in("indexdir", schema)
  File "build\bdist.win-amd64\egg\whoosh\index.py", line 90, in create_in
    storage = FileStorage(dirname)
  File "build\bdist.win-amd64\egg\whoosh\filedb\filestore.py", line 70, in __init__
    raise IOError("Directory %s does not exist" % path)
IOError: Directory indexdir does not exist

Is there something else I have to add on indexdir?

Michelle
  • 2,830
  • 26
  • 33
Sfinos
  • 279
  • 4
  • 15

1 Answers1

0

first you have to create a directory using e.g os.mkdir("indexdir")

Steve Harrison
  • 315
  • 3
  • 8