@@ -68,12 +68,12 @@ You can create an Atlas Search index in either of the following ways:
68
68
{+php-library+}, as shown in the following code:
69
69
70
70
.. code-block:: php
71
-
72
- $collection = DB::connection('mongodb')->getCollection('movies');
73
-
74
- $collection->createSearchIndex(
75
- ['mappings' => ['dynamic' => true]],
76
- ['name' => 'search_index']
71
+
72
+ $collection = DB::connection('mongodb')->getCollection('movies');
73
+
74
+ $collection->createSearchIndex(
75
+ ['mappings' => ['dynamic' => true]],
76
+ ['name' => 'search_index']
77
77
);
78
78
79
79
Perform Queries
@@ -111,23 +111,23 @@ model's ``title`` field for the term ``'dream'``:
111
111
:copyable: true
112
112
113
113
.. input:: /includes/fundamentals/as-avs/AtlasSearchTest.php
114
- :language: php
115
- :dedent:
116
- :start-after: start-search-query
117
- :end-before: end-search-query
114
+ :language: php
115
+ :dedent:
116
+ :start-after: start-search-query
117
+ :end-before: end-search-query
118
118
119
119
.. output::
120
- :language: json
121
- :visible: false
122
-
123
- [
124
- { "title": "Dreaming of Jakarta",
125
- "year": 1990
126
- },
127
- { "title": "See You in My Dreams",
128
- "year": 1996
129
- }
130
- ]
120
+ :language: json
121
+ :visible: false
122
+
123
+ [
124
+ { "title": "Dreaming of Jakarta",
125
+ "year": 1990
126
+ },
127
+ { "title": "See You in My Dreams",
128
+ "year": 1996
129
+ }
130
+ ]
131
131
132
132
You can use the ``search()`` method to perform many types of Atlas
133
133
Search queries. Depending on your desired query, you can pass the
@@ -137,55 +137,55 @@ following optional parameters to ``search()``:
137
137
:header-rows: 1
138
138
139
139
* - Optional Parameter
140
- - Type
141
- - Description
140
+ - Type
141
+ - Description
142
142
143
143
* - ``index``
144
- - ``string``
145
- - Provides the name of the Atlas Search index to use
144
+ - ``string``
145
+ - Provides the name of the Atlas Search index to use
146
146
147
147
* - ``highlight``
148
- - ``array``
149
- - Specifies highlighting options for displaying search terms in their
150
- original context
148
+ - ``array``
149
+ - Specifies highlighting options for displaying search terms in their
150
+ original context
151
151
152
152
* - ``concurrent``
153
- - ``bool``
154
- - Parallelizes search query across segments on dedicated search nodes
153
+ - ``bool``
154
+ - Parallelizes search query across segments on dedicated search nodes
155
155
156
156
* - ``count``
157
- - ``string``
158
- - Specifies the count options for retrieving a count of the results
157
+ - ``string``
158
+ - Specifies the count options for retrieving a count of the results
159
159
160
160
* - ``searchAfter``
161
- - ``string``
162
- - Specifies a reference point for returning documents starting
163
- immediately following that point
161
+ - ``string``
162
+ - Specifies a reference point for returning documents starting
163
+ immediately following that point
164
164
165
165
* - ``searchBefore``
166
- - ``string``
167
- - Specifies a reference point for returning documents starting
168
- immediately preceding that point
166
+ - ``string``
167
+ - Specifies a reference point for returning documents starting
168
+ immediately preceding that point
169
169
170
170
* - ``scoreDetails``
171
- - ``bool``
172
- - Specifies whether to retrieve a detailed breakdown of the score
173
- for results
171
+ - ``bool``
172
+ - Specifies whether to retrieve a detailed breakdown of the score
173
+ for results
174
174
175
175
* - ``sort``
176
- - ``array``
177
- - Specifies the fields on which to sort the results
176
+ - ``array``
177
+ - Specifies the fields on which to sort the results
178
178
179
179
* - ``returnStoredSource``
180
- - ``bool``
181
- - Specifies whether to perform a full document lookup on the
182
- backend database or return only stored source fields directly
183
- from Atlas Search
180
+ - ``bool``
181
+ - Specifies whether to perform a full document lookup on the
182
+ backend database or return only stored source fields directly
183
+ from Atlas Search
184
184
185
185
* - ``tracking``
186
- - ``array``
187
- - Specifies the tracking option to retrieve analytics information
188
- on the search terms
186
+ - ``array``
187
+ - Specifies the tracking option to retrieve analytics information
188
+ on the search terms
189
189
190
190
To learn more about these parameters, see the :atlas:`Fields
191
191
</atlas-search/aggregation-stages/search/#fields>` section of the
@@ -218,20 +218,20 @@ string ``"jak"`` on the ``title`` field:
218
218
:copyable: true
219
219
220
220
.. input:: /includes/fundamentals/as-avs/AtlasSearchTest.php
221
- :language: php
222
- :dedent:
223
- :start-after: start-auto-query
224
- :end-before: end-auto-query
221
+ :language: php
222
+ :dedent:
223
+ :start-after: start-auto-query
224
+ :end-before: end-auto-query
225
225
226
226
.. output::
227
- :language: json
228
- :visible: false
227
+ :language: json
228
+ :visible: false
229
229
230
- [
231
- "Dreaming of Jakarta",
232
- "Jakob the Liar",
233
- "Emily Calling Jake"
234
- ]
230
+ [
231
+ "Dreaming of Jakarta",
232
+ "Jakob the Liar",
233
+ "Emily Calling Jake"
234
+ ]
235
235
236
236
You can also pass the following optional parameters to the ``autocomplete()``
237
237
method to customize the query:
@@ -240,19 +240,19 @@ method to customize the query:
240
240
:header-rows: 1
241
241
242
242
* - Optional Parameter
243
- - Type
244
- - Description
245
- - Default Value
243
+ - Type
244
+ - Description
245
+ - Default Value
246
246
247
247
* - ``fuzzy``
248
- - ``bool`` or ``array``
249
- - Enables fuzzy search and fuzzy search options
250
- - ``false``
248
+ - ``bool`` or ``array``
249
+ - Enables fuzzy search and fuzzy search options
250
+ - ``false``
251
251
252
252
* - ``tokenOrder``
253
- - ``string``
254
- - Specifies order in which to search for tokens
255
- - ``'any'``
253
+ - ``string``
254
+ - Specifies order in which to search for tokens
255
+ - ``'any'``
256
256
257
257
To learn more about these parameters, see the :atlas:`Options
258
258
</atlas-search/autocomplete/#options>` section of the
0 commit comments