daevaorn / djapian

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

filtering by a tag does not work as expected #102

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have a model with a tag like this one:

{{{
class ProductIndexer(WeightenedIndexer):
    fields = ('name', 'comments',
              )
    tags = (('client_id', 'client.id'),
            )
    trigger = lambda indexer, obj: obj.client and obj.client.is_enabled

    weight = 'client.registration'
}}}

I need to filter search results by the 'client_id' tag like
{{{
queryset = Product.indexer.search(q).prefetch(True).filter(client_id=obj.id)
}}}

But this code always returns empty ResultSet even if there are non-empty 
results 
without filtering, and Hits has reasonable values for the 'client_id' tag:
{{{
queryset = Product.indexer.search(q).prefetch(True)
}}}

Original issue reported on code.google.com by esizi...@gmail.com on 14 Feb 2010 at 12:59

GoogleCodeExporter commented 9 years ago
May be it is a types mismatch problem? Try to convert obj.id to string while 
filtering.

Original comment by daevaorn on 14 Feb 2010 at 7:00

GoogleCodeExporter commented 9 years ago
Force converting to a string resolved the issue. Dunno why I supposed Djapian 
will do
it for me... But, hey, it does converted things during indexing, why it doesn't
convert during search? I think it's a software design issue (even if not a bug).

Original comment by esizi...@gmail.com on 14 Feb 2010 at 7:03

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by daevaorn on 22 Feb 2010 at 6:29

GoogleCodeExporter commented 9 years ago
Issue 55 has been merged into this issue.

Original comment by daevaorn on 22 Feb 2010 at 6:29

GoogleCodeExporter commented 9 years ago
Fixed in r352

Original comment by daevaorn on 22 Feb 2010 at 6:33