@@ -9,7 +9,7 @@ Atlas Search & Vector Search
9
9
:values: reference
10
10
11
11
.. meta::
12
- :keywords: code example, semantic, embeddings
12
+ :keywords: code example, semantic, embeddings, text
13
13
14
14
.. contents:: On this page
15
15
:local:
@@ -33,8 +33,8 @@ documentation:
33
33
.. note:: Deployment Compatibility
34
34
35
35
You can use the Atlas Search and Vector Search features only when
36
- connecting to MongoDB Atlas clusters. These features are not available for
37
- self-managed deployments.
36
+ you connect to MongoDB Atlas clusters. These features are not
37
+ available for self-managed deployments.
38
38
39
39
This page describes how to create the appropriate indexes for each type
40
40
of search and provides examples of how to use the {+odm-short+} to
@@ -71,7 +71,8 @@ builder method and as an Eloquent model method. You can use the
71
71
collections.
72
72
73
73
You must pass an ``operator`` parameter to the ``search()`` method that
74
- is an instance of ``SearchOperatorInterface`` or an array. You can
74
+ is an instance of ``SearchOperatorInterface`` or an array that contains
75
+ the operator type, field name, and query value. You can
75
76
create an instance of ``SearchOperatorInterface`` by calling the
76
77
``Search::text()`` method and passing the field you are
77
78
querying and your search term or phrase.
@@ -83,8 +84,8 @@ create a ``SearchOperatorInterface`` instance:
83
84
84
85
use MongoDB\Builder\Search;
85
86
86
- The following code uses the index created in the preceding
87
- :ref:`laravel-as-index` section to perform an Atlas Search query on the
87
+ The following code performs an Atlas Search query that searches for the
88
+ term ``'dream'`` in the ``title`` field values of documents in the
88
89
``movies`` collection:
89
90
90
91
.. io-code-block::
@@ -113,16 +114,41 @@ You can use the ``search()`` method to perform many types of Atlas
113
114
Search queries. Depending on your desired query, you can pass the
114
115
following optional parameters to ``search()``:
115
116
116
- - ``index``: ``string``
117
- - ``highlight``: ``array``
118
- - ``concurrent``: ``bool``
119
- - ``count``: ``string``
120
- - ``searchAfter``: ``string``
121
- - ``searchBefore`` ``string``
122
- - ``scoreDetails``: ``bool``
123
- - ``sort``: ``array``
124
- - ``returnStoredSource``: ``bool``
125
- - ``tracking``: ``array``
117
+ .. list-table::
118
+ :header-rows: 1
119
+
120
+ * - Parameter
121
+ - Type
122
+
123
+ * - ``index``
124
+ - ``string``
125
+
126
+ * - ``highlight``
127
+ - ``array``
128
+
129
+ * - ``concurrent``
130
+ - ``bool``
131
+
132
+ * - ``count``
133
+ - ``string``
134
+
135
+ * - ``searchAfter``
136
+ - ``string``
137
+
138
+ * - ``searchBefore``
139
+ - ``string``
140
+
141
+ * - ``scoreDetails``
142
+ - ``bool``
143
+
144
+ * - ``sort``
145
+ - ``array``
146
+
147
+ * - ``returnStoredSource``
148
+ - ``bool``
149
+
150
+ * - ``tracking``
151
+ - ``array``
126
152
127
153
To learn more about these parameters, see the :atlas:`Fields
128
154
</atlas-search/aggregation-stages/search/#fields>` section of the
@@ -170,11 +196,23 @@ string ``"jak"`` on the ``title`` field:
170
196
"Emily Calling Jake"
171
197
]
172
198
173
- You can also pass the following parameters to the ``autocomplete()``
199
+ You can also pass the following optional parameters to the ``autocomplete()``
174
200
method to customize the query:
175
201
176
- - ``fuzzy``: ``bool`` or ``array`` (default: ``false``)
177
- - ``tokenOrder``: ``string`` (default: ``'any'``)
202
+ .. list-table::
203
+ :header-rows: 1
204
+
205
+ * - Parameter
206
+ - Type
207
+ - Default Value
208
+
209
+ * - ``fuzzy``
210
+ - ``bool`` or ``array``
211
+ - ``false``
212
+
213
+ * - ``tokenOrder``
214
+ - ``string``
215
+ - ``'any'``
178
216
179
217
To learn more about these parameters, see the :atlas:`Options
180
218
</atlas-search/autocomplete/#options>` section of the
@@ -208,12 +246,30 @@ on documents in your collections.
208
246
209
247
You must pass the following parameters to the ``vectorSearch()`` method:
210
248
211
- - ``index``: Name of the vector search index (type: ``string``)
212
- - ``path``: Field that stores vector embeddings (type: ``array`` or ``string``)
213
- - ``queryVector``: Vector representation of your query (type: ``array``)
214
- - ``limit``: Number of results to return (type: ``int``)
215
-
216
- The following code uses the index created in the preceding
249
+ .. list-table::
250
+ :header-rows: 1
251
+
252
+ * - Parameter
253
+ - Type
254
+ - Description
255
+
256
+ * - ``index``
257
+ - ``string``
258
+ - Name of the vector search index
259
+
260
+ * - ``path``
261
+ - ``array`` or ``string``
262
+ - Field that stores vector embeddings
263
+
264
+ * - ``queryVector``
265
+ - ``array``
266
+ - Vector representation of your query
267
+
268
+ * - ``limit``
269
+ - ``int``
270
+ - Number of results to return
271
+
272
+ The following code uses the ``vector`` index created in the preceding
217
273
:ref:`laravel-avs-index` section to perform an Atlas Vector Search query on the
218
274
``movies`` collection:
219
275
@@ -248,11 +304,26 @@ You can use the ``vector()`` method to perform many types of Atlas
248
304
Search queries. Depending on your desired query, you can pass the
249
305
following optional parameters to ``search()``:
250
306
251
- - ``exact``: ``bool`` (default: ``false``)
252
- - ``filter``: ``QueryInterface`` or ``array`` (default: no filtering)
253
- - ``numCandidates``: ``int`` or ``null`` (default: ``null``)
307
+ .. list-table::
308
+ :header-rows: 1
309
+
310
+ * - Parameter
311
+ - Type
312
+ - Default Value
254
313
255
- .. tip::
314
+ * - ``exact``
315
+ - ``bool``
316
+ - ``false``
317
+
318
+ * - ``filter``
319
+ - ``QueryInterface`` or ``array``
320
+ - no filtering
321
+
322
+ * - ``numCandidates``
323
+ - ``int`` or ``null``
324
+ - ``null``
325
+
326
+ .. note::
256
327
257
328
To construct a ``QueryInterface`` instance, you must import the
258
329
``MongoDB\Builder\Query`` class into your application.
0 commit comments