Skip to content

Commit 834f3c3

Browse files
committed
use shared doc
1 parent 6bc1889 commit 834f3c3

File tree

1 file changed

+14
-75
lines changed

1 file changed

+14
-75
lines changed

source/atlas-search.txt

Lines changed: 14 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -126,86 +126,25 @@ Learn more about this helper from the
126126
SearchOperator Helper Methods
127127
-----------------------------
128128

129-
The {+driver-short+} provides helper methods for the following operations:
129+
.. sharedinclude:: dbx/jvm/atlas-search-operator-helpers.rst
130130

131-
.. list-table::
132-
:widths: 40 60
133-
:header-rows: 1
131+
.. replacement:: atlas-query-operators-example
134132

135-
* - Operation
136-
- Description
133+
.. code-block:: java
137134

138-
* - :atlas:`autocomplete </atlas-search/autocomplete/>`
139-
- Performs a search for a word or phrase that contains a sequence of
140-
characters from an incomplete input string.
135+
Bson searchStageFilters = Aggregates.search(
136+
SearchOperator.compound()
137+
.filter(
138+
List.of(
139+
SearchOperator.text(fieldPath("genres"), "Drama"),
140+
SearchOperator.phrase(fieldPath("cast"), "sylvester stallone"),
141+
SearchOperator.numberRange(fieldPath("year")).gtLt(1980, 1989),
142+
SearchOperator.wildcard(fieldPath("title"),"Rocky *")
143+
)));
141144

142-
* - :atlas:`compound </atlas-search/compound/>`
143-
- Combines two or more operators into a single query.
145+
.. replacement:: searchoperator-interface-api-docs
144146

145-
* - :atlas:`equals </atlas-search/equals/>`
146-
- Checks whether a field matches a value you specify.
147-
Maps to the ``equals()`` and ``equalsNull()`` methods
148-
149-
* - :atlas:`exists </atlas-search/exists/>`
150-
- Tests if a path to a specified indexed field name exists in a document.
151-
152-
* - :atlas:`in </atlas-search/in/>`
153-
- Performs a search for an array of BSON number, date, boolean, objectId,
154-
uuid, or string values at the given path and returns documents where the
155-
value of the field equals any value in the specified array.
156-
157-
* - :atlas:`moreLikeThis </atlas-search/moreLikeThis/>`
158-
- Returns documents similar to input documents.
159-
160-
* - :atlas:`near </atlas-search/near/>`
161-
- Supports querying and scoring numeric, date, and GeoJSON point values.
162-
163-
* - :atlas:`phrase </atlas-search/phrase/>`
164-
- Performs a search for documents containing an ordered sequence of terms
165-
using the analyzer specified in the index configuration.
166-
167-
* - :atlas:`queryString </atlas-search/queryString/>`
168-
- Supports querying a combination of indexed fields and values.
169-
170-
* - :atlas:`range </atlas-search/range/>`
171-
- Supports querying and scoring numeric, date, and string values.
172-
Maps to the ``numberRange()`` and ``dateRange()`` methods
173-
174-
* - :atlas:`regex </atlas-search/regex/>`
175-
- Interprets the query field as a regular expression.
176-
177-
* - :atlas:`text </atlas-search/text/>`
178-
- Performs a full-text search using the analyzer that you specify in the
179-
index configuration.
180-
181-
* - :atlas:`wildcard </atlas-search/wildcard/>`
182-
- Enables queries which use special characters in the search string that
183-
can match any character.
184-
185-
Example Pipeline Search Stage
186-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
187-
188-
.. note:: Atlas Sample Dataset
189-
190-
This example uses the MongoDB Atlas sample dataset. Specifically, the
191-
``movies`` collection in the ``sample_mflix`` database. You can learn how
192-
to set up your own free-tier Atlas cluster and how to load the sample dataset
193-
in our :ref:`quick start guide <java-get-started>`.
194-
195-
The following code creates a search stage for a pipeline with the following filters:
196-
197-
- Movies in the drama genre
198-
- Movies that include Sylvester Stallone in the cast, accounting for possible misspellings
199-
- Movies made between 1980 and 1989, inclusive
200-
- Movies with titles that begin with the word ``"Rocky"``
201-
202-
.. literalinclude:: /includes/fundamentals/code-snippets/builders/AggregateSearchBuilderExample.java
203-
:start-after: // begin atlasHelperMethods
204-
:end-before: // end atlasHelperMethods
205-
:language: java
206-
:dedent:
207-
208-
To learn more about the helper methods, see the `SearchOperator Interface API documentation <{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/model/search/SearchOperator.html>`__.
147+
the `SearchOperator Interface API documentation <{+core-api+}/com/mongodb/client/model/search/SearchOperator.html>`__
209148

210149
Additional Information
211150
----------------------

0 commit comments

Comments
 (0)