Make Query Limit Results Configurable #56
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,6 +107,21 @@ should_query_with_limit_and_skip(Db) -> | |
]}, | ||
?_assertEqual(Expect, Result). | ||
|
||
should_query_with_config_limit_and_skip(Db) -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this test is never run.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (neither is This is cause we need to mention them explicitly above, they're not auto-detected There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my suspicion is your new test fails, because of the bug mentioned. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tonysun83 Wait. We just figured out that |
||
ok = config:set("couch_db", "max_query_limit", 3), | ||
Result = run_query(Db, [ | ||
{start_key, <<"2">>}, | ||
{limit, 6}, | ||
{skip, 3} | ||
]), | ||
Expect = {ok, [ | ||
{meta, [{total, 11}, {offset, 5}]}, | ||
mk_row(<<"5">>, <<"1-aaac5d460fd40f9286e57b9bf12e23d2">>), | ||
mk_row(<<"6">>, <<"1-aca21c2e7bc5f8951424fcfc5d1209d8">>), | ||
mk_row(<<"7">>, <<"1-4374aeec17590d82f16e70f318116ad9">>) | ||
]}, | ||
?_assertEqual(Expect, Result). | ||
|
||
should_query_with_include_docs(Db) -> | ||
Result = run_query(Db, [ | ||
{start_key, <<"8">>}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be
max_query_limit
, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
max_query_limit
confusing. Is it max value I can put intolimit
query parameter?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But section name
couch_db
is something strange. We don't have any of such.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just mean it needs to match with the setting in the test, but yes, that's the point, right? An optional forced upper value of ?limit=X.
good catch of section name, it should be
couch_mrview
imo.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. My point was about thin difference between
default_query_limit
andmax_query_limit
. First one assumes that you can specify any value instead to override the default, even greater than. The second implies (at least for me) that I cannot beat that value in config file, so?limit=100
withmax_query_limit=10
will still return 10 records back.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm..I should read the code probably, lol. The
min(Limit, ConfigDefault1)
is quite specific on the intentions. So everything is correct here, you're right.