{
  "schema_version": 2,
  "id": "develop/ai/search-and-query/deprecated/development",
  "title": "Developer notes",
  "url": "https://redis.io/docs/latest/develop/ai/search-and-query/deprecated/development/",
  "summary": "Notes on RediSearch debugging, testing, and documentation",
  "aliases": [
    "/develop/interact/search-and-query/deprecated/development"
  ],
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2025-06-26T15:11:30-07:00",
  "page_type": "content",
  "content_hash": "72b28a5a7f1e186f25bba7ab260181669f9046e760aa4ca05705984c21c1f005",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Developing RediSearch features involves setting up a development environment (which can be either Linux-based or macOS-based), building the module, running tests and benchmarks, and debugging both the module and its tests."
    },
    {
      "id": "cloning-the-git-repository",
      "title": "Cloning the git repository",
      "role": "content",
      "text": "Run the following command to clone the RediSearch module and its submodules:\n\n[code example]"
    },
    {
      "id": "working-in-an-isolated-environment",
      "title": "Working in an isolated environment",
      "role": "content",
      "text": "There are several reasons to develop in an isolated environment, like keeping your workstation clean, and developing for a different Linux distribution.\nThe most general option for an isolated environment is a virtual machine. It's very easy to set one up using [Vagrant](https://www.vagrantup.com)).\nDocker is even more agile, as it offers an almost instant solution:\n\n[code example]\n\nThen, from within the container, `cd /build` and go on as usual.\n\nIn this mode, all installations remain in the scope of the Docker container.\nUpon exiting the container, you can either re-invoke it with the above `docker exec` or commit the state of the container to an image and re-invoke it at a later stage:\n\n[code example]\n\nYou can replace `debian:bullseye` with your choice of OS, with the host OS being the best choice allowing you to run the RediSearch binary on your host after it is built."
    },
    {
      "id": "installing-prerequisites",
      "title": "Installing prerequisites",
      "role": "setup",
      "text": "To build and test RediSearch you need to install several packages, depending on the underlying OS. The following OSes are supported:\n- Ubuntu 18.04\n- Ubuntu 20.04\n- Ubuntu 22.04\n- Debian linux 11\n- Rocky linux 8\n- Rocky linux 9\n- Amazon linux 2\n- Mariner 2.0\n- MacOS\n\nTo install the prerequisites on your system using a setup script, first enter the `RediSearch` directory and then run:\n\n[code example]\n\nNote that this will install various packages on your system using the native package manager (`sudo` is not required in a Docker environment).\n\nIf you prefer to avoid that, you can:\n\n* Review the relevant setup scripts under the `./install` directory and install packages manually.\n* Use an isolated environment as explained above."
    },
    {
      "id": "installing-redis",
      "title": "Installing Redis",
      "role": "setup",
      "text": "As a rule of thumb, you should run the latest Redis version.\n\nIf your OS has a Redis 7.x package, you can install it using the OS package manager.\n\nOtherwise, you can build it from source and install it as described in [redis GitHub page](https://github.com/redis/redis)."
    },
    {
      "id": "getting-help",
      "title": "Getting help",
      "role": "content",
      "text": "\nmake fetch         # download and prepare dependant modules\n\nmake build          # compile and link\n  COORD=1             # build coordinator\n  DEBUG=1             # build for debugging\n  NO_TESTS=1          # disable unit tests\n  WHY=1               # explain CMake decisions (in /tmp/cmake-why)\n  FORCE=1             # Force CMake rerun (default)\n  CMAKE_ARGS=...      # extra arguments to CMake\n  VG=1                # build for Valgrind\n  SAN=type            # build with LLVM sanitizer (type=address|memory|leak|thread) \n  SLOW=1              # do not parallelize build (for diagnostics)\n  GCC=1               # build with GCC (default unless Sanitizer)\n  CLANG=1             # build with CLang\n  STATIC_LIBSTDCXX=0  # link libstdc++ dynamically (default: 1)\nmake parsers       # build parsers code (required after chaging files under query_parser dir)\nmake clean         # remove build artifacts\n  ALL=1              # remove entire artifacts directory\n\nmake run           # run redis with RediSearch\n  COORD=1            # run three local shards with coordinator (assuming the module was built with coordinator support)\n  GDB=1              # invoke using gdb\n\nmake test          # run all tests\n  COORD=1            # test coordinator\n  TEST=name          # run specified test\nmake pytest        # run python tests (tests/pytests)\n  COORD=1            # test coordinator \n  TEST=name          # e.g. TEST=test:testSearch\n  RLTEST_ARGS=...    # pass args to RLTest\n  REJSON=1|0|get     # also load JSON module (default: 1)\n  REJSON_PATH=path   # use JSON module at `path`\n  EXT=1              # External (existing) environment\n  GDB=1              # RLTest interactive debugging\n  VG=1               # use Valgrind\n  VG_LEAKS=0         # do not search leaks with Valgrind\n  SAN=type           # use LLVM sanitizer (type=address|memory|leak|thread) \nmake unit-tests    # run unit tests (C and C++)\n  TEST=name          # e.g. TEST=FGCTest.testRemoveLastBlock\nmake c_tests       # run C tests (from tests/ctests)\nmake cpp_tests     # run C++ tests (from tests/cpptests)\n\nmake callgrind     # produce a call graph\n  REDIS_ARGS=\"args\"\n\nmake sanbox        # create container with CLang Sanitizer\n```"
    },
    {
      "id": "building-from-source",
      "title": "Building from source",
      "role": "content",
      "text": "Run the following from the project root dir:\n\n[code example]make build[code example]make clean``` to remove build artifacts. ```make clean ALL=1``` will remove the entire `bin` subdirectory."
    },
    {
      "id": "diagnosing-the-build-process",
      "title": "Diagnosing the build process",
      "role": "content",
      "text": "`make build` will build in parallel by default.\n\nFor the purposes of build diagnosis, `make build SLOW=1 VERBOSE=1` can be used to examine compilation commands."
    },
    {
      "id": "running-redis-with-redisearch",
      "title": "Running Redis with RediSearch",
      "role": "content",
      "text": "The following will run \nmake run\n[code example]redis-cli``` in another terminal to interact with it."
    },
    {
      "id": "running-tests",
      "title": "Running tests",
      "role": "content",
      "text": "There are several sets of unit tests:\n* C tests, located in [code example]tests/cpptests[code example]tests/pytests[code example]make test[code example]TEST``` parameter, e.g., ```make test TEST=regex```."
    },
    {
      "id": "debugging",
      "title": "Debugging",
      "role": "content",
      "text": "To build for debugging (enabling symbolic information and disabling optimization), run [code example]make run DEBUG=1[code example]gdb[code example]BB()``` function inside a test."
    }
  ],
  "examples": [
    {
      "id": "cloning-the-git-repository-ex0",
      "language": "sh",
      "code": "git clone --recursive https://github.com/RediSearch/RediSearch.git",
      "section_id": "cloning-the-git-repository"
    },
    {
      "id": "working-in-an-isolated-environment-ex0",
      "language": "plaintext",
      "code": "search=$(docker run -d -it -v $PWD:/build debian:bullseye bash)\ndocker exec -it $search bash",
      "section_id": "working-in-an-isolated-environment"
    },
    {
      "id": "working-in-an-isolated-environment-ex1",
      "language": "plaintext",
      "code": "docker commit $search redisearch1\ndocker stop $search\nsearch=$(docker run -d -it -v $PWD:/build rediseatch1 bash)\ndocker exec -it $search bash",
      "section_id": "working-in-an-isolated-environment"
    },
    {
      "id": "installing-prerequisites-ex0",
      "language": "plaintext",
      "code": "cd ./install\n./install_script.sh sudo\n./install_boost.sh 1.83.0",
      "section_id": "installing-prerequisites"
    },
    {
      "id": "building-from-source-ex0",
      "language": "make build``` will build RediSearch.",
      "code": "`make build COORD=1` will build Redis Open Source RediSearch Coordinator.\n\n`make build STATIC=1` will build as a static library.\n\nNotes:\n\n* Binary files are placed under `bin`, according to platform and build variant.\n* RediSearch uses [CMake](https://cmake.org) as its build system.",
      "section_id": "building-from-source"
    },
    {
      "id": "building-from-source-ex1",
      "language": " will invoke both CMake and the subsequent make command that's required to complete the build.",
      "code": "Use",
      "section_id": "building-from-source"
    },
    {
      "id": "running-redis-with-redisearch-ex0",
      "language": "plaintext",
      "code": "You can open",
      "section_id": "running-redis-with-redisearch"
    },
    {
      "id": "running-tests-ex0",
      "language": "tests/ctests```, run by ```make c-tests```.",
      "code": "* C++ tests (enabled by GTest), located in",
      "section_id": "running-tests"
    },
    {
      "id": "running-tests-ex1",
      "language": ", run by ```make cpp-tests```.",
      "code": "* Python tests (enabled by RLTest), located in",
      "section_id": "running-tests"
    },
    {
      "id": "running-tests-ex2",
      "language": ", run by ```make pytest```.",
      "code": "You can run all tests by invoking",
      "section_id": "running-tests"
    },
    {
      "id": "running-tests-ex3",
      "language": ".",
      "code": "A single test can be run using the",
      "section_id": "running-tests"
    },
    {
      "id": "debugging-ex0",
      "language": "make DEBUG=1```.",
      "code": "You can then use",
      "section_id": "debugging"
    },
    {
      "id": "debugging-ex1",
      "language": " to invoke ```gdb```.",
      "code": "In addition to the usual way to set breakpoints in",
      "section_id": "debugging"
    },
    {
      "id": "debugging-ex2",
      "language": ", it is possible to use the ```BB``` macro to set a breakpoint inside the RediSearch code. It will only have an effect when running under ```gdb```.",
      "code": "Similarly, Python tests in a single-test mode, you can set a breakpoint by using the",
      "section_id": "debugging"
    }
  ]
}
