Remove text search limit
Rather than use hardcoded values for text search limit,
we fit the value within the configurable Dreyfus max_limit
parameter.
FogBugzID: 44968
diff --git a/src/mango_cursor_text.erl b/src/mango_cursor_text.erl
index c774c82..ec83240 100644
--- a/src/mango_cursor_text.erl
+++ b/src/mango_cursor_text.erl
@@ -49,10 +49,8 @@
Opts = unpack_bookmark(Db#db.name, Opts0),
- % Limit the result set size to 50 for Clouseau's
- % sake. We may want to revisit this.
- Limit0 = couch_util:get_value(limit, Opts, 50),
- Limit = if Limit0 < 50 -> Limit0; true -> 50 end,
+ DreyfusLimit = get_dreyfus_limit(),
+ Limit = erlang:min(DreyfusLimit, couch_util:get_value(limit, Opts, 50)),
Skip = couch_util:get_value(skip, Opts, 0),
Fields = couch_util:get_value(fields, Opts, all_fields),
@@ -282,12 +280,11 @@
get_limit(CAcc) ->
- Total = CAcc#cacc.limit + CAcc#cacc.skip,
- if
- Total < 25 -> 25;
- Total > 100 -> 100;
- true -> Total
- end.
+ erlang:min(get_dreyfus_limit(), CAcc#cacc.limit + CAcc#cacc.skip).
+
+
+get_dreyfus_limit() ->
+ list_to_integer(config:get("dreyfus", "max_limit", "200")).
get_json_docs(DbName, Hits) ->
diff --git a/test/08-text-limit-test.py b/test/08-text-limit-test.py
index 8478773..45c0bc4 100644
--- a/test/08-text-limit-test.py
+++ b/test/08-text-limit-test.py
@@ -48,11 +48,12 @@
# We reach our cap here of 50
def test_limit_field5(self):
- q = {"$or": [{"user_id" : {"$lt" : 100}}, {"filtered_array.[]": 1}]}
- docs = self.db.find(q, limit=55)
- assert len(docs) == 50
+ q = {"age": {"$exists": True}}
+ docs = self.db.find(q, limit=250)
+ print len(docs)
+ assert len(docs) == 75
for d in docs:
- assert d["user_id"] < 100
+ assert d["age"] < 100
def test_limit_skip_field1(self):
q = {"$or": [{"user_id" : {"$lt" : 100}}, {"filtered_array.[]": 1}]}