collective / collective.solr

Solr search engine integration for Plone
https://pypi.org/project/collective.solr/
21 stars 46 forks source link

Avoid java.lang.NumberFormatException in Solr when the 'rows' parameter #358

Closed tisto closed 1 year ago

tisto commented 1 year ago

…er exceeds a certain value. This fixes #357

davisagli commented 1 year ago

There is a failing test:

 Error in test testSimpleSearch (collective.solr.tests.test_query.SearchTests)
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/unittest/case.py", line 591, in run
    self._callTestMethod(testMethod)
  File "/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/unittest/case.py", line 549, in _callTestMethod
    method()
  File "/home/runner/work/collective.solr/collective.solr/src/collective/solr/tests/test_query.py", line 415, in testSimpleSearch
    results = self.search(query, rows="10", wt="xml", indent="on").results()
/home/runner/work/collective.solr/collective.solr/src/collective/solr/tests/test_solr.py:31: DeprecationWarning: Please use assertEqual instead.
  self.failUnlessEqual(str(output), add_request.decode("utf-8"))
  File "/home/runner/work/collective.solr/collective.solr/src/collective/solr/search.py", line 114, in search
    if "rows" in parameters and parameters["rows"] > 1000000000:
TypeError: '>' not supported between instances of 'str' and 'int'
davisagli commented 1 year ago

I'm doing a bit more work on this, standardizing how the max rows are set in several different places in the codebase.

davisagli commented 1 year ago

@tisto I'd like your feedback since I changed a few more things than you were originally working on.

tisto commented 1 year ago

@davisagli thank you! LGTM! I was too lazy to look into standardizing stuff. :)