1. Matt Chaput
  2. whoosh
  3. Issues
Issue #177 resolved

Problem with RamIndex and Facets quering

Carlo Pires
created an issue

I was looking the code and doing some tests with RamIndex class. Simple query works fine, but queries with facets don't.

{{{ from whoosh import fields, qparser, sorting

schema = fields.Schema( id=fields.NUMERIC(stored=True, unique=True), name=fields.TEXT(stored=True), nameord=fields.ID, size=fields.NUMERIC, position=fields.NUMERIC(stored=True), names=fields.KEYWORD(lowercase=True, scorable=True), )

from whoosh.ramindex import RamIndex ix = RamIndex(schema)

... populate index ...

with ix.searcher() as searcher: parser = qparser.QueryParser("name", ix.schema) query = parser.parse(text) # works fine for result in searcher.search(query): print result

# error
for result in searcher.search(query, sortedby='size'):
    print result

Traceback (most recent call last): File "main2.py", line 161, in <module> for result in searcher.search(query, sortedby='size'): File "/home/carlo/workspace/whooshtest/src/whoosh/searching.py", line 665, in search allow=filter, restrict=mask) File "/home/carlo/workspace/whooshtest/src/whoosh/searching.py", line 1113, in sort catter.set_searcher(s, offset) File "/home/carlo/workspace/whooshtest/src/whoosh/sorting.py", line 201, in set_searcher self.fieldcache = searcher.reader().fieldcache(self.fieldname) AttributeError: 'RamIndex' object has no attribute 'fieldcache' carlo@carlo-P35-DQ6:~/workspace/whooshtest/src$

}}}

Comments (1)

  1. Log in to comment