josiahcarlson / redis-in-action

Example code from the book

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

a bug in index_ad

abondar24 opened this issue · comments

Did you really test it?
I got this bug: redis.exceptions.ResponseError: Command # 3 (ZADD idx:indexed 0 1) of pipeline caused error: WRONGTYPE Operation against a key holding the wrong kind of value
on index_ad function. pipeline is broken

Yes, it was tested. Here, let me test it again against the current revision:

josiah@josiah-790 ~/open-source/redis-in-action/python:(master)
$ ack index_ad
ch07_listing_source.py
345:# <start id="index_ad"/>
352:def index_ad(conn, id, locations, content, type, value):
369:# <end id="index_ad"/>
789:        index_ad(self.conn, '1', ['USA', 'CA'], self.content, 'cpc', .25)
790:        index_ad(self.conn, '2', ['USA', 'VA'], self.content + ' wooooo', 'cpc', .125)
josiah@josiah-790 ~/open-source/redis-in-action/python:(master)
$ python ch07_listing_source.py 
.now testing find jobs with levels ...
which passed
.now testing find jobs with years ...
which passed
..We're tokenizing some content...
Those tokens are: set(['content', 'indexed', 'random', 'look'])
And now we are indexing that content...
..And now we are testing search...
Which passed!
..And now let's test searching with sorting...
Which passed!
.And now let's test searching with sorting via zset...
Which passed!
...
----------------------------------------------------------------------
Ran 12 tests in 0.203s

OK

Can you provide a better example that demonstrates the problem? Or at least a full traceback? Maybe did you play around with Redis in a console before running the tests in the code? Have you figured out which key this was relating to?

OP is stealing my code and not retaining my copyright notice. OP is a thief.

Closing this.