mchaput / whoosh

Pure-Python full-text search library
Other
569 stars 69 forks source link

Quickstart is not working #37

Closed olastor closed 1 year ago

olastor commented 1 year ago

I tried to copy/paste the quickstart, but it failed after the 4th command (Whoosh==2.7.4, Fedora Linux 37).

Python 3.11.1 (main, Jan  6 2023, 00:00:00) [GCC 12.2.1 20221121 (Red Hat 12.2.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from whoosh.index import create_in
>>> from whoosh.fields import *
>>> schema = Schema(title=TEXT(stored=True), path=ID(stored=True), content=TEXT)
>>> ix = create_in("indexdir", schema)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/myuser/.local/lib/python3.11/site-packages/whoosh/index.py", line 102, in create_in
    return FileIndex.create(storage, schema, indexname)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/myuser/.local/lib/python3.11/site-packages/whoosh/index.py", line 425, in create
    TOC.create(storage, schema, indexname)
  File "/home/myuser/.local/lib/python3.11/site-packages/whoosh/index.py", line 611, in create
    toc.write(storage, indexname)
  File "/home/myuser/.local/lib/python3.11/site-packages/whoosh/index.py", line 676, in write
    stream = storage.create_file(tempfilename)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/myuser/.local/lib/python3.11/site-packages/whoosh/filedb/filestore.py", line 490, in create_file
    fileobj = open(path, mode)
              ^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/home/myuser/somepath/test/indexdir/_MAIN_0.toc.1676924722.8649595'
>>>
olastor commented 1 year ago

I figured out I need to create the "indexdir" folder myself. I think the documentation could be improved to mention that.