daevaorn / djapian

High level Xapian integration for Django
Other
6 stars 3 forks source link

Rebuild for 2.0 does not work for me #48

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Removeld 1.0 code
2. Updated to the new version
3. run : pyhon manage.py index --rebuild

{{{
Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File
"/home/aaloy/.virtualenvs/trunk/lib/python2.5/site-packages/django/core/manageme
nt/__init__.py",
line 350, in execute_manager
    utility.execute()
  File
"/home/aaloy/.virtualenvs/trunk/lib/python2.5/site-packages/django/core/manageme
nt/__init__.py",
line 295, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File
"/home/aaloy/.virtualenvs/trunk/lib/python2.5/site-packages/django/core/manageme
nt/base.py",
line 195, in run_from_argv
    self.execute(*args, **options.__dict__)
  File
"/home/aaloy/.virtualenvs/trunk/lib/python2.5/site-packages/django/core/manageme
nt/base.py",
line 222, in execute
    output = self.handle(*args, **options)
  File
"/home/aaloy/workspace/trespams/djapian/management/commands/index.py", line
94, in handle
    rebuild(verbose)
  File
"/home/aaloy/workspace/trespams/djapian/management/commands/index.py", line
66, in rebuild
    indexer.update(after_index=after_index)
  File "/home/aaloy/workspace/trespams/djapian/indexer.py", line 207, in update
    generator.index_text(smart_unicode(value), field.weight, prefix)
TypeError: in method 'TermGenerator_index_text', argument 3 of type
'Xapian::termcount'
}}}

Please provide any additional information below.
The indexhell stats command also fails.

Original issue reported on code.google.com by antoni.aloy@gmail.com on 8 Mar 2009 at 1:00

GoogleCodeExporter commented 9 years ago
It seems self.__class__.fields is supposed to return a list, but it returns a 
tuple
containing the fields, like (['title', 'body'],) so the code figures these are 
tags
instead of fields.

I'm using last django trunk version.

Original comment by antoni.aloy@gmail.com on 8 Mar 2009 at 2:57

GoogleCodeExporter commented 9 years ago
Please post here you indexer class definition

Original comment by daevaorn on 8 Mar 2009 at 6:26

GoogleCodeExporter commented 9 years ago
Here it its. Modifiying the code to manage what we get from Django in the init 
works
for me ...

{{{
class EntryIndexer(djapian.Indexer):
    fields = ['headline',
              'body_markdown',
            ],
    tags=[
        ( "title","headline", 1),
        ( "body","body_markdown", 2),
    ]
    trigger=lambda indexer, obj: obj.active

djapian.add_index(Entry, EntryIndexer, attach_as="indexer")
}}}

Original comment by antoni.aloy@gmail.com on 8 Mar 2009 at 8:10

GoogleCodeExporter commented 9 years ago
Oh, you have unneeded comma after fields list closing brace

Original comment by daevaorn on 8 Mar 2009 at 9:25

GoogleCodeExporter commented 9 years ago
:) True 
I shoud have checked the code alt lest a dozen of times :). Thanks!

Original comment by antoni.aloy@gmail.com on 8 Mar 2009 at 9:31

GoogleCodeExporter commented 9 years ago
I've removed the comma and it works perfectly. Thanks again!

Original comment by antoni.aloy@gmail.com on 8 Mar 2009 at 9:35

GoogleCodeExporter commented 9 years ago
Ok. Glad to help.

Original comment by daevaorn on 8 Mar 2009 at 9:37

GoogleCodeExporter commented 9 years ago

Original comment by daevaorn on 8 Mar 2009 at 10:22