Skip to content

Commit 20db6a2

Browse files
authored
Merge pull request #36 from CocaineCong/feature-922
feat: add now time
2 parents 570f3b9 + 8553911 commit 20db6a2

File tree

11 files changed

+57
-45
lines changed

11 files changed

+57
-45
lines changed

app/favorite/cmd/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
logs "github.com/CocaineCong/tangseng/pkg/logger"
1717
)
1818

19-
2019
func main() {
2120
loading.Loading()
2221
// etcd 地址

app/index_platform/cmd/main.go

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,13 @@ import (
1313
"github.com/CocaineCong/tangseng/app/index_platform/cmd/kfk_register"
1414
"github.com/CocaineCong/tangseng/app/index_platform/service"
1515
"github.com/CocaineCong/tangseng/config"
16+
"github.com/CocaineCong/tangseng/consts"
1617
"github.com/CocaineCong/tangseng/idl/pb/index_platform"
1718
"github.com/CocaineCong/tangseng/loading"
1819
"github.com/CocaineCong/tangseng/pkg/discovery"
1920
logs "github.com/CocaineCong/tangseng/pkg/logger"
2021
)
2122

22-
const (
23-
IndexPlatformServerName = "index_platform"
24-
)
25-
2623
func main() {
2724
ctx := context.Background()
2825
// 加载配置
@@ -32,18 +29,12 @@ func main() {
3229
job.RegisterJob(ctx)
3330

3431
// 注册服务
35-
_ = registerIndexPlatform()
36-
}
37-
38-
// registerIndexPlatform 注册索引平台服务
39-
func registerIndexPlatform() (err error) {
4032
etcdAddress := []string{config.Conf.Etcd.Address}
4133
etcdRegister := discovery.NewRegister(etcdAddress, logs.LogrusObj)
4234
defer etcdRegister.Stop()
43-
44-
grpcAddress := config.Conf.Services[IndexPlatformServerName].Addr[0]
35+
grpcAddress := config.Conf.Services[consts.IndexPlatformName].Addr[0]
4536
node := discovery.Server{
46-
Name: config.Conf.Domain[IndexPlatformServerName].Name,
37+
Name: config.Conf.Domain[consts.IndexPlatformName].Name,
4738
Addr: grpcAddress,
4839
}
4940
server := grpc.NewServer()
@@ -61,6 +52,4 @@ func registerIndexPlatform() (err error) {
6152
if err = server.Serve(lis); err != nil {
6253
panic(err)
6354
}
64-
65-
return
6655
}

app/index_platform/service/index_platform.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func (s *IndexPlatformSrv) BuildIndexService(ctx context.Context, req *pb.BuildI
9797
}
9898
wg.Wait()
9999

100-
// // 构建前缀树 // TODO:kafka处理
100+
// // 构建前缀树 // TODO: kafka处理
101101
// go func(tokenList []string) {
102102
// err = input_data.DocTrie2Kfk(tokenList)
103103
// if err != nil {
@@ -151,7 +151,7 @@ func (s *IndexPlatformSrv) BuildIndexService(ctx context.Context, req *pb.BuildI
151151
// storeInvertedIndexByHash 分片存储
152152
func storeInvertedIndexByHash(ctx context.Context, invertedIndex cmap.ConcurrentMap[string, *roaring.Bitmap]) (err error) {
153153
dir, _ := os.Getwd()
154-
outName := fmt.Sprintf("%s/%s.%s", dir, timeutils.GetTodayDate(), cconsts.InvertedBucket)
154+
outName := fmt.Sprintf("%s/%s.%s", dir, timeutils.GetNowTime(), cconsts.InvertedBucket)
155155
invertedDB := storage.NewInvertedDB(outName)
156156
// 找出所有的key进行存储
157157
for k, val := range invertedIndex.Items() {
@@ -193,7 +193,7 @@ func storeInvertedIndexByHash(ctx context.Context, invertedIndex cmap.Concurrent
193193
func storeDictTrieByHash(ctx context.Context, dict *trie.Trie) (err error) {
194194
// TODO: 抽离一个hash存储的方法
195195
dir, _ := os.Getwd()
196-
outName := fmt.Sprintf("%s/%s.%s", dir, timeutils.GetTodayDate(), cconsts.TrieTreeBucket)
196+
outName := fmt.Sprintf("%s/%s.%s", dir, timeutils.GetNowTime(), cconsts.TrieTreeBucket)
197197
trieDB := storage.NewTrieDB(outName)
198198
err = trieDB.StorageDict(dict)
199199
if err != nil {

app/search_vector/consts/consts.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
default some constants
33
"""
44
KAFKA_CONSUMER_VECTOR_INDEX_TOPIC = "search-engine-csv-loader-topic"
5+
6+
VECTOR_RECALL_TOPK = 20

app/search_vector/milvus/operators.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ def do_upload(table_name: str, doc_id: int, title: str, body: str,
1818
try:
1919
if not table_name:
2020
table_name = DEFAULT_MILVUS_TABLE_NAME
21-
milvus_client.create_collection(table_name)
21+
if not milvus_client.has_collection(table_name):
22+
milvus_client.create_collection(table_name)
2223
body_feat = TRANSFORMER_MODEL.encode(title + body) # word 转 vec
2324
ids = milvus_client.insert(table_name, [doc_id], [body_feat])
2425
return ids

app/search_vector/service/search_vector.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
"""search vector grpc service"""
12
import json
23
import grpc
34
import logging
45
import asyncio
56

7+
from ..consts.consts import VECTOR_RECALL_TOPK
68
from idl.pb.search_vector import search_vector_pb2
79
from ..config.config import DEFAULT_MILVUS_TABLE_NAME, VECTOR_ADDR
810
from ..milvus.operators import do_search
@@ -12,15 +14,18 @@
1214

1315

1416
class SearchVectorService(search_vector_pb2_grpc.SearchVectorServiceServicer):
17+
"""
18+
search vector service objective
19+
"""
1520

1621
def SearchVector(self, request,
1722
context) -> search_vector_pb2.SearchVectorResponse:
1823
try:
1924
queryies = request.query
2025
doc_ids = []
2126
for query in queryies:
22-
ids, distants = do_search(DEFAULT_MILVUS_TABLE_NAME, query, 1,
23-
milvus_client)
27+
ids, distants = do_search(DEFAULT_MILVUS_TABLE_NAME, query,
28+
VECTOR_RECALL_TOPK, milvus_client)
2429
print("search vector ids", ids)
2530
doc_ids += ids
2631
print("search vector data", doc_ids)
@@ -31,8 +36,6 @@ def SearchVector(self, request,
3136
except Exception as e:
3237
print("search vector error", e)
3338
return search_vector_pb2.SearchVectorResponse(code=500,
34-
doc_ids='',
35-
msg='fail',
3639
error=str(e))
3740

3841

go.mod

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ require (
2222
github.com/redis/go-redis/v9 v9.2.1
2323
github.com/robfig/cron/v3 v3.0.1
2424
github.com/samber/lo v1.38.1
25-
github.com/sirupsen/logrus v1.9.2
25+
github.com/sirupsen/logrus v1.9.3
2626
github.com/spf13/cast v1.5.0
2727
github.com/spf13/viper v1.15.0
2828
github.com/xtgo/set v1.0.0
@@ -52,6 +52,7 @@ require (
5252
github.com/eapache/go-resiliency v1.4.0 // indirect
5353
github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect
5454
github.com/eapache/queue v1.1.0 // indirect
55+
github.com/frankban/quicktest v1.14.5 // indirect
5556
github.com/fsnotify/fsnotify v1.6.0 // indirect
5657
github.com/getsentry/sentry-go v0.12.0 // indirect
5758
github.com/gin-contrib/sse v0.1.0 // indirect
@@ -89,11 +90,11 @@ require (
8990
github.com/json-iterator/go v1.1.12 // indirect
9091
github.com/klauspost/compress v1.16.7 // indirect
9192
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
92-
github.com/kr/pretty v0.3.0 // indirect
93+
github.com/kr/pretty v0.3.1 // indirect
9394
github.com/kr/text v0.2.0 // indirect
9495
github.com/leodido/go-urn v1.2.1 // indirect
9596
github.com/magiconair/properties v1.8.7 // indirect
96-
github.com/mattn/go-isatty v0.0.17 // indirect
97+
github.com/mattn/go-isatty v0.0.20 // indirect
9798
github.com/miekg/dns v1.1.27 // indirect
9899
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.1 // indirect
99100
github.com/mitchellh/mapstructure v1.5.0 // indirect
@@ -106,7 +107,7 @@ require (
106107
github.com/pierrec/lz4/v4 v4.1.18 // indirect
107108
github.com/pkg/errors v0.9.1 // indirect
108109
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
109-
github.com/rogpeppe/go-internal v1.8.1 // indirect
110+
github.com/rogpeppe/go-internal v1.9.0 // indirect
110111
github.com/smartystreets/goconvey v1.8.0 // indirect
111112
github.com/spf13/afero v1.9.3 // indirect
112113
github.com/spf13/jwalterweatherman v1.1.0 // indirect
@@ -124,10 +125,10 @@ require (
124125
go.uber.org/atomic v1.9.0 // indirect
125126
go.uber.org/multierr v1.8.0 // indirect
126127
go.uber.org/zap v1.21.0 // indirect
127-
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
128-
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect
128+
golang.org/x/arch v0.5.0 // indirect
129+
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
129130
golang.org/x/net v0.14.0 // indirect
130-
golang.org/x/sys v0.11.0 // indirect
131+
golang.org/x/sys v0.13.0 // indirect
131132
golang.org/x/text v0.12.0 // indirect
132133
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect
133134
gopkg.in/ini.v1 v1.67.0 // indirect

go.sum

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga
199199
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
200200
github.com/forestgiant/sliceutil v0.0.0-20160425183142-94783f95db6c/go.mod h1:pFdJbAhRf7rh6YYMUdIQGyzne6zYL1tCUW8QV2B3UfY=
201201
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
202-
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
202+
github.com/frankban/quicktest v1.14.5 h1:dfYrrRyLtiqT9GyKXgdh+k4inNeTvmGbuSgZ3lx3GhA=
203+
github.com/frankban/quicktest v1.14.5/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
203204
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
204205
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
205206
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
@@ -332,6 +333,7 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
332333
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
333334
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
334335
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
336+
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
335337
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
336338
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
337339
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
@@ -465,8 +467,9 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxv
465467
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
466468
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
467469
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
468-
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
469470
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
471+
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
472+
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
470473
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
471474
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
472475
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@@ -498,8 +501,8 @@ github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd
498501
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
499502
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
500503
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
501-
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
502-
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
504+
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
505+
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
503506
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
504507
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
505508
github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE=
@@ -619,8 +622,9 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So
619622
github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
620623
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
621624
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
622-
github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg=
623625
github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o=
626+
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
627+
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
624628
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
625629
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
626630
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
@@ -635,8 +639,8 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV
635639
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
636640
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
637641
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
638-
github.com/sirupsen/logrus v1.9.2 h1:oxx1eChJGI6Uks2ZC4W1zpLlVgqB8ner4EuQwV4Ik1Y=
639-
github.com/sirupsen/logrus v1.9.2/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
642+
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
643+
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
640644
github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog=
641645
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
642646
github.com/smartystreets/assertions v1.13.1 h1:Ef7KhSmjZcK6AVf9YbJdvPYG9avaF0ZxudX+ThRdWfU=
@@ -772,8 +776,9 @@ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
772776
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
773777
go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8=
774778
go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
775-
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU=
776779
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
780+
golang.org/x/arch v0.5.0 h1:jpGode6huXQxcskEIpOCvrU+tzo81b6+oFLUYXWtH/Y=
781+
golang.org/x/arch v0.5.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
777782
golang.org/x/crypto v0.0.0-20180621125126-a49355c7e3f8/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
778783
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
779784
golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
@@ -811,8 +816,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
811816
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
812817
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
813818
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
814-
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 h1:3MTrJm4PyNL9NBqvYDSj3DHl46qQakyfqfWo4jgfaEM=
815-
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE=
819+
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
820+
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
816821
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
817822
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
818823
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -978,11 +983,11 @@ golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBc
978983
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
979984
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
980985
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
981-
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
982986
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
983987
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
984-
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
985-
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
988+
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
989+
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
990+
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
986991
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
987992
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
988993
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=

main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,5 +185,5 @@ def init_model():
185185
if __name__ == "__main__":
186186
# app.run(host=WEBSITE_HOST, port=WEBSITE_PORT, debug=True)
187187
# print("start server {}:{}".format(WEBSITE_HOST, WEBSITE_PORT))
188-
# consume_inverted_index()
189-
asyncio.run(serve())
188+
# asyncio.run(serve())
189+
consume_inverted_index()

pkg/timeutils/inverted_index.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package timeutils
22

33
import (
44
"fmt"
5+
"strings"
56

67
"github.com/golang-module/carbon"
78
)
@@ -11,6 +12,12 @@ func GetTodayDate() string {
1112
return carbon.Now().ToDateString()
1213
}
1314

15+
// GetNowTime return 2023-10-01
16+
func GetNowTime() string {
17+
timeStr := strings.Split(carbon.Now().String(), " ")
18+
return fmt.Sprintf("%s-%s", timeStr[0], timeStr[1])
19+
}
20+
1421
// GetMonthDate return 2023-10
1522
func GetMonthDate() string {
1623
year := carbon.Now().Year()

0 commit comments

Comments
 (0)