From eb48b2abecf980af81a3340de59beddeb16ab11e Mon Sep 17 00:00:00 2001 From: Wessie Date: Mon, 23 Dec 2024 00:57:28 +0100 Subject: [PATCH] search/bleve: write a custom tokenizer and query creator the tokenizer is in essence a basic whitespace tokenizer but also splitting on known japanese boundaries by using kagome the query creator is a simple match query but using the correct analyzer this time around (the same as the index creation). the analyzer has been changed to use the new tokenizer and not use shingles anymore. the ngram filter has been changed to not include the original term anymore. some specific handling for cjk has also been removed and instead leans on the new tokenizer and ngram filter (with the removal of the shingles this works reasonably well (so far)) --- go.mod | 12 +-- go.sum | 76 ++----------- search/bleve/analyzer.go | 212 ++++++++++++++++++++++++++++++------- search/bleve/index.go | 167 ++++++----------------------- search/bleve/main_linux.go | 2 +- search/bleve/query.go | 143 +++++++++++++++++++++++++ search/bleve/server.go | 12 +-- 7 files changed, 371 insertions(+), 253 deletions(-) create mode 100644 search/bleve/query.go diff --git a/go.mod b/go.mod index c6d0cc0..a93118d 100644 --- a/go.mod +++ b/go.mod @@ -13,11 +13,10 @@ require ( github.com/Wessie/fdstore v1.2.3 github.com/XSAM/otelsql v0.36.0 github.com/adtac/go-akismet v0.0.0-20181220032308-0ca9e1023047 - github.com/agoda-com/opentelemetry-go/otelzerolog v0.0.1 - github.com/agoda-com/opentelemetry-logs-go v0.5.1 github.com/alevinval/sse v1.0.2 github.com/alexedwards/scs/v2 v2.8.0 github.com/blevesearch/bleve/v2 v2.4.4 + github.com/blevesearch/bleve_index_api v1.2.0 github.com/cenkalti/backoff v2.2.1+incompatible github.com/cenkalti/backoff/v4 v4.3.0 github.com/davecgh/go-spew v1.1.1 @@ -26,6 +25,8 @@ require ( github.com/golang-migrate/migrate/v4 v4.18.1 github.com/google/subcommands v1.2.0 github.com/gorilla/csrf v1.7.2 + github.com/ikawaha/kagome-dict/ipa v1.2.0 + github.com/ikawaha/kagome/v2 v2.10.0 github.com/jmoiron/sqlx v1.4.0 github.com/justincormack/go-memfd v0.0.0-20170219213707-6e4af0518993 github.com/jxskiss/base62 v1.1.0 @@ -56,7 +57,6 @@ require ( go.opentelemetry.io/otel/trace v1.33.0 golang.org/x/crypto v0.31.0 golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 - golang.org/x/term v0.27.0 golang.org/x/text v0.21.0 golang.org/x/tools v0.28.0 google.golang.org/grpc v1.69.2 @@ -65,14 +65,13 @@ require ( require ( dario.cat/mergo v1.0.1 // indirect filippo.io/edwards25519 v1.1.0 // indirect + github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/Microsoft/hcsshim v0.12.9 // indirect github.com/RoaringBitmap/roaring v1.9.4 // indirect github.com/andybalholm/brotli v1.1.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.20.0 // indirect - github.com/blevesearch/bleve_index_api v1.2.0 // indirect github.com/blevesearch/geo v0.1.20 // indirect github.com/blevesearch/go-faiss v1.0.24 // indirect github.com/blevesearch/go-porterstemmer v1.0.3 // indirect @@ -90,7 +89,6 @@ require ( github.com/blevesearch/zapx/v15 v15.3.17 // indirect github.com/blevesearch/zapx/v16 v16.1.10 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/containerd/containerd v1.7.24 // indirect github.com/containerd/log v0.1.0 // indirect github.com/containerd/platforms v0.2.1 // indirect github.com/cpuguy83/dockercfg v0.3.2 // indirect @@ -109,6 +107,7 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/gorilla/securecookie v1.1.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1 // indirect + github.com/ikawaha/kagome-dict v1.1.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 // indirect github.com/magiconair/properties v1.8.9 // indirect @@ -143,6 +142,7 @@ require ( go.etcd.io/bbolt v1.3.11 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 // indirect go.opentelemetry.io/otel/metric v1.33.0 // indirect go.opentelemetry.io/proto/otlp v1.4.0 // indirect golang.org/x/net v0.33.0 // indirect diff --git a/go.sum b/go.sum index 715f01d..154dfd5 100644 --- a/go.sum +++ b/go.sum @@ -36,8 +36,6 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= -dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= @@ -57,26 +55,16 @@ github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7Oputl github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= -github.com/Microsoft/hcsshim v0.12.2 h1:AcXy+yfRvrx20g9v7qYaJv5Rh+8GaHOS6b8G6Wx/nKs= -github.com/Microsoft/hcsshim v0.12.2/go.mod h1:RZV12pcHCXQ42XnlQ3pz6FZfmrC1C+R4gaOHhRNML1g= -github.com/Microsoft/hcsshim v0.12.9 h1:2zJy5KA+l0loz1HzEGqyNnjd3fyZA31ZBCGKacp6lLg= -github.com/Microsoft/hcsshim v0.12.9/go.mod h1:fJ0gkFAna6ukt0bLdKB8djt4XIJhF/vEPuoIWYVvZ8Y= github.com/RoaringBitmap/roaring v1.9.4 h1:yhEIoH4YezLYT04s1nHehNO64EKFTop/wBhxv2QzDdQ= github.com/RoaringBitmap/roaring v1.9.4/go.mod h1:6AXUsoIEzDTFFQCe1RbGA6uFONMhvejWj5rqITANK90= github.com/Wessie/csrf v0.0.0-20240430222011-49a3bdf737c0 h1:TDczt7FoXMB3+1ZRig4wp97H3t6DiKfDGa5uGdHQg7Y= github.com/Wessie/csrf v0.0.0-20240430222011-49a3bdf737c0/go.mod h1:F1Fj3KG23WYHE6gozCmBAezKookxbIvUJT+121wTuLk= github.com/Wessie/fdstore v1.2.3 h1:C8k9C3gVpLAAPQ+lmeSKVNIrk9nlHNUmJzIfhy2fWx8= github.com/Wessie/fdstore v1.2.3/go.mod h1:frhNoClWFmyXHUy6UFrlqwsEIvoypc5K02v3EBET07g= -github.com/XSAM/otelsql v0.35.0 h1:nMdbU/XLmBIB6qZF61uDqy46E0LVA4ZgF/FCNw8Had4= -github.com/XSAM/otelsql v0.35.0/go.mod h1:wO028mnLzmBpstK8XPsoeRLl/kgt417yjAwOGDIptTc= github.com/XSAM/otelsql v0.36.0 h1:SvrlOd/Hp0ttvI9Hu0FUWtISTTDNhQYwxe8WB4J5zxo= github.com/XSAM/otelsql v0.36.0/go.mod h1:fo4M8MU+fCn/jDfu+JwTQ0n6myv4cZ+FU5VxrllIlxY= github.com/adtac/go-akismet v0.0.0-20181220032308-0ca9e1023047 h1:ZC99vhH6LlWY7bstM3JhEZl1c0a0DWZPFe7+hvRwTlc= github.com/adtac/go-akismet v0.0.0-20181220032308-0ca9e1023047/go.mod h1:DU/mtPMgEDGGfgxGATXm2Br5+F7JOClQj9nHVKZMlns= -github.com/agoda-com/opentelemetry-go/otelzerolog v0.0.1 h1:R1FRCOPXI+TefJdE3p6S10vP7R5P45dYJiSfu/xO5oE= -github.com/agoda-com/opentelemetry-go/otelzerolog v0.0.1/go.mod h1:PtATrdQ3evitYHGwOqirLvxwD1jEk1xFWkITtI1tIcI= -github.com/agoda-com/opentelemetry-logs-go v0.5.1 h1:6iQrLaY4M0glBZb/xVN559qQutK4V+HJ/mB1cbwaX3c= -github.com/agoda-com/opentelemetry-logs-go v0.5.1/go.mod h1:35B5ypjX5pkVCPJR01i6owJSYWe8cnbWLpEyHgAGD/E= github.com/alevinval/sse v1.0.2 h1:ooc08hn9B5X/u7vOMpnYDkXxIKA0y5DOw9qBVVK3YKY= github.com/alevinval/sse v1.0.2/go.mod h1:X4J1/nTNs4yKbvjXFWJB+NdF9gaYkoAC4sw9Z9h7ASk= github.com/alexedwards/scs/v2 v2.8.0 h1:h31yUYoycPuL0zt14c0gd+oqxfRwIj6SOjHdKRZxhEw= @@ -92,21 +80,15 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bits-and-blooms/bitset v1.12.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= -github.com/bits-and-blooms/bitset v1.19.1 h1:mv2yVhy96D2CuskLPXnc58oJNMs5PCWjAZuyYU0p12M= -github.com/bits-and-blooms/bitset v1.19.1/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/bits-and-blooms/bitset v1.20.0 h1:2F+rfL86jE2d/bmw7OhqUg2Sj/1rURkBn3MdfoPyRVU= github.com/bits-and-blooms/bitset v1.20.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= -github.com/blevesearch/bleve/v2 v2.4.3 h1:XDYj+1prgX84L2Cf+V3ojrOPqXxy0qxyd2uLMmeuD+4= -github.com/blevesearch/bleve/v2 v2.4.3/go.mod h1:hEPDPrbYw3vyrm5VOa36GyS4bHWuIf4Fflp7460QQXY= github.com/blevesearch/bleve/v2 v2.4.4 h1:RwwLGjUm54SwyyykbrZs4vc1qjzYic4ZnAnY9TwNl60= github.com/blevesearch/bleve/v2 v2.4.4/go.mod h1:fa2Eo6DP7JR+dMFpQe+WiZXINKSunh7WBtlDGbolKXk= github.com/blevesearch/bleve_index_api v1.2.0 h1:/DXMMWBwx/UmGKM1xDhTwDoJI5yQrG6rqRWPFcOgUVo= github.com/blevesearch/bleve_index_api v1.2.0/go.mod h1:PbcwjIcRmjhGbkS/lJCpfgVSMROV6TRubGGAODaK1W8= github.com/blevesearch/geo v0.1.20 h1:paaSpu2Ewh/tn5DKn/FB5SzvH0EWupxHEIwbCk/QPqM= github.com/blevesearch/geo v0.1.20/go.mod h1:DVG2QjwHNMFmjo+ZgzrIq2sfCh6rIHzy9d9d0B59I6w= -github.com/blevesearch/go-faiss v1.0.23 h1:Wmc5AFwDLKGl2L6mjLX1Da3vCL0EKa2uHHSorcIS1Uc= -github.com/blevesearch/go-faiss v1.0.23/go.mod h1:OMGQwOaRRYxrmeNdMrXJPvVx8gBnvE5RYrr0BahNnkk= github.com/blevesearch/go-faiss v1.0.24 h1:K79IvKjoKHdi7FdiXEsAhxpMuns0x4fM0BO93bW5jLI= github.com/blevesearch/go-faiss v1.0.24/go.mod h1:OMGQwOaRRYxrmeNdMrXJPvVx8gBnvE5RYrr0BahNnkk= github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+DdXTAn4YRcHCo= @@ -151,10 +133,6 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/containerd/containerd v1.7.14 h1:H/XLzbnGuenZEGK+v0RkwTdv2u1QFAruMe5N0GNPJwA= -github.com/containerd/containerd v1.7.14/go.mod h1:YMC9Qt5yzNqXx/fO4j/5yYVIHXSRrlB3H7sxkUTvspg= -github.com/containerd/containerd v1.7.24 h1:zxszGrGjrra1yYJW/6rhm9cJ1ZQ8rkKBR48brqsa7nA= -github.com/containerd/containerd v1.7.24/go.mod h1:7QUzfURqZWCZV7RLNEn1XjUCQLEf0bkaK4GjUaZehxw= github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= github.com/containerd/platforms v0.2.1 h1:zvwtM3rz2YHPQsF2CHYM8+KtB5dvhISiXh5ZpSBQv6A= @@ -162,8 +140,6 @@ github.com/containerd/platforms v0.2.1/go.mod h1:XHCb+2/hzowdiut9rkudds9bE5yJ7np github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/dockercfg v0.3.1 h1:/FpZ+JaygUR/lZP2NlFI2DVfrOEMAIKP5wWEJdoYe9E= -github.com/cpuguy83/dockercfg v0.3.1/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc= github.com/cpuguy83/dockercfg v0.3.2 h1:DlJTyZGBDlXqUZ2Dk2Q3xHs/FtnooJJVaad2S9GKorA= github.com/cpuguy83/dockercfg v0.3.2/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -176,8 +152,6 @@ github.com/dhui/dktest v0.4.3 h1:wquqUxAFdcUgabAVLvSCOKOlag5cIZuaOjYIBOWdsR0= github.com/dhui/dktest v0.4.3/go.mod h1:zNK8IwktWzQRm6I/l2Wjp7MakiyaFWv4G1hjmodmMTs= github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= -github.com/docker/docker v27.2.0+incompatible h1:Rk9nIVdfH3+Vz4cyI/uhbINhEZ/oLmc+CBXmH6fbNk4= -github.com/docker/docker v27.2.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v27.4.0+incompatible h1:I9z7sQ5qyzO0BfAb9IMOawRkAGxhYsidKiTMcm0DU+A= github.com/docker/docker v27.4.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= @@ -269,7 +243,6 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -301,10 +274,7 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR github.com/gopherjs/gopherjs v1.17.2/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfreZ6J5gM2i+k= github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA= github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo= -github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0 h1:TmHmbvxPmaegwhDubVz0lICL0J5Ka2vwTzhoePEXsGE= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0/go.mod h1:qztMSjm835F2bXf+5HKAPIS5qsmQDqZna/PgVt4rWtI= github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1 h1:VNqngBF40hVlDloBruUehVYC3ArSgIyScOAyMRqBxRg= github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1/go.mod h1:RBRO7fro65R6tjKzYgLAFo0t1QEXY1Dp+i/bvpRiqiQ= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= @@ -333,6 +303,12 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ikawaha/kagome-dict v1.1.0 h1:ePU16KkyonhYLo4YDf/UExmZJBhY/6C946T1SOg1TI4= +github.com/ikawaha/kagome-dict v1.1.0/go.mod h1:tcbTxQQll5voEBnJqGYt2zJuCouUL6buAOrpSxzo9Fg= +github.com/ikawaha/kagome-dict/ipa v1.2.0 h1:lgehXOf2USDkBwGPEBD9sbbOBk3WlkhZ2zejPSLjIJA= +github.com/ikawaha/kagome-dict/ipa v1.2.0/go.mod h1:LRtB3BXipG3Iu4V+KI/E1E7r9GMa79WgAH6IAW4wy6A= +github.com/ikawaha/kagome/v2 v2.10.0 h1:gObyHxSPVudvHXHQecyVAv3DohIifx9MtA8ErXlx+1g= +github.com/ikawaha/kagome/v2 v2.10.0/go.mod h1:IEyFbC0oCkMMaIvTAU3O4IrM5mK0AyWJwM41Tb4u77U= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o= github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT4JLY= @@ -367,14 +343,9 @@ github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lrstanley/girc v0.0.0-20240914071631-5c0cc76257bf h1:DptjWYSDVuCSxM++oM/NJInqiD5v+z/PI6T3/OMWJR4= github.com/lrstanley/girc v0.0.0-20240914071631-5c0cc76257bf/go.mod h1:lgrnhcF8bg/Bd5HA5DOb4Z+uGqUqGnp4skr+J2GwVgI= -github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= -github.com/lufia/plan9stats v0.0.0-20240226150601-1dcf7310316a h1:3Bm7EwfUQUvhNeKIkUct/gl9eod1TcXuj8stxvi/GoI= -github.com/lufia/plan9stats v0.0.0-20240226150601-1dcf7310316a/go.mod h1:ilwx/Dta8jXAgpFYFvSWEMwxmbWXyiUHkd5FwyKhb5k= github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 h1:7UMa6KCCMjZEMDtTVdcGu0B1GmmC7QJKiCCjyTAWQy0= github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683/go.mod h1:ilwx/Dta8jXAgpFYFvSWEMwxmbWXyiUHkd5FwyKhb5k= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= -github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= -github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/magiconair/properties v1.8.9 h1:nWcCbLq1N2v/cpNsy5WvQ37Fb+YElfq20WJ/a8RkpQM= github.com/magiconair/properties v1.8.9/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= @@ -400,12 +371,8 @@ github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3N github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= -github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc= -github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo= github.com/moby/sys/sequential v0.6.0 h1:qrx7XFUd/5DxtqcoH1h438hF5TmOvzC/lspjy7zgvCU= github.com/moby/sys/sequential v0.6.0/go.mod h1:uyv8EUTrca5PnDsdMGXhZe6CCe8U/UiTWd+lL+7b/Ko= -github.com/moby/sys/user v0.1.0 h1:WmZ93f5Ux6het5iituh9x2zAG7NFY9Aqi49jjE1PaQg= -github.com/moby/sys/user v0.1.0/go.mod h1:fKJhFOnsCN6xZ5gSfbM6zaHGgDJMrqt9/reuj4T7MmU= github.com/moby/sys/user v0.3.0 h1:9ni5DlcW5an3SvRSx4MouotOygvzaXbaSrc/wGDFWPo= github.com/moby/sys/user v0.3.0/go.mod h1:bG+tYYYJgaMtRKgEmuueC0hJEAZWwtIbZTB+85uoHjs= github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g= @@ -442,7 +409,6 @@ github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= @@ -468,8 +434,6 @@ github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWR github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/shirou/gopsutil/v3 v3.24.3 h1:eoUGJSmdfLzJ3mxIhmOAhgKEKgQkeOwKpz1NbhVnuPE= -github.com/shirou/gopsutil/v3 v3.24.3/go.mod h1:JpND7O217xa72ewWz9zN2eIIkPWsDN/3pl0H8Qt0uwg= github.com/shirou/gopsutil/v3 v3.24.5 h1:i0t8kL+kQTvpAYToeuiVk3TgDeKOFioZO3Ztz/iZ9pI= github.com/shirou/gopsutil/v3 v3.24.5/go.mod h1:bsoOS1aStSs9ErQ1WWfxllSeS1K5D+U30r2NfcubMVk= github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= @@ -498,6 +462,7 @@ github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -508,28 +473,17 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tcolgate/mp3 v0.0.0-20170426193717-e79c5a46d300 h1:XQdibLKagjdevRB6vAjVY4qbSr8rQ610YzTkWcxzxSI= github.com/tcolgate/mp3 v0.0.0-20170426193717-e79c5a46d300/go.mod h1:FNa/dfN95vAYCNFrIKRrlRo+MBLbwmR9Asa5f2ljmBI= -github.com/testcontainers/testcontainers-go v0.29.1 h1:z8kxdFlovA2y97RWx98v/TQ+tR+SXZm6p35M+xB92zk= -github.com/testcontainers/testcontainers-go v0.29.1/go.mod h1:SnKnKQav8UcgtKqjp/AD8bE1MqZm+3TDb/B8crE3XnI= github.com/testcontainers/testcontainers-go v0.34.0 h1:5fbgF0vIN5u+nD3IWabQwRybuB4GY8G2HHgCkbMzMHo= github.com/testcontainers/testcontainers-go v0.34.0/go.mod h1:6P/kMkQe8yqPHfPWNulFGdFHTD8HB2vLq/231xY2iPQ= -github.com/testcontainers/testcontainers-go/modules/mariadb v0.29.1 h1:knuFGRg2lHj6S9GqN6gzbrz7YoH2adxNhppYLtRRH7M= -github.com/testcontainers/testcontainers-go/modules/mariadb v0.29.1/go.mod h1:AfGjicjdwt9Rw+WSx4ehkuGuzBKqLvxBWwOPHiaynmw= github.com/testcontainers/testcontainers-go/modules/mariadb v0.34.0 h1:x4tWQM3rRnhnbY0rD184usZu/FBmuqiwT3aUhxF6IG8= github.com/testcontainers/testcontainers-go/modules/mariadb v0.34.0/go.mod h1:zIrkrM3wn3l1ZPjo77zLqg0YIz7w2GLhhKwJRopKCzY= -github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= -github.com/tklauser/go-sysconf v0.3.13 h1:GBUpcahXSpR2xN01jhkNAbTLRk2Yzgggk8IM08lq3r4= -github.com/tklauser/go-sysconf v0.3.13/go.mod h1:zwleP4Q4OehZHGn4CYZDipCgg9usW5IJePewFCGVEa0= github.com/tklauser/go-sysconf v0.3.14 h1:g5vzr9iPFFz24v2KZXs/pvpvh8/V9Fw6vQK5ZZb78yU= github.com/tklauser/go-sysconf v0.3.14/go.mod h1:1ym4lWMLUOhuBOPGtRcJm7tEGX4SCYNEEEtghGG/8uY= -github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= -github.com/tklauser/numcpus v0.7.0 h1:yjuerZP127QG9m5Zh/mSO4wqurYil27tHrqwRoRjpr4= -github.com/tklauser/numcpus v0.7.0/go.mod h1:bb6dMVcj8A42tSE7i32fsIUCbQNllK5iDguyOZRUzAY= github.com/tklauser/numcpus v0.9.0 h1:lmyCHtANi8aRUgkckBgoDk1nHCux3n2cgkJLXdQGPDo= github.com/tklauser/numcpus v0.9.0/go.mod h1:SN6Nq1O3VychhC1npsWostA+oW+VOQTxZrS604NSRyI= github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= @@ -624,8 +578,6 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20241215155358-4a5509556b9e h1:4qufH0hlUYs6AO6XmZC3GqfDPGSXHVXUFR6OND+iJX4= -golang.org/x/exp v0.0.0-20241215155358-4a5509556b9e/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 h1:1UoZQm6f0P/ZO0w1Ri+f+ifG/gXhegadRdwBIXEFWDo= golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= @@ -695,8 +647,6 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= -golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -780,10 +730,7 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -943,12 +890,8 @@ google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 h1:CkkIfIt50+lT6NHAVoRYEyAvQGFM7xEwXUUywFvEb3Q= -google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576/go.mod h1:1R3kvZ1dtP3+4p4d3G8uJ8rFk/fWlScl38vanWACI08= google.golang.org/genproto/googleapis/api v0.0.0-20241219192143-6b3ec007d9bb h1:B7GIB7sr443wZ/EAEl7VZjmh1V6qzkt5V+RYcUYtS1U= google.golang.org/genproto/googleapis/api v0.0.0-20241219192143-6b3ec007d9bb/go.mod h1:E5//3O5ZIG2l71Xnt+P/CYUY8Bxs8E7WMoZ9tlcMbAY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 h1:8ZmaLZE4XWrtU3MyClkYqqtl6Oegr3235h7jxsDyqCY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU= google.golang.org/genproto/googleapis/rpc v0.0.0-20241219192143-6b3ec007d9bb h1:3oy2tynMOP1QbTC0MsNNAV+Se8M2Bd0A5+x1QHyw+pI= google.golang.org/genproto/googleapis/rpc v0.0.0-20241219192143-6b3ec007d9bb/go.mod h1:lcTa1sDdWEIHMWlITnIczmw5w60CF9ffkb8Z+DVmmjA= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -971,8 +914,6 @@ google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.69.0 h1:quSiOM1GJPmPH5XtU+BCoVXcDVJJAzNcoyfC2cCjGkI= -google.golang.org/grpc v1.69.0/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4= google.golang.org/grpc v1.69.2 h1:U3S9QEtbXC0bYNvRtcoklF3xGtLViumSYxWykJS+7AU= google.golang.org/grpc v1.69.2/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -1003,9 +944,8 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY= -gotest.tools/v3 v3.5.0/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= +gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/search/bleve/analyzer.go b/search/bleve/analyzer.go index 3bf3d26..4e21ecc 100644 --- a/search/bleve/analyzer.go +++ b/search/bleve/analyzer.go @@ -3,57 +3,62 @@ package bleve import ( "bytes" "fmt" + "strings" "github.com/blevesearch/bleve/v2/analysis" - "github.com/blevesearch/bleve/v2/analysis/analyzer/web" - "github.com/blevesearch/bleve/v2/analysis/lang/cjk" "github.com/blevesearch/bleve/v2/analysis/token/lowercase" "github.com/blevesearch/bleve/v2/analysis/token/ngram" - "github.com/blevesearch/bleve/v2/analysis/token/shingle" "github.com/blevesearch/bleve/v2/analysis/token/unicodenorm" + "github.com/blevesearch/bleve/v2/analysis/token/unique" "github.com/blevesearch/bleve/v2/analysis/tokenizer/whitespace" "github.com/blevesearch/bleve/v2/registry" + "github.com/ikawaha/kagome-dict/ipa" + "github.com/ikawaha/kagome/v2/tokenizer" "github.com/robpike/nihongo" ) -func AnalyzerConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.Analyzer, error) { - tokenizer, err := cache.TokenizerNamed(web.Name) - if err != nil { - return nil, err - } +const NgramFilterMin = 2 +const NgramFilterMax = 3 - cjkWidth, err := cache.TokenFilterNamed(cjk.WidthName) - if err != nil { - return nil, err - } +var _ analysis.Analyzer = new(multiAnalyzer) - cjkFilter, err := cache.TokenFilterNamed(cjk.BigramName) - if err != nil { - return nil, err +type PrefilterFn func(in []byte) (out []byte) + +type multiAnalyzer struct { + prefilter func(in []byte) (out []byte) + analyzers []analysis.Analyzer +} + +func (ma *multiAnalyzer) Analyze(text []byte) analysis.TokenStream { + var res analysis.TokenStream + + fmt.Println(string(text)) + if ma.prefilter != nil { + new := ma.prefilter(text) + if !bytes.Equal(text, new) { + res = ma.analyze(res, new) + } } - _ = cjkFilter - toLowerFilter, err := cache.TokenFilterNamed(lowercase.Name) - if err != nil { - return nil, err + return ma.analyze(res, text) +} + +func (ma *multiAnalyzer) analyze(res analysis.TokenStream, text []byte) analysis.TokenStream { + for _, a := range ma.analyzers { + res = append(res, a.Analyze(text)...) } + return res +} - rv := analysis.DefaultAnalyzer{ - Tokenizer: tokenizer, - TokenFilters: []analysis.TokenFilter{ - cjkWidth, - shingle.NewShingleFilter(2, 4, true, " ", "_"), - FilterFn(RomajiFilter), - toLowerFilter, - cjkFilter, - unicodenorm.MustNewUnicodeNormalizeFilter(unicodenorm.NFC), - NgramFilter(2, 3), - }, +func NewMultiAnalyzer(pre PrefilterFn, a ...analysis.Analyzer) analysis.Analyzer { + return &multiAnalyzer{ + prefilter: pre, + analyzers: a, } - return &rv, nil } -func QueryAnalyzerConstructor(config map[string]any, cache *registry.Cache) (analysis.Analyzer, error) { +func AnalyzerConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.Analyzer, error) { + // construct our normal analyzer tokenizer, err := cache.TokenizerNamed(whitespace.Name) if err != nil { return nil, err @@ -64,20 +69,42 @@ func QueryAnalyzerConstructor(config map[string]any, cache *registry.Cache) (ana return nil, err } - rv := analysis.DefaultAnalyzer{ + normalizeFilter := unicodenorm.MustNewUnicodeNormalizeFilter(unicodenorm.NFC) + + normal := &analysis.DefaultAnalyzer{ Tokenizer: tokenizer, TokenFilters: []analysis.TokenFilter{ - FilterFn(RomajiFilter), toLowerFilter, + //shingle.NewShingleFilter(2, 4, true, " ", "_"), + normalizeFilter, + NgramFilter(NgramFilterMin, NgramFilterMax), }, } - return &rv, nil + // construct the japanese specific analyzer + japanese := &analysis.DefaultAnalyzer{ + Tokenizer: NewKagomeTokenizer(), + TokenFilters: []analysis.TokenFilter{ + toLowerFilter, + normalizeFilter, + FilterFn(RomajiFilter), + NgramFilter(NgramFilterMin, NgramFilterMax), + unique.NewUniqueTermFilter(), + }, + } + + _ = normal + return japanese, nil + /* + return NewMultiAnalyzer(nihongo.Romaji, + japanese, + normal, + ), nil + */ } func init() { registry.RegisterAnalyzer("radio", AnalyzerConstructor) - registry.RegisterAnalyzer("radio-query", QueryAnalyzerConstructor) } type FilterFn func(input analysis.TokenStream) analysis.TokenStream @@ -130,7 +157,7 @@ func NgramFilter(min, max int) analysis.TokenFilter { for i, tok := range input { if len(tok.Term) > max { // add the original token if it's above max - rv = append(rv, tok) + //rv = append(rv, tok) } // add the ngram tokens if this isn't a shingle if tok.Type != analysis.Shingle { @@ -141,6 +168,117 @@ func NgramFilter(min, max int) analysis.TokenFilter { }) } +type KagomeTokenizer struct { + tok *tokenizer.Tokenizer +} + +func NewKagomeTokenizer() *KagomeTokenizer { + tok, err := tokenizer.New(ipa.Dict(), tokenizer.OmitBosEos()) + if err != nil { + return nil + } + + return &KagomeTokenizer{ + tok: tok, + } +} + +func (t *KagomeTokenizer) Tokenize(input []byte) analysis.TokenStream { + if len(input) < 1 { + return nil + } + + var bytePos int + var surface []byte + var rv analysis.TokenStream + var tokenPos int + + appendToken := func(token *analysis.Token) { + rv, tokenPos = append(rv, token), tokenPos+1 + } + + for _, m := range t.tok.Analyze(string(input), tokenizer.Search) { + bytePos += len(m.Surface) // add to the running byte count + + surfaceLen := len(m.Surface) // record before we trim + m.Surface = strings.TrimSpace(m.Surface) + if len(m.Surface) == 0 && len(surface) > 0 { + // we found some whitespace, emit everything we've collected in the surface + token := &analysis.Token{ + Term: surface, + Position: tokenPos, + Start: bytePos - len(surface) - surfaceLen, + End: bytePos, + Type: analysis.AlphaNumeric, + } + + appendToken(token) + surface = nil + continue + } + + if m.Class == tokenizer.KNOWN { + // we hit something that the tokenizer knows, this probably means some + // japanese text, emit whatever is in the current surface first and then + // handle the new token + if len(surface) > 0 { + token := &analysis.Token{ + Term: surface, + Position: tokenPos, + Start: bytePos - len(surface), + End: bytePos, + Type: analysis.AlphaNumeric, + } + + appendToken(token) + surface = nil + } + + // now handle the KNOWN token + token := &analysis.Token{ + Term: []byte(m.Surface), + Position: tokenPos, + Start: bytePos - len(m.Surface), + End: bytePos, + Type: analysis.Ideographic, + } + appendToken(token) + continue + } + + surface = append(surface, m.Surface...) + } + + // end of the input, might have a strangling surface + if len(surface) > 0 { + token := &analysis.Token{ + Term: surface, + Position: tokenPos, + Start: bytePos - len(surface), + End: bytePos, + Type: analysis.AlphaNumeric, + } + + rv = append(rv, token) + } + + /* + fmt.Printf("%s -> ", string(input)) + for _, token := range rv { + fmt.Printf("[%s]", string(token.Term)) + } + fmt.Printf("\n") + */ + + /* + for _, token := range rv { + fmt.Printf("TOKEN: %v\n", token) + fmt.Println(string(input[token.Start:token.End])) + } + */ + return rv +} + /*func KagomeFilter() (FilterFn, error) { t, err := tokenizer.New(uni.Dict(), tokenizer.OmitBosEos()) if err != nil { diff --git a/search/bleve/index.go b/search/bleve/index.go index cda3382..a674639 100644 --- a/search/bleve/index.go +++ b/search/bleve/index.go @@ -2,23 +2,25 @@ package bleve import ( "context" - "fmt" "net/http" - "strings" "time" radio "github.com/R-a-dio/valkyrie" "github.com/R-a-dio/valkyrie/config" "github.com/R-a-dio/valkyrie/errors" "github.com/blevesearch/bleve/v2" + "github.com/blevesearch/bleve/v2/analysis/analyzer/keyword" "github.com/blevesearch/bleve/v2/mapping" - "github.com/blevesearch/bleve/v2/search/query" - "github.com/rs/zerolog" "github.com/vmihailenco/msgpack/v4" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" ) +const ( + indexAnalyzerName = "radio" + queryAnalyzerName = "radio-query" +) + type indexSong struct { // main fields we're searching through Title string `bleve:"title"` @@ -29,7 +31,7 @@ type indexSong struct { LastRequested time.Time `bleve:"lastrequested"` LastPlayed time.Time `bleve:"lastplayed"` // keyword fields - ID int `bleve:"id"` + ID string `bleve:"id"` Acceptor string `bleve:"acceptor"` Editor string `bleve:"editor"` // sorting fields @@ -53,7 +55,7 @@ func toIndexSong(s radio.Song) *indexSong { Tags: s.Tags, LastRequested: s.LastRequested, LastPlayed: s.LastPlayed, - ID: int(s.TrackID), + ID: s.TrackID.String(), Acceptor: s.Acceptor, Editor: s.LastEditor, Priority: s.Priority, @@ -62,11 +64,15 @@ func toIndexSong(s radio.Song) *indexSong { } } -type index struct { +type indexWrap struct { index bleve.Index } -func (b *index) SearchFromRequest(r *http.Request) (*bleve.SearchResult, error) { +func (b *indexWrap) Close() error { + return b.index.Close() +} + +func (b *indexWrap) SearchFromRequest(r *http.Request) (*bleve.SearchResult, error) { const op errors.Op = "search/bleve.SearchFromRequest" raw := r.FormValue("q") @@ -80,7 +86,7 @@ func (b *index) SearchFromRequest(r *http.Request) (*bleve.SearchResult, error) return res, nil } -func (b *index) Search(ctx context.Context, raw string, limit, offset int) (*bleve.SearchResult, error) { +func (b *indexWrap) Search(ctx context.Context, raw string, limit, offset int) (*bleve.SearchResult, error) { const op errors.Op = "search/bleve.Search" ctx, span := otel.Tracer("").Start(ctx, string(op)) defer span.End() @@ -101,7 +107,7 @@ func (b *index) Search(ctx context.Context, raw string, limit, offset int) (*ble return result, nil } -func (b *index) Index(ctx context.Context, songs []radio.Song) error { +func (b *indexWrap) Index(ctx context.Context, songs []radio.Song) error { const op errors.Op = "search/bleve.Index" ctx, span := otel.Tracer("").Start(ctx, string(op)) defer span.End() @@ -126,7 +132,7 @@ func (b *index) Index(ctx context.Context, songs []radio.Song) error { return nil } -func (b *index) Delete(ctx context.Context, tids []radio.TrackID) error { +func (b *indexWrap) Delete(ctx context.Context, tids []radio.TrackID) error { const op errors.Op = "search/bleve.Delete" ctx, span := otel.Tracer("").Start(ctx, string(op)) defer span.End() @@ -144,7 +150,7 @@ func (b *index) Delete(ctx context.Context, tids []radio.TrackID) error { func mixedTextMapping() *mapping.FieldMapping { m := bleve.NewTextFieldMapping() - m.Analyzer = "radio" + m.Analyzer = indexAnalyzerName m.Store = false m.Index = true return m @@ -157,7 +163,7 @@ func constructIndexMapping() (mapping.IndexMapping, error) { // create a mapping for our radio.Song type sm := bleve.NewDocumentStaticMapping() sm.StructTagKey = "bleve" - sm.DefaultAnalyzer = "radio-query" + sm.DefaultAnalyzer = indexAnalyzerName title := mixedTextMapping() sm.AddFieldMappingsAt("title", title) @@ -187,9 +193,11 @@ func constructIndexMapping() (mapping.IndexMapping, error) { priority.Store = false sm.AddFieldMappingsAt("priority", priority) - id := bleve.NewNumericFieldMapping() + id := bleve.NewKeywordFieldMapping() id.Index = true id.Store = false + id.IncludeTermVectors = false + id.IncludeInAll = true sm.AddFieldMappingsAt("id", id) lr := bleve.NewDateTimeFieldMapping() @@ -205,7 +213,8 @@ func constructIndexMapping() (mapping.IndexMapping, error) { data := bleve.NewTextFieldMapping() data.Index = false data.Store = true - data.Analyzer = "keyword" + data.IncludeInAll = false + data.Analyzer = keyword.Name sm.AddFieldMappingsAt("data", data) // register the song mapping @@ -219,13 +228,13 @@ func Open(ctx context.Context, cfg config.Config) (radio.SearchService, error) { return NewClient(cfg.Conf().Search.Endpoint.URL()), nil } -func NewIndex(indexPath string) (*index, error) { +func NewIndex(indexPath string) (*indexWrap, error) { const op errors.Op = "bleve.NewIndex" idx, err := bleve.Open(indexPath) if err == nil { // happy path, we have an index and opened it - return &index{idx}, nil + return &indexWrap{idx}, nil } // check if error was not-exist @@ -239,125 +248,13 @@ func NewIndex(indexPath string) (*index, error) { return nil, errors.E(op, err) } - idx, err = bleve.New(indexPath, mapping) - if err != nil { - return nil, errors.E(op, err) - } - return &index{idx}, nil -} - -func NewQuery(ctx context.Context, s string) (query.Query, error) { - const op errors.Op = "search/bleve.NewQuery" - ctx, span := otel.Tracer("").Start(ctx, string(op)) - defer span.End() - if span.IsRecording() { - span.SetAttributes(attribute.KeyValue{ - Key: "query", - Value: attribute.StringValue(s), - }) - } - - qsq := bleve.NewQueryStringQuery(s) - q, err := qsq.Parse() - if err != nil { - return nil, err - } - - bq, ok := q.(*query.BooleanQuery) - if !ok { - zerolog.Ctx(ctx).Warn().Str("type", fmt.Sprintf("%T", q)).Msg("query was not a BooleanQuery") - return q, nil - } - - dq, ok := bq.Should.(*query.DisjunctionQuery) - if !ok { - zerolog.Ctx(ctx).Warn().Str("type", fmt.Sprintf("%T", bq.Should)).Msg("query was not a DisjunctionQuery") - return q, nil - } - - // move the should (OR) into the must (AND) query set if possible - if bq.Must != nil { - cq, ok := bq.Must.(*query.ConjunctionQuery) - if !ok { - zerolog.Ctx(ctx).Warn().Str("type", fmt.Sprintf("%T", bq.Must)).Msg("query is unknown type") - return q, nil - } - cq.AddQuery(dq.Disjuncts...) + if indexPath == ":memory:" { // support memory-only index for testing purposes + idx, err = bleve.NewMemOnly(mapping) } else { - bq.Must = bleve.NewConjunctionQuery(dq.Disjuncts...) + idx, err = bleve.New(indexPath, mapping) } - - // set the original should to nil - bq.Should = nil - - // add a bit of fuzziness to queries that support it - //filterQuery(&q, AddFuzzy) - // remove wildcards that are just "match everything" - filterQuery(&q, - ChangeLoneWildcardIntoMatchAll, - RemoveRegexQuery, - // AddFuzzy, - ) - return bq, nil -} - -func filterQuery(q *query.Query, filter ...func(q *query.Query)) { - switch v := (*q).(type) { - case *query.BooleanQuery: - filterQuery(&v.Must, filter...) - filterQuery(&v.MustNot, filter...) - filterQuery(&v.Should, filter...) - case *query.ConjunctionQuery: - for i := range v.Conjuncts { - filterQuery(&v.Conjuncts[i], filter...) - } - case *query.DisjunctionQuery: - for i := range v.Disjuncts { - filterQuery(&v.Disjuncts[i], filter...) - } - case nil: - default: - for _, fn := range filter { - fn(q) - } - } -} - -func RemoveRegexQuery(q *query.Query) { - rq, ok := (*q).(*query.RegexpQuery) - if !ok { - return - } - _ = rq - // TODO: implement this - return -} - -func ChangeLoneWildcardIntoMatchAll(q *query.Query) { - wq, ok := (*q).(*query.WildcardQuery) - if !ok { - return - } - if strings.TrimSpace(wq.Wildcard) == "*" { - *q = bleve.NewMatchAllQuery() - } -} - -func AddFuzzy(q *query.Query) { - const fuzzyMin = 3 - - switch fq := (*q).(type) { - case *query.MatchQuery: - if len(fq.Match) > fuzzyMin { - fq.SetFuzziness(1) - } - case *query.FuzzyQuery: - if len(fq.Term) > fuzzyMin && fq.Fuzziness == 0 { - fq.SetFuzziness(1) - } - case *query.MatchPhraseQuery: - if len(fq.MatchPhrase) > fuzzyMin { - fq.SetFuzziness(1) - } + if err != nil { + return nil, errors.E(op, err) } + return &indexWrap{idx}, nil } diff --git a/search/bleve/main_linux.go b/search/bleve/main_linux.go index aab96ca..0e56340 100644 --- a/search/bleve/main_linux.go +++ b/search/bleve/main_linux.go @@ -66,7 +66,7 @@ func init() { search.Register("bleve", true, Open) } -func NewServer(ctx context.Context, idx *index) (*http.Server, error) { +func NewServer(ctx context.Context, idx *indexWrap) (*http.Server, error) { logger := zerolog.Ctx(ctx) r := website.NewRouter() r.Use(middleware.Recoverer) diff --git a/search/bleve/query.go b/search/bleve/query.go new file mode 100644 index 0000000..4feac73 --- /dev/null +++ b/search/bleve/query.go @@ -0,0 +1,143 @@ +package bleve + +import ( + "context" + "strings" + "unicode/utf8" + + "github.com/R-a-dio/valkyrie/errors" + "github.com/blevesearch/bleve/v2" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/query" + index "github.com/blevesearch/bleve_index_api" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" +) + +func NewQuery(ctx context.Context, query string) (*RadioQuery, error) { + + return &RadioQuery{query}, nil +} + +type RadioQuery struct { + Query string `json:"query"` +} + +func (rq *RadioQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error) { + const op errors.Op = "search/bleve.RadioQuery.Searcher" + // generate a trace span with the query so we can find "slow" queries + ctx, span := otel.Tracer("").Start(ctx, string(op)) + defer span.End() + if span.IsRecording() { + span.SetAttributes(attribute.KeyValue{ + Key: "query", + Value: attribute.StringValue(rq.Query), + }) + } + + field := m.DefaultSearchField() + analyzerName := m.AnalyzerNameForPath(field) + analyzer := m.AnalyzerNamed(analyzerName) + + // analyze our query with the default analyzer, this should be the same one as + // used for the index generation + tokens := analyzer.Analyze([]byte(rq.Query)) + if len(tokens) == 0 { + // no tokens, so we just match nothing + noneQuery := query.NewMatchNoneQuery() + return noneQuery.Searcher(ctx, i, m, options) + } + + // otherwise do some light filtering on the tokens returned, while we want these for + // the indexing operation, we don't need (or want) all of them for the query search + //should := make([]query.Query, 0, 0) + must := make([]query.Query, 0, len(tokens)) + for _, token := range tokens { + // skip shingle tokens, these will only match if they're in the exact order and exact token composition + // which is not useful for our purpose + if token.Type == analysis.Shingle { + // TODO: check if we want to add these to a disjunction query + continue + } + // skip tokens longer than our ngram filter, these won't match ever unless it's an exact match with + // what is in the index + if utf8.RuneCount(token.Term) > NgramFilterMax { + // TODO: check if we want to add these to a disjunction query + continue + } + + tq := query.NewTermQuery(string(token.Term)) + tq.SetField(field) + tq.SetBoost(1.0) + must = append(must, tq) + } + + cq := query.NewConjunctionQuery(must) + cq.SetBoost(1.0) + + //fmt.Println(query.DumpQuery(m, cq)) + return cq.Searcher(ctx, i, m, options) +} + +func filterQuery(q *query.Query, filter ...func(q *query.Query)) { + switch v := (*q).(type) { + case *query.BooleanQuery: + filterQuery(&v.Must, filter...) + filterQuery(&v.MustNot, filter...) + filterQuery(&v.Should, filter...) + case *query.ConjunctionQuery: + for i := range v.Conjuncts { + filterQuery(&v.Conjuncts[i], filter...) + } + case *query.DisjunctionQuery: + for i := range v.Disjuncts { + filterQuery(&v.Disjuncts[i], filter...) + } + case nil: + default: + for _, fn := range filter { + fn(q) + } + } +} + +func RemoveRegexQuery(q *query.Query) { + rq, ok := (*q).(*query.RegexpQuery) + if !ok { + return + } + _ = rq + // TODO: implement this + return +} + +func ChangeLoneWildcardIntoMatchAll(q *query.Query) { + wq, ok := (*q).(*query.WildcardQuery) + if !ok { + return + } + if strings.TrimSpace(wq.Wildcard) == "*" { + *q = bleve.NewMatchAllQuery() + } +} + +func AddFuzzy(q *query.Query) { + const fuzzyMin = 3 + + switch fq := (*q).(type) { + case *query.MatchQuery: + if len(fq.Match) > fuzzyMin { + fq.SetFuzziness(1) + } + case *query.FuzzyQuery: + if len(fq.Term) > fuzzyMin && fq.Fuzziness == 0 { + fq.SetFuzziness(1) + } + case *query.MatchPhraseQuery: + if len(fq.MatchPhrase) > fuzzyMin { + fq.SetFuzziness(1) + } + } +} diff --git a/search/bleve/server.go b/search/bleve/server.go index 3e7873e..93b8951 100644 --- a/search/bleve/server.go +++ b/search/bleve/server.go @@ -52,7 +52,7 @@ func zerologLoggerFunc(r *http.Request, status, size int, duration time.Duration Msg("http request") } -func DeleteHandler(idx *index) http.HandlerFunc { +func DeleteHandler(idx *indexWrap) http.HandlerFunc { const op errors.Op = "search/bleve.DeleteHandler" return func(w http.ResponseWriter, r *http.Request) { @@ -75,7 +75,7 @@ func DeleteHandler(idx *index) http.HandlerFunc { } } -func UpdateHandler(idx *index) http.HandlerFunc { +func UpdateHandler(idx *indexWrap) http.HandlerFunc { const op errors.Op = "search/bleve.UpdateHandler" return func(w http.ResponseWriter, r *http.Request) { @@ -106,7 +106,7 @@ func AsIntOrDefault(s string, def int) int { return i } -func IndexStatsHandler(idx *index) http.HandlerFunc { +func IndexStatsHandler(idx *indexWrap) http.HandlerFunc { const op errors.Op = "search/bleve.IndexStatsHandler" return func(w http.ResponseWriter, r *http.Request) { @@ -116,7 +116,7 @@ func IndexStatsHandler(idx *index) http.HandlerFunc { enc.Encode(stats) } } -func SearchHandler(idx *index) http.HandlerFunc { +func SearchHandler(idx *indexWrap) http.HandlerFunc { const op errors.Op = "search/bleve.SearchHandler" return func(w http.ResponseWriter, r *http.Request) { @@ -138,7 +138,7 @@ func SearchHandler(idx *index) http.HandlerFunc { } } -func SearchJSONHandler(idx *index) http.HandlerFunc { +func SearchJSONHandler(idx *indexWrap) http.HandlerFunc { const op errors.Op = "search/bleve.SearchJSONHandler" return func(w http.ResponseWriter, r *http.Request) { @@ -246,6 +246,6 @@ func bleveToRadio(result *bleve.SearchResult) (*radio.SearchResult, error) { return &res, nil } -func ExtendedSearchHandler(idx *index) http.HandlerFunc { +func ExtendedSearchHandler(idx *indexWrap) http.HandlerFunc { return nil }