Skip to content

Commit

Permalink
Merge branch 'master' of ssh://github.com/okfn/ckan into feature-1515…
Browse files Browse the repository at this point in the history
…-activity-streams
  • Loading branch information
David Read committed Jan 19, 2012
2 parents d6de1ad + 4369a1f commit 6cf34f1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
12 changes: 11 additions & 1 deletion ckan/lib/search/query.py
Expand Up @@ -247,7 +247,14 @@ def run(self, query):
query['q'] = "*:*"

# number of results
query['rows'] = min(1000, int(query.get('rows', 10)))
rows_to_return = min(1000, int(query.get('rows', 10)))
if rows_to_return > 0:
# #1683 Work around problem of last result being out of order
# in SOLR 1.4
rows_to_query = rows_to_return + 1
else:
rows_to_query = rows_to_return
query['rows'] = rows_to_query

# order by score if no 'sort' term given
order_by = query.get('sort')
Expand Down Expand Up @@ -297,6 +304,9 @@ def run(self, query):
self.count = response.get('numFound', 0)
self.results = response.get('docs', [])

# #1683 Filter out the last row that is sometimes out of order
self.results = self.results[:rows_to_return]

# get any extras and add to 'extras' dict
for result in self.results:
extra_keys = filter(lambda x: x.startswith('extras_'), result.keys())
Expand Down
4 changes: 4 additions & 0 deletions ckan/tests/lib/test_cli.py
Expand Up @@ -19,6 +19,10 @@ def setup_class(cls):
model.Package.by_name(u'warandpeace').delete()
model.repo.commit_and_remove()

@classmethod
def teardown_class(cls):
model.repo.rebuild_db()

def test_simple_dump_csv(self):
csv_filepath = '/tmp/dump.tmp'
self.db.args = ('simple-dump-csv %s' % csv_filepath).split()
Expand Down
5 changes: 0 additions & 5 deletions ckan/tests/lib/test_dictization.py
Expand Up @@ -105,11 +105,6 @@ def teardown_class(cls):
model.repo.rebuild_db()
model.Session.remove()

def teardonwn(self):
model.Session.remove()



def remove_changable_columns(self, dict):
for key, value in dict.items():
if key.endswith('id') and key <> 'license_id':
Expand Down

0 comments on commit 6cf34f1

Please sign in to comment.