summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkarlin <karlin@atomicobject.com>2013-10-23 17:02:15 -0400
committerAlexander Shorin <kxepal@apache.org>2013-10-25 19:20:09 +0400
commite3b0c245ecd5e8d7ee9779183032c63c92f694cb (patch)
treee3b3a2f954107ba989c13400439825d51d7e8b95
parentff3fd64d93041d2cc3063b53d29eaaf3e1215716 (diff)
downloadcouchdb-e3b0c245ecd5e8d7ee9779183032c63c92f694cb.tar.gz
Fixing language in description of filters
Signed-off-by: Alexander Shorin <kxepal@apache.org>
-rw-r--r--share/doc/src/couchapp/ddocs.rst43
1 files changed, 21 insertions, 22 deletions
diff --git a/share/doc/src/couchapp/ddocs.rst b/share/doc/src/couchapp/ddocs.rst
index 1920a4207..2625d1473 100644
--- a/share/doc/src/couchapp/ddocs.rst
+++ b/share/doc/src/couchapp/ddocs.rst
@@ -437,10 +437,10 @@ Filter functions
:param doc: Processed document object.
:param req: :ref:`request_object`
:return: Boolean value: ``true`` means that `doc` passes the filter rules,
- ``false`` that not.
+ ``false`` means that it does not.
-Filter functions are mostly acts like :ref:`showfun` and :ref:`listfun`: they
-formats, but more correctly to say, they *filters* :ref:`changes feed<changes>`.
+Filter functions mostly act like :ref:`showfun` and :ref:`listfun`: they
+format, or *filter* the :ref:`changes feed<changes>`.
Classic filters
---------------
@@ -448,12 +448,11 @@ Classic filters
By default the changes feed emits all database documents changes. But if you're
waiting for some special changes, processing all documents is inefficient.
-Filters are special design document functions that allows changes feed to emit
+Filters are special design document functions that allow the changes feed to emit
only specific documents that pass filter rules.
-Lets assume that our database is a mailbox and we need to to handle only new mails
-(documents with status `new`) events. Assuming that, our filter function
-will looks like next one:
+Let's assume that our database is a mailbox and we need to handle only new mail
+events (documents with status `new`). Our filter function will look like this:
.. code-block:: javascript
@@ -469,8 +468,8 @@ will looks like next one:
return true; // passed!
}
 
-Filter functions must return ``true`` in fact if document passed all defined
-rules. Now, if you apply this function to changes feed it will emit only changes
+Filter functions must return ``true`` if a document passed all defined
+rules. Now, if you apply this function to the changes feed it will emit only changes
about "new mails"::
GET /somedatabase/_changes?filter=mailbox/new_mail HTTP/1.1
@@ -483,20 +482,20 @@ about "new mails"::
],
"last_seq":27}
-Note, that ``last_seq`` number is 27, but we'd received only two records.
-Seems like any other changes was about documents that hasn't passed our filter.
+Note that the value of ``last_seq`` is 27, but we'd received only two records.
+Seems like any other changes were for documents that haven't passed our filter.
-Probably, we also need to filter changes feed of our mailbox not only by single
-status value: we're also interested in statuses like "spam" to update
-spam-filter heuristic rules, "outgoing" to let mail daemon actually send mails
-and so on. Creating a lot of similar functions that actually does similar work
-isn't good idea - so we need dynamic filter to go.
+We probably need to filter the changes feed of our mailbox by more than a single
+status value. We're also interested in statuses like "spam" to update
+spam-filter heuristic rules, "outgoing" to let a mail daemon actually send mails,
+and so on. Creating a lot of similar functions that actually do similar work
+isn't good idea - so we need a dynamic filter.
-If you have noted, filter functions takes second argument as
-:ref:`request <request_object>` object - it allows to create dynamic filters
+You may have noticed that filter functions take a second argument named
+:ref:`request <request_object>` - it allows creating dynamic filters
based on query parameters, :ref:`user context <userctx_object>` and more.
-The dynamic version of our filter now will be next:
+The dynamic version of our filter looks like this:
.. code-block:: javascript
@@ -512,7 +511,7 @@ The dynamic version of our filter now will be next:
return true; // passed!
}
-and now we have pass `status` query parameter in request to let filter match
+and now we have passed the `status` query parameter in request to let our filter match
only required documents::
GET /somedatabase/_changes?filter=mailbox/by_status&status=new HTTP/1.1
@@ -525,7 +524,7 @@ only required documents::
],
"last_seq":27}
-and we can change filter behavior with easy::
+and we can easily change filter behavior with::
GET /somedatabase/_changes?filter=mailbox/by_status&status=spam HTTP/1.1
@@ -537,7 +536,7 @@ and we can change filter behavior with easy::
"last_seq":27}
-Combining filters with `continuous` feed allows to create powerful event-driven
+Combining filters with a `continuous` feed allows creating powerful event-driven
systems.
.. _viewfilter: