From cd83e76df3b0c076b289ca0e5115a7407d6f3a85 Mon Sep 17 00:00:00 2001 From: 8ga Date: Mon, 2 Mar 2026 13:32:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=E9=83=A8=E7=BD=B2PostGIS.?= =?UTF-8?q?md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 部署PostGIS.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/部署PostGIS.md b/部署PostGIS.md index 61db95c..1486a05 100644 --- a/部署PostGIS.md +++ b/部署PostGIS.md @@ -58,4 +58,58 @@ services: # PGADMIN_SERVER_CERT_FILE: /certs/server.cert # PGADMIN_SERVER_KEY_FILE: /certs/server.key # restart: on-failure:3 +``` + +## 添加全文索引支持 + +需要从 git 克隆 zhparser 添加中文分词支持,执行 docker build 命令的目录结构长这样: + +- Dockerfile +- zhparser/ + +```bash +git clone https://github.com/amutu/zhparser.git +``` + +```bash +FROM postgis/postgis:16-master + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install -y \ + build-essential \ + git \ + libcurl4-openssl-dev \ + libxml2-dev \ + wget \ + postgresql-server-dev-16 \ + && rm -rf /var/lib/apt/lists/* + +RUN pg_config --version + +WORKDIR /tmp + +RUN wget http://www.xunsearch.com/scws/down/scws-1.2.3.tar.bz2 \ + && tar xjf scws-1.2.3.tar.bz2 \ + && cd scws-1.2.3 \ + && ./configure \ + && make && make install \ + && cd .. + +COPY zhparser zhparser + +RUN cd zhparser \ + && export PG_CONFIG=$(which pg_config) \ + && echo "Using pg_config: $PG_CONFIG" \ + && make USE_PGXS=1 \ + && make USE_PGXS=1 install \ + && cd .. + +RUN rm -rf /tmp/* + +WORKDIR / +``` + +```bash +docker build -t pgsql-gis-fts . ``` \ No newline at end of file