|
| 1 | +:sectnums: |
| 2 | +:sectnumlevels: 5 |
| 3 | + |
| 4 | += PGroonga |
| 5 | + |
| 6 | +== Overview |
| 7 | +PostgreSQL has built-in full-text search functionality, but when dealing with large-scale data, complex queries, and non-English languages (especially CJK languages like Chinese, Japanese, and Korean), its functionality and performance may not meet the requirements of high-performance applications. |
| 8 | + |
| 9 | +PGroonga was created to address this need. It is a PostgreSQL extension that deeply integrates Groonga, a high-performance full-featured full-text search engine, with the PostgreSQL database. Groonga itself is an excellent open-source search engine, renowned for its extreme speed and rich functionality, particularly excelling at handling multilingual text. PGroonga's mission is to seamlessly bring Groonga's powerful capabilities into the PostgreSQL world, providing users with an experience that far exceeds native full-text search. |
| 10 | + |
| 11 | +== Installation |
| 12 | + |
| 13 | +Based on the development environment, users can choose the appropriate installation method for PGroonga from the https://pgroonga.github.io/install[PGroonga Installation] page. |
| 14 | + |
| 15 | +[NOTE] |
| 16 | +PGroonga plugin is already integrated in the IvorySQL installation package. If you use the installation package to install IvorySQL, you typically do not need to manually install PGroonga and can use it directly. |
| 17 | + |
| 18 | +=== Source Installation |
| 19 | +In addition to the installation methods provided by the PGroonga community, the IvorySQL community also provides source installation methods. The source installation environment is Ubuntu 24.04 (x86_64). |
| 20 | + |
| 21 | +[TIP] |
| 22 | +IvorySQL 4.6 or higher version is already installed in the environment, with the installation path at /usr/local/ivorysql/ivorysql-4 |
| 23 | + |
| 24 | +==== Install groonga |
| 25 | + |
| 26 | +** Install dependency kytea |
| 27 | +``` |
| 28 | +git clone https://github.com/neubig/kytea.git |
| 29 | +autoreconf -i |
| 30 | +./configure |
| 31 | +make |
| 32 | +sudo make install |
| 33 | +``` |
| 34 | + |
| 35 | +** Install dependency libzmq |
| 36 | +``` |
| 37 | +Download zeromq-4.3.5.tar.gz from https://github.com/zeromq/libzmq/releases/tag/v4.3.5 |
| 38 | +tar xvf zeromq-4.3.5.tar.gz |
| 39 | +cd zeromq-4.3.5/ |
| 40 | +./configure |
| 41 | +make |
| 42 | +sudo make install |
| 43 | +``` |
| 44 | + |
| 45 | +** Download groonga package and install specified dependencies |
| 46 | +``` |
| 47 | +wget https://packages.groonga.org/source/groonga/groonga-latest.tar.gz |
| 48 | +tar xvf groonga-15.1.5.tar.gz |
| 49 | +cd groonga-15.1.5 |
| 50 | +# Run this script to install dependencies, supporting apt and dnf package managers |
| 51 | +./ setup.sh |
| 52 | +``` |
| 53 | + |
| 54 | +** Compile and install |
| 55 | +``` |
| 56 | +# -S specifies the groonga source directory, -B specifies the build directory, which is a directory outside the source directory used only for building |
| 57 | +cmake -S /home/ivorysql/groonga-15.1.5 -B /home/ivorysql/groonga_build --preset=release-maximum |
| 58 | +cmake --build /home/ivorysql/groonga_build |
| 59 | +sudo cmake --install /home/ivorysql/groonga_build |
| 60 | +# Update dynamic library cache |
| 61 | +sudo ldconfig |
| 62 | +``` |
| 63 | + |
| 64 | +** Verify groonga installation success |
| 65 | +``` |
| 66 | +$ groonga --version |
| 67 | +Groonga 15.1.5 [Linux,x86_64,utf8,match-escalation-threshold=0,nfkc,mecab,message-pack,mruby,onigmo,zlib,lz4,zstandard,epoll,apache-arrow,xxhash,blosc,bfloat16,h3,simdjson,llama.cpp] |
| 68 | +``` |
| 69 | + |
| 70 | +==== Install pgroonga |
| 71 | +``` |
| 72 | +wget https://packages.groonga.org/source/pgroonga/pgroonga-4.0.1.tar.gz |
| 73 | +tar xvf pgroonga-4.0.1.tar.gz |
| 74 | +cd pgroonga-4.0.1 |
| 75 | +``` |
| 76 | + |
| 77 | +When compiling PGroonga, there is an option: HAVE_MSGPACK=1, which is used to support WAL. Using this option requires installing msgpack-c 1.4.1 or higher. On Debian-based platforms, use the libmsgpack-dev package, and on CentOS 7, use msgpack-devel. |
| 78 | +``` |
| 79 | +# Install dependencies |
| 80 | +sudo apt install libmsgpack-dev |
| 81 | +``` |
| 82 | + |
| 83 | +Before running make, ensure that the path of the pg_config command is in the PATH environment variable. |
| 84 | +``` |
| 85 | +make HAVE_MSGPACK=1 |
| 86 | +make install |
| 87 | +``` |
| 88 | + |
| 89 | +== Create Extension and Confirm PGroonga Version |
| 90 | + |
| 91 | +Connect to the database with psql and execute the following commands: |
| 92 | +``` |
| 93 | +ivorysql=# CREATE extension pgroonga; |
| 94 | +CREATE EXTENSION |
| 95 | + |
| 96 | +ivorysql=# SELECT * FROM pg_available_extensions WHERE name = 'pgroonga'; |
| 97 | + name | default_version | installed_version | comment |
| 98 | +---------+-----------------+-------------------+------------------------------------------------------------------------------- |
| 99 | + pgroonga| 4.0.1 | 4.0.1 | Super fast and all languages supported full text search index based on Groonga |
| 100 | +(1 row) |
| 101 | +``` |
| 102 | +
|
| 103 | +== Usage |
| 104 | +For PGroonga usage, please refer to the https://pgroonga.github.io/tutorial[PGroonga Official Documentation] |
0 commit comments