git: 6957a756b206 - main - textproc/redisearch20: add RediSearch, version 2.0

From: Sergey A. Osokin <osa_at_FreeBSD.org>
Date: Tue, 02 Nov 2021 01:20:08 UTC
The branch main has been updated by osa:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6957a756b2062548942509e8aa26e467c9ca4d21

commit 6957a756b2062548942509e8aa26e467c9ca4d21
Author:     Sergey A. Osokin <osa@FreeBSD.org>
AuthorDate: 2021-11-02 01:13:49 +0000
Commit:     Sergey A. Osokin <osa@FreeBSD.org>
CommitDate: 2021-11-02 01:13:49 +0000

    textproc/redisearch20: add RediSearch, version 2.0
---
 textproc/Makefile                                  |  1 +
 textproc/redisearch20/Makefile                     | 30 ++++++++++++++++++++++
 textproc/redisearch20/distinfo                     |  3 +++
 textproc/redisearch20/files/patch-src_fork__gc.c   | 21 +++++++++++++++
 .../redisearch20/files/patch-src_numeric__index.c  | 11 ++++++++
 .../redisearch20/files/patch-src_redis__index.c    | 11 ++++++++
 textproc/redisearch20/pkg-descr                    | 12 +++++++++
 7 files changed, 89 insertions(+)

diff --git a/textproc/Makefile b/textproc/Makefile
index abd0a577d6f6..5ade647b92cb 100644
--- a/textproc/Makefile
+++ b/textproc/Makefile
@@ -1540,6 +1540,7 @@
     SUBDIR += redet
     SUBDIR += redisearch
     SUBDIR += redisearch16
+    SUBDIR += redisearch20
     SUBDIR += redland
     SUBDIR += redland-bindings
     SUBDIR += refdb
diff --git a/textproc/redisearch20/Makefile b/textproc/redisearch20/Makefile
new file mode 100644
index 000000000000..cf79a8e75b88
--- /dev/null
+++ b/textproc/redisearch20/Makefile
@@ -0,0 +1,30 @@
+# Created by: Sergey A. Osokin <osa@FreeBSD.org>
+
+PORTNAME=	redisearch20
+DISTVERSIONPREFIX=	v
+DISTVERSION=	2.0.12
+CATEGORIES=	textproc
+
+MAINTAINER=	osa@FreeBSD.org
+COMMENT=	Full-text search over Redis
+
+LICENSE=	UNKNOWN
+LICENSE_NAME=	Redis Source Available License Agreement
+LICENSE_FILE=	${WRKSRC}/LICENSE
+LICENSE_PERMS=	dist-mirror pkg-mirror auto-accept
+
+USES=		cmake compiler
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	RediSearch
+GH_PROJECT=	RediSearch
+
+CMAKE_ARGS=	-DGIT_DESCRIBE_VERSION:STRING=${PKGVERSION}
+
+PLIST_FILES=	lib/redisearch20.so
+
+do-install:
+	${INSTALL_LIB} ${INSTALL_WRKSRC}/redisearch.so \
+		${STAGEDIR}${PREFIX}/lib/redisearch20.so
+
+.include <bsd.port.mk>
diff --git a/textproc/redisearch20/distinfo b/textproc/redisearch20/distinfo
new file mode 100644
index 000000000000..acc0f635a617
--- /dev/null
+++ b/textproc/redisearch20/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1631192711
+SHA256 (RediSearch-RediSearch-v2.0.12_GH0.tar.gz) = 1c5c8165d0a2daca3b27b353b5ae8efa4b5816113942b3a962987ae3a21a728d
+SIZE (RediSearch-RediSearch-v2.0.12_GH0.tar.gz) = 3989839
diff --git a/textproc/redisearch20/files/patch-src_fork__gc.c b/textproc/redisearch20/files/patch-src_fork__gc.c
new file mode 100644
index 000000000000..9b067f73f84d
--- /dev/null
+++ b/textproc/redisearch20/files/patch-src_fork__gc.c
@@ -0,0 +1,21 @@
+--- src/fork_gc.c.orig	2020-04-12 11:18:47 UTC
++++ src/fork_gc.c
+@@ -282,6 +282,7 @@ done:
+ }
+ 
+ static void sendHeaderString(ForkGC *gc, void *arg) {
++  struct iovec { void *iov_base; size_t iov_len; };
+   struct iovec *iov = arg;
+   FGC_sendBuffer(gc, iov->iov_base, iov->iov_len);
+ }
+@@ -298,7 +299,9 @@ static void FGC_childCollectTerms(ForkGC *gc, RedisSea
+     RedisModuleKey *idxKey = NULL;
+     InvertedIndex *idx = Redis_OpenInvertedIndexEx(sctx, term, strlen(term), 1, &idxKey);
+     if (idx) {
+-      struct iovec iov = {.iov_base = (void *)term, termLen};
++      struct iovec { void *iov_base; size_t iov_len; } iov;
++      iov.iov_base = term;
++      iov.iov_len = termLen;
+       FGC_childRepairInvidx(gc, sctx, idx, sendHeaderString, &iov, NULL);
+     }
+     if (idxKey) {
diff --git a/textproc/redisearch20/files/patch-src_numeric__index.c b/textproc/redisearch20/files/patch-src_numeric__index.c
new file mode 100644
index 000000000000..4129442c1498
--- /dev/null
+++ b/textproc/redisearch20/files/patch-src_numeric__index.c
@@ -0,0 +1,11 @@
+--- src/numeric_index.c.orig	2020-02-29 20:43:50 UTC
++++ src/numeric_index.c
+@@ -474,7 +474,7 @@ int NumericIndexType_Register(RedisModuleCtx *ctx) {
+                                .rdb_save = NumericIndexType_RdbSave,
+                                .aof_rewrite = GenericAofRewrite_DisabledHandler,
+                                .free = NumericIndexType_Free,
+-                               .mem_usage = NumericIndexType_MemUsage};
++                               .mem_usage = (const void *)NumericIndexType_MemUsage};
+ 
+   NumericIndexType = RedisModule_CreateDataType(ctx, "numericdx", NUMERIC_INDEX_ENCVER, &tm);
+   if (NumericIndexType == NULL) {
diff --git a/textproc/redisearch20/files/patch-src_redis__index.c b/textproc/redisearch20/files/patch-src_redis__index.c
new file mode 100644
index 000000000000..36e1bc262208
--- /dev/null
+++ b/textproc/redisearch20/files/patch-src_redis__index.c
@@ -0,0 +1,11 @@
+--- src/redis_index.c.orig	2020-02-29 20:35:56 UTC
++++ src/redis_index.c
+@@ -108,7 +108,7 @@ int InvertedIndex_RegisterType(RedisModuleCtx *ctx) {
+                                .rdb_load = InvertedIndex_RdbLoad,
+                                .rdb_save = InvertedIndex_RdbSave,
+                                .aof_rewrite = GenericAofRewrite_DisabledHandler,
+-                               .mem_usage = InvertedIndex_MemUsage,
++                               .mem_usage = (const void *)InvertedIndex_MemUsage,
+                                .free = InvertedIndex_Free};
+ 
+   InvertedIndexType = RedisModule_CreateDataType(ctx, "ft_invidx", INVERTED_INDEX_ENCVER, &tm);
diff --git a/textproc/redisearch20/pkg-descr b/textproc/redisearch20/pkg-descr
new file mode 100644
index 000000000000..ac2a0a714490
--- /dev/null
+++ b/textproc/redisearch20/pkg-descr
@@ -0,0 +1,12 @@
+RediSearch is a source available Full-Text and Secondary Index
+engine over Redis, developed by Redis Labs.
+
+Redisearch implements a search engine on top of Redis, but
+unlike other Redis search libraries, it does not use internal
+data structures like sorted sets.
+
+This also enables more advanced features, like exact phrase
+matching and numeric filtering for text queries, that are not
+possible or efficient with traditional Redis search approaches.
+
+WWW: https://oss.redislabs.com/redisearch/