Browse Source

提交代码。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.3.2^2
zouap 4 years ago
parent
commit
be71c637cb
5 changed files with 14 additions and 6 deletions
  1. +1
    -1
      models/dbsql/dataset_foreigntable_for_es.sql
  2. +1
    -1
      models/dbsql/issue_foreigntable_for_es.sql
  3. +1
    -1
      models/dbsql/pr_foreigntable_for_es.sql
  4. +1
    -1
      models/dbsql/user_foreigntable_for_es.sql
  5. +10
    -2
      routers/search.go

+ 1
- 1
models/dbsql/dataset_foreigntable_for_es.sql View File

@@ -20,7 +20,7 @@ OPTIONS
(
host '192.168.207.94',
port '9200',
index 'user_es-index',
index 'dataset-es-index',
rowid_column 'id',
default_sort '_id'
)


+ 1
- 1
models/dbsql/issue_foreigntable_for_es.sql View File

@@ -29,7 +29,7 @@ OPTIONS
(
host '192.168.207.94',
port '9200',
index 'user_es-index',
index 'issue-es-index',
rowid_column 'id',
default_sort '_id'
)


+ 1
- 1
models/dbsql/pr_foreigntable_for_es.sql View File

@@ -25,7 +25,7 @@ OPTIONS
(
host '192.168.207.94',
port '9200',
index 'user_es-index',
index 'pr-es-index',
rowid_column 'id',
default_sort '_id'
)


+ 1
- 1
models/dbsql/user_foreigntable_for_es.sql View File

@@ -55,7 +55,7 @@ OPTIONS
(
host '192.168.207.94',
port '9200',
index 'user_es-index',
index 'user-es-index',
rowid_column 'id',
default_sort '_id'
)


+ 10
- 2
routers/search.go View File

@@ -25,7 +25,7 @@ var host = "http://192.168.207.94:9200"

func Search(ctx *context.Context) {
TableName := ctx.Query("TableName")
//Key := ctx.Query("Key")
Key := ctx.Query("Key")
//SortBy := ctx.Query("SortBy")
//Page := ctx.QueryInt64("Page")
//PageSize := ctx.QueryInt64("PageSize")
@@ -39,6 +39,14 @@ func Search(ctx *context.Context) {
panic(err)
}

res, err := client.Search(TableName + "-es-index").Do(ctx.Req.Context())
boolQ := elastic.NewBoolQuery()

nameQuery := elastic.NewTermQuery("name", Key)
descriptionQuery := elastic.NewTermQuery("description", Key)

boolQ.Filter(nameQuery)
boolQ.Filter(descriptionQuery)

res, err := client.Search(TableName + "-es-index").Query(boolQ).Do(ctx.Req.Context())
ctx.JSON(200, res)
}

Loading…
Cancel
Save