Skip to content

[Kotlin Sync] Add additional SearchOperator helper methods for the rest of the Atlas Search operators #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Apr 2, 2025
36 changes: 35 additions & 1 deletion source/aggregation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Transform Your Data with Aggregation
:values: reference

.. meta::
:keywords: code example, transform, computed, pipeline
:keywords: code example, transform, computed, pipeline, Atlas Search
:description: Learn how to use the Kotlin Sync driver to perform aggregation operations.

.. contents:: On this page
Expand Down Expand Up @@ -80,6 +80,40 @@ The following limitations apply when using aggregation operations:
</reference/operator/aggregation/graphLookup/>` stage has a strict
memory limit of 100 megabytes and ignores the ``allowDiskUse`` option.

.. _kotlin-sync-atlas-search-stage:

Pipelines Stages for Atlas Search
---------------------------------
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S: Consider moving this section after the main aggregation examples on this page. Also consider renaming this section to just Atlas Search and then creating a subsection after the paragraph called Create a Search Query or something like that?


:atlas:`Atlas Search </atlas-search>` queries take the form of an aggregation pipeline stage. Atlas
Search provides ``$search`` and ``$searchMeta`` stages, both of which must be the first
stage in any query pipeline. For more information about Atlas pipeline stages,
see the :atlas:`Choose the Aggregation Pipeline Stage
</atlas-search/query-syntax/>` page in the Atlas
manual.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S: simplify/combine sentences

Suggested change
:atlas:`Atlas Search </atlas-search>` queries take the form of an aggregation pipeline stage. Atlas
Search provides ``$search`` and ``$searchMeta`` stages, both of which must be the first
stage in any query pipeline. For more information about Atlas pipeline stages,
see the :atlas:`Choose the Aggregation Pipeline Stage
</atlas-search/query-syntax/>` page in the Atlas
manual.
You can perform an :atlas:`Atlas Search </atlas-search>` query by creating an aggregation pipeline
that contains one of the following pipeline stages:
- ``$search``
- ``$searchMeta``
For more information about Atlas pipeline stages, see the :atlas:`Choose the Aggregation Pipeline Stage
</atlas-search/query-syntax/>` page in the Atlas documentation.


.. sharedinclude:: dbx/jvm/atlas-search-operator-helpers.rst
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S: consider revising the language in the table in this shared include to have the first column header be Operator instead of operation (as this is what they are referred to in the linked atlas docs`


.. replacement:: atlas-query-operators-example
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S: in the docs-shared file - change the code description to actually reference the strings as they appear in the text. This is helpful for making sure users see the 1:1 mapping of the description to the code example
i.e
The following code creates a search stage for a pipeline with the following filters:

  • genres array field includes "drama"

etc


.. code-block:: kotlin

val searchStage: Bson = Aggregates.search(
SearchOperator.compound()
.filter(
listOf(
SearchOperator.text(fieldPath("genres"), "Drama"),
SearchOperator.phrase(fieldPath("cast"), "sylvester stallone"),
SearchOperator.numberRange(fieldPath("year")).gtLt(1980, 1989),
SearchOperator.wildcard(fieldPath("title"), "Rocky *")
)
)
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S: use a literalinclude and include output

.. replacement:: searchoperator-interface-api-docs

the `SearchOperator Interface API documentation <{+core-api+}/client/model/search/SearchOperator.html>`__
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S: correct the indentation of the replacement content


Aggregation Example
-------------------

Expand Down
4 changes: 2 additions & 2 deletions source/whats-new.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ and features:

.. replacement:: atlas-query-operators

the `SearchOperator <{+core-api+}/client/model/search/SearchOperator.html>`__
interface API documentation
the :ref:`Pipelines Stages for Atlas Search
<kotlin-sync-atlas-search-stage>` section
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
the :ref:`Pipelines Stages for Atlas Search
<kotlin-sync-atlas-search-stage>` section
the :ref:`kotlin-sync-atlas-search-stage` section of the Aggregation guide


.. _kotlin-sync-version-5.3:

Expand Down
Loading