Export to GitHub

pybing - issue #8

Results are incorrect when bing returns an exact total result count


Posted on Jan 4, 2012 by Massive Giraffe

For example this query: http://api.search.live.net/json.aspx?Query=ninjas&Version=2.0&AppId=<YOUR_APP_ID>&Sources=Web&Web.Count=50

returns an exact result count (37-40 right now, likely to change). It appears that pybing expects this to be >1000 always and doesn't check the actual returned total count. Iterating through such a query yields hundreds of repeated results.

Here is an example program that exposes the problem using svn trunk:

!/usr/bin/env python

from pybing.query import WebQuery q = WebQuery("<YOUR_APP_ID>", query="ninjas") results = q.execute() for result in results: # outputs 760 results for me = 37 actual results each occuring 20 times print result.title.encode('utf-8')

Comment #1

Posted on Jan 4, 2012 by Massive Giraffe

*38 actual results each occuring 20 times

Comment #2

Posted on Feb 24, 2012 by Happy Monkey

I am encountering this problem as well. I think the problem is in getitem() in resultset.py, in "if absolute_index not in self.results"; if I comment that out the code works fine and doesn't return duplicates but ONLY if you take a slice of results. I want all results, so I'm just giving a very large number (e.g. results[:99999])

Comment #3

Posted on Feb 24, 2012 by Happy Monkey

Note: with this workaround, len(results) will still return MAX_RESULTS.

Status: New

Labels:
Type-Defect Priority-Medium