Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1581)

Issue 74900043: Filter charmworld searches by score.

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 1 month ago by bac
Modified:
10 years, 1 month ago
Reviewers:
mp+210660, benji
Visibility:
Public.

Description

Filter charmworld searches by score. This change introduces a new parameter to the API search called 'min_score'. It defaults to a value of 1.0. Searches will be filtered and only those results with a score above min_score will be returned. The min_score will not be used if the search is for all bundles or charms. In addition, the number of results will be limited the smaller of 20 or the limit provided. Again, the limit is not applied if the search is for all charms or bundles. QA: % bin/ingest --limit=20 % make run In another window, interactively poke at it, e.g. % http GET "http://127.0.0.1:2464/api/3/search?text=mysql&min_score=0" % http GET "http://127.0.0.1:2464/api/3/search?text=mysql&min_score=2" % http GET "http://127.0.0.1:2464/api/3/search?text=charmworld&min_score=0" https://code.launchpad.net/~bac/charmworld/1287977/+merge/210660 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+202 lines, -59 lines) Patch
A [revision details] View 1 chunk +2 lines, -0 lines 0 comments Download
M charmworld/search.py View 7 chunks +46 lines, -12 lines 1 comment Download
M charmworld/tests/test_search.py View 11 chunks +140 lines, -40 lines 2 comments Download
M charmworld/views/api/__init__.py View 3 chunks +6 lines, -2 lines 1 comment Download
M charmworld/views/tests/test_api.py View 5 chunks +8 lines, -5 lines 0 comments Download

Messages

Total messages: 2
bac
Please take a look.
10 years, 1 month ago (2014-03-12 18:04:01 UTC) #1
benji
10 years, 1 month ago (2014-03-12 18:38:38 UTC) #2
LGTM

https://codereview.appspot.com/74900043/diff/1/charmworld/search.py
File charmworld/search.py (right):

https://codereview.appspot.com/74900043/diff/1/charmworld/search.py#newcode621
charmworld/search.py:621: hits = self._filter_by_score(hits, min_score)
A note explaining that we don't get scores for sorted queries might be nice
here.

https://codereview.appspot.com/74900043/diff/1/charmworld/tests/test_search.py
File charmworld/tests/test_search.py (right):

https://codereview.appspot.com/74900043/diff/1/charmworld/tests/test_search.p...
charmworld/tests/test_search.py:679: # Make more charms for a total of 22.
Some would say that this test should be broken into two discreet tests because
it does setup, assertions, more setup, more assertions.

https://codereview.appspot.com/74900043/diff/1/charmworld/tests/test_search.p...
charmworld/tests/test_search.py:710: # Make more charms for a total of 22.
Another candidate for two tests.

https://codereview.appspot.com/74900043/diff/1/charmworld/views/api/__init__.py
File charmworld/views/api/__init__.py (right):

https://codereview.appspot.com/74900043/diff/1/charmworld/views/api/__init__....
charmworld/views/api/__init__.py:723: min_score = float(min_score[0])
The min_score behavior is a little weird; maybe a description should be added to
the docstring.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b