Skip to content

Commit

Permalink
Document LocationQuery criterion
Browse files Browse the repository at this point in the history
  • Loading branch information
pspanja committed Aug 6, 2018
1 parent b984acc commit e1e8dcf
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
39 changes: 39 additions & 0 deletions docs/reference/location_query.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
LocationQuery criterion
=======================

``LocationQuery`` criterion can be used with Content search. It allows grouping of Location criteria
so that they apply together on a Location.

.. note::

This feature is available with both Solr and Legacy search engines.

For example, the following query will return Content of type ``article`` if it has hidden Location in
subtree ``/1/2/10/`` and visible Location in some other subtree:

.. code-block:: php
new Query([
'filter' => new LogicalAnd([
new ContentTypeIdentifier('article'),
new Subtree('/1/2/10/'),
new Visibility(Visibility::VISIBLE),
]),
]);
Using ``LocationQuery`` criterion you can write a query that will return Content of type ``article``
only when it has a visible Location in subtree ``/1/2/10/``:

.. code-block:: php
new Query([
'filter' => new LogicalAnd([
new ContentTypeIdentifier('article'),
new LocationQuery(
new LogicalAnd([
new Subtree('/1/2/10/'),
new Visibility(Visibility::VISIBLE),
])
)
]),
]);
1 change: 1 addition & 0 deletions docs/reference/map.rst.inc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
* :doc:`/reference/installation_instructions`
* :doc:`/reference/subdocuments`
* :doc:`/reference/location_query`

0 comments on commit e1e8dcf

Please sign in to comment.