Whoosh NUMERIC float fields

Issue #448 new
Anonymous created an issue

With the following code:

#!/usr/bin/env python3

import os
from whoosh.index import create_in
import whoosh.fields as fields

indexdir = "test"

schema = fields.Schema(floatfield=fields.NUMERIC(numtype=float, sortable=True, stored=True))

if not os.path.exists(indexdir):
    os.mkdir(indexdir)
ix = create_in(indexdir, schema)
writer = ix.writer()

writer.add_document(floatfield=1.5)
writer.commit()

I get the following error:

$ ./whoosh-error-float.py 
Traceback (most recent call last):
  File "./whoosh-error-float.py", line 16, in <module>
    writer.add_document(floatfield=1.5)
  File "/usr/local/lib/python3.5/site-packages/whoosh/writing.py", line 784, in add_document
    perdocwriter.add_column_value(fieldname, column, cv)
  File "/usr/local/lib/python3.5/site-packages/whoosh/codec/base.py", line 820, in add_column_value
    self._create_column(fieldname, column)
  File "/usr/local/lib/python3.5/site-packages/whoosh/codec/whoosh3.py", line 190, in _create_column
    writers[fieldname] = column.writer(f)
  File "/usr/local/lib/python3.5/site-packages/whoosh/columns.py", line 649, in writer
    return self.Writer(dbfile, self._typecode, self._default)
  File "/usr/local/lib/python3.5/site-packages/whoosh/columns.py", line 666, in __init__
    self._defaultbytes = self._pack(default)
struct.error: required argument is not an integer

also see info about my system:

$ pip3 show whoosh
---
Metadata-Version: 2.0
Name: Whoosh
Version: 2.7.4
Summary: Fast, pure-Python full text indexing, search, and spell checking library.
Home-page: http://bitbucket.org/mchaput/whoosh
Author: Matt Chaput
Author-email: matt@whoosh.ca
Installer: pip
License: Two-clause BSD license
Location: /usr/local/lib/python3.5/site-packages
Requires: 
Classifiers:
  Development Status :: 5 - Production/Stable
  Intended Audience :: Developers
  License :: OSI Approved :: BSD License
  Natural Language :: English
  Operating System :: OS Independent
  Programming Language :: Python :: 2.5
  Programming Language :: Python :: 3
  Topic :: Software Development :: Libraries :: Python Modules
  Topic :: Text Processing :: Indexing

Sorry for posting this anonymously, this is Andrew Stromme (andrewstromme.com), but my Bitbucket account seems broken in a login redirect loop.

Comments (0)

  1. Log in to comment