Skip to content

Index options API #3562

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 1 commit into from
Jul 13, 2023
Merged

Index options API #3562

merged 1 commit into from
Jul 13, 2023

Conversation

andreyaksenov
Copy link
Contributor

@andreyaksenov andreyaksenov commented Jul 5, 2023

The #3227 issue is fixed as a part of index docs refactoring. The next steps of improving docs for indexes are described in this issue: #3572.

Here are the changes directly related to #3227:

Fixes related to feedback issues for index docs:

Changes related to index docs refactoring:

---
- ['Gamma!', 55, 'This is the third tuple!']
...
Below are few examples of using ``min``.
Copy link
Member

Choose a reason for hiding this comment

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

max?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, thanks!

@andreyaksenov andreyaksenov force-pushed the index-options branch 2 times, most recently from 5934251 to d4aa371 Compare July 11, 2023 14:28
@andreyaksenov andreyaksenov requested a review from p7nov July 12, 2023 08:14
Copy link
Contributor

@p7nov p7nov left a comment

Choose a reason for hiding this comment

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

That's an impressive work!

Some minor edits and suggestions from my side.
Although, I couldn't make myself actually check all 100500 links you've changed on different pages.

@@ -188,31 +188,43 @@ Example: ``nil``.

.. _index-box_boolean:

**boolean**. A boolean is either ``true`` or ``false``.
**boolean**
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe convert all bold type names to headings? This will be a better semantic markup.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree, will do

@@ -64,99 +64,58 @@ Index operations
Index operations are automatic: if a data manipulation request changes a tuple,
then it also changes the index keys defined for the tuple.

#. Let's create a sample space named ``tester`` and
put it in a variable ``my_space``:
#. Let's create a sample space named ``bands``:
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
#. Let's create a sample space named ``bands``:
#. Create a sample space named ``bands``:

Nit: for consistency, let's use direct second person instructions in all new content.

.. literalinclude:: /code_snippets/test/indexes/index_select_test.lua
:language: lua
:lines: 40
:dedent:

**There are the following SELECT variations:**
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
**There are the following SELECT variations:**
There are the following SELECT variations:

.. literalinclude:: /code_snippets/test/indexes/index_select_test.lua
:language: lua
:lines: 98-106
:dedent:

The :ref:`comparison operators <box_index-iterator-types>` are:
Copy link
Contributor

Choose a reason for hiding this comment

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

Pls fix the punctuation in the list below.

.. code-block:: tarantoolsession

tarantool> my_space = box.schema.space.create('tester')
.. literalinclude:: /code_snippets/test/indexes/index_select_test.lua
Copy link
Contributor

Choose a reason for hiding this comment

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

Code reuse on this page is really awesome 👍

Comment on lines 9 to 11
(1) Create a Lua function.
(2) Add the function name to a predefined global variable, which has the ``table`` type.
(3) Call the function on the ``index_object``: ``index_object:function-name([parameters])``.
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
(1) Create a Lua function.
(2) Add the function name to a predefined global variable, which has the ``table`` type.
(3) Call the function on the ``index_object``: ``index_object:function-name([parameters])``.
1. Create a Lua function.
2. Add the function name to a predefined global variable, which has the ``table`` type.
3. Call the function on the ``index_object``: ``index_object:function-name([parameters])``.

Convert to the usual list formatting.

Copy link
Contributor

Choose a reason for hiding this comment

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

Step 2: maybe naviagate reader to the functions list below or move the list inside this procedure?


There are three predefined global variables:
Alternatively, user-defined functions can be made available for only one index,
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
Alternatively, user-defined functions can be made available for only one index,
Alternatively, you can make a user-defined function available for only one index

Simplify the sentence a bit and fix punctuation

Alternatively, user-defined methods can be made available for only one index,
by calling ``getmetatable(index_object)`` and then adding the function name to the
meta table.
**Example 1:**
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add text descriptions?


.. method:: user_defined()
(1) Create a Lua function.
(2) Add the function name to a predefined global variable, which has the ``table`` type.
Copy link
Contributor

Choose a reason for hiding this comment

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

The structure looks awkward with only one "predefined global variable" below.
Also, please fix the step number formatting.

@@ -1070,7 +1070,7 @@ msgstr ""
"box.space.tester:create_index('i',{parts={{field = 1, type = 'string'}}})"

msgid ""
"Make a function. The function expects a tuple. In this example it will work "
"Make a function. The function expects a tuple. In this example, it will work "
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
"Make a function. The function expects a tuple. In this example, it will work "
"Create a function. The function expects a tuple. In this example, it will work "

Same for "Make a space"

@andreyaksenov andreyaksenov force-pushed the index-options branch 3 times, most recently from b004a68 to 53ce704 Compare July 13, 2023 11:02
@andreyaksenov andreyaksenov merged commit acbc3c6 into latest Jul 13, 2023
@andreyaksenov andreyaksenov deleted the index-options branch July 13, 2023 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants