code: def test_arrindex_dollar(client):
      client.json().set(
          "store",
          "$",
          {
              "store": {
                  "book": [
                      {
                          "category": "reference",
                          "author": "Nigel Rees",
                          "title": "Sayings of the Century",
                          "price": 8.95,
                          "size": [10, 20, 30, 40],
                      },
                      {
                          "category": "fiction",
                          "author": "Evelyn Waugh",
                          "title": "Sword of Honour",
                          "price": 12.99,
                          "size": [50, 60, 70, 80],
                      },
                      {
                          "category": "fiction",
                          "author": "Herman Melville",
                          "title": "Moby Dick",
                          "isbn": "0-553-21311-3",
                          "price": 8.99,
                          "size": [5, 10, 20, 30],
                      },
                      {
                          "category": "fiction",
                          "author": "J. R. R. Tolkien",
                          "title": "The Lord of the Rings",
                          "isbn": "0-395-19395-8",
                          "price": 22.99,
                          "size": [5, 6, 7, 8],
                      },
                  ],
                  "bicycle": {"color": "red", "price": 19.95},
              }
          },
      )
  
      assert_resp_response(
          client,
          client.json().get(
              "store", "$.store.book[?(@.price<10)].size"
          ),
          [[10, 20, 30, 40], [5, 10, 20, 30]],
          [[[10, 20, 30, 40], [5, 10, 20, 30]]],
      )
  
      assert client.json().arrindex(
          "store", "$.store.book[?(@.price<10)].size", "20"
      ) == [-1, -1]
  
      # Test index of int scalar in multi values
      client.json().set(
          "test_num",
          ".",
          [
              {"arr": [0, 1, 3.0, 3, 2, 1, 0, 3]},
              {
                  "nested1_found": {
                      "arr": [5, 4, 3, 2, 1, 0, 1, 2, 3.0, 2, 4, 5]
                  }
              },
              {"nested2_not_found": {"arr": [2, 4, 6]}},
              {"nested3_scalar": {"arr": "3"}},
              [
                  {"nested41_not_arr": {"arr_renamed": [1, 2, 3]}},
                  {"nested42_empty_arr": {"arr": []}},
              ],
          ],
      )
  
      res = [
          [0, 1, 3.0, 3, 2, 1, 0, 3],
          [5, 4, 3, 2, 1, 0, 1, 2, 3.0, 2, 4, 5],
          [2, 4, 6],
          "3",
          [],
      ]
      assert_resp_response(
          client, client.json().get("test_num", "$..arr"), res, [res]
      )
  
      assert client.json().arrindex("test_num", "$..arr", 3) == [
          3,
          2,
          -1,
          None,
          -1,
      ]
  
      # Test index of double scalar in multi values
      assert client.json().arrindex("test_num", "$..arr", 3.0) == [
          2,
          8,
          -1,
          None,
          -1,
      ]
  
      # Test index of string scalar in multi values
      client.json().set(
          "test_string",
          ".",
          [
              {"arr": ["bazzz", "bar", 2, "baz", 2, "ba", "baz", 3]},
              {
                  "nested1_found": {
                      "arr": [
                          None,
                          "baz2",
                          "buzz",
                          2,
                          1,
                          0,
                          1,
                          "2",
                          "baz",
                          2,
                          4,
                          5,
                      ]
                  }
              },
              {"nested2_not_found": {"arr": ["baz2", 4, 6]}},
              {"nested3_scalar": {"arr": "3"}},
              [
                  {"nested41_arr": {"arr_renamed": [1, "baz", 3]}},
                  {"nested42_empty_arr": {"arr": []}},
              ],
          ],
      )
      res = [
          ["bazzz", "bar", 2, "baz", 2, "ba", "baz", 3],
          [None, "baz2", "buzz", 2, 1, 0, 1, "2", "baz", 2, 4, 5],
          ["baz2", 4, 6],
          "3",
          [],
      ]
      assert_resp_response(
          client, client.json().get("test_string", "$..arr"), res, [res]
      )
  
      assert client.json().arrindex("test_string", "$..arr", "baz") == [
          3,
          8,
          -1,
          None,
          -1,
      ]
  
      assert client.json().arrindex(
          "test_string", "$..arr", "baz", 2
      ) == [
          3,
          8,
          -1,
          None,
          -1,
      ]
      assert client.json().arrindex(
          "test_string", "$..arr", "baz", 4
      ) == [
          6,
          8,
          -1,
          None,
          -1,
      ]
      assert client.json().arrindex(
          "test_string", "$..arr", "baz", -5
      ) == [
          3,
          8,
          -1,
          None,
          -1,
      ]
      assert client.json().arrindex(
          "test_string", "$..arr", "baz", 4, 7
      ) == [
          6,
          -1,
          -1,
          None,
          -1,
      ]
      assert client.json().arrindex(
          "test_string", "$..arr", "baz", 4, -1
      ) == [
          6,
          8,
          -1,
          None,
          -1,
      ]
      assert client.json().arrindex(
          "test_string", "$..arr", "baz", 4, 0
      ) == [
          6,
          8,
          -1,
          None,
          -1,
      ]
      assert client.json().arrindex(
          "test_string", "$..arr", "5", 7, -1
      ) == [
          -1,
          -1,
          -1,
          None,
          -1,
      ]
      assert client.json().arrindex(
          "test_string", "$..arr", "5", 7, 0
      ) == [
          -1,
          -1,
          -1,
          None,
          -1,
      ]
  
      # Test index of None scalar in multi values
      client.json().set(
          "test_None",
          ".",
          [
              {"arr": ["bazzz", "None", 2, None, 2, "ba", "baz", 3]},
              {
                  "nested1_found": {
                      "arr": [
                          "zaz",
                          "baz2",
                          "buzz",
                          2,
                          1,
                          0,
                          1,
                          "2",
                          None,
                          2,
                          4,
                          5,
                      ]
                  }
              },
              {"nested2_not_found": {"arr": ["None", 4, 6]}},
              {"nested3_scalar": {"arr": None}},
              [
                  {"nested41_arr": {"arr_renamed": [1, None, 3]}},
                  {"nested42_empty_arr": {"arr": []}},
              ],
          ],
      )
      res = [
          ["bazzz", "None", 2, None, 2, "ba", "baz", 3],
          ["zaz", "baz2", "buzz", 2, 1, 0, 1, "2", None, 2, 4, 5],
          ["None", 4, 6],
          None,
          [],
      ]
      assert_resp_response(
          client, client.json().get("test_None", "$..arr"), res, [res]
      )
  
      # Test with none-scalar value
      assert client.json().arrindex(
          "test_None", "$..nested42_empty_arr.arr", {"arr": []}
      ) == [-1]
  
      # Test legacy (path begins with dot)
      # Test index of int scalar in single value
      assert client.json().arrindex("test_num", ".[0].arr", 3) == 3
      assert client.json().arrindex("test_num", ".[0].arr", 9) == -1
  
      with pytest.raises(exceptions.ResponseError):
          client.json().arrindex("test_num", ".[0].arr_not", 3)
      # Test index of string scalar in single value
      assert (
          client.json().arrindex("test_string", ".[0].arr", "baz") == 3
      )
      assert (
          client.json().arrindex("test_string", ".[0].arr", "faz") == -1
      )
      # Test index of None scalar in single value
      assert (
          client.json().arrindex("test_None", ".[0].arr", "None") == 1
      )
      assert (
          client.json().arrindex(
              "test_None", "..nested2_not_found.arr", "None"
          )
          == 0
      )
  
imports: import pytest
  import redis
  from redis import Redis, exceptions
  from redis.commands.json.decoders import decode_list, unstring
  from redis.commands.json.path import Path
  from .conftest import _get_client, assert_resp_response, skip_ifmodversion_lt
label_desc: Use image node_id 46 for calling a global function with example usage: test_arrindex_dollar(client) without return types