Skip to content

Commit 8570f09

Browse files
committed
LM PR fixes 1
1 parent 11b3c9e commit 8570f09

File tree

2 files changed

+103
-31
lines changed

2 files changed

+103
-31
lines changed

docs/fundamentals/as-avs.txt

Lines changed: 100 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Atlas Search & Vector Search
99
:values: reference
1010

1111
.. meta::
12-
:keywords: code example, semantic, embeddings
12+
:keywords: code example, semantic, embeddings, text
1313

1414
.. contents:: On this page
1515
:local:
@@ -33,8 +33,8 @@ documentation:
3333
.. note:: Deployment Compatibility
3434

3535
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.
3838

3939
This page describes how to create the appropriate indexes for each type
4040
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
7171
collections.
7272

7373
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
7576
create an instance of ``SearchOperatorInterface`` by calling the
7677
``Search::text()`` method and passing the field you are
7778
querying and your search term or phrase.
@@ -83,8 +84,8 @@ create a ``SearchOperatorInterface`` instance:
8384

8485
use MongoDB\Builder\Search;
8586

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
8889
``movies`` collection:
8990

9091
.. io-code-block::
@@ -113,16 +114,41 @@ You can use the ``search()`` method to perform many types of Atlas
113114
Search queries. Depending on your desired query, you can pass the
114115
following optional parameters to ``search()``:
115116

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``
126152

127153
To learn more about these parameters, see the :atlas:`Fields
128154
</atlas-search/aggregation-stages/search/#fields>` section of the
@@ -170,11 +196,23 @@ string ``"jak"`` on the ``title`` field:
170196
"Emily Calling Jake"
171197
]
172198

173-
You can also pass the following parameters to the ``autocomplete()``
199+
You can also pass the following optional parameters to the ``autocomplete()``
174200
method to customize the query:
175201

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'``
178216

179217
To learn more about these parameters, see the :atlas:`Options
180218
</atlas-search/autocomplete/#options>` section of the
@@ -208,12 +246,30 @@ on documents in your collections.
208246

209247
You must pass the following parameters to the ``vectorSearch()`` method:
210248

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
217273
:ref:`laravel-avs-index` section to perform an Atlas Vector Search query on the
218274
``movies`` collection:
219275

@@ -248,11 +304,26 @@ You can use the ``vector()`` method to perform many types of Atlas
248304
Search queries. Depending on your desired query, you can pass the
249305
following optional parameters to ``search()``:
250306

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
254313

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::
256327

257328
To construct a ``QueryInterface`` instance, you must import the
258329
``MongoDB\Builder\Query`` class into your application.

docs/includes/fundamentals/as-avs/AtlasSearchTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ protected function setUp(): void
8080
throw $e;
8181
}
8282

83-
// Wait for the index to be ready
83+
// Waits for the index to be ready
8484
do {
8585
$ready = true;
8686
usleep(10_000);
@@ -145,7 +145,8 @@ public function vectorSearchTest(): void
145145
$this->assertSame('C', $results->first()->title);
146146
}
147147

148-
/** Generate random vectors using fixed seed to make tests deterministic */
148+
/** Generates random vectors using fixed seed to make tests
149+
* deterministic */
149150
private function addVector(array $items): array
150151
{
151152
srand(1);

0 commit comments

Comments
 (0)