diff --git a/src/go.mod b/src/go.mod index 9385a00..e0a544f 100644 --- a/src/go.mod +++ b/src/go.mod @@ -10,6 +10,7 @@ require ( github.com/shogo82148/go-mecab v0.0.8 github.com/traPtitech/go-traq v0.0.0-20240725071454-97c7b85dc879 github.com/traPtitech/traq-ws-bot v1.1.3 + golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 ) require ( diff --git a/src/go.sum b/src/go.sum index a899dd3..552c7de 100644 --- a/src/go.sum +++ b/src/go.sum @@ -55,8 +55,8 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -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.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= @@ -99,6 +99,8 @@ go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd h1:VtIkGDhk0ph3t+THbvXHfMZ8QHgsBO39Nh52+74pq7w= golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 h1:kx6Ds3MlpiUHKj7syVnbp57++8WpuKPcR5yjLBjvLEA= +golang.org/x/exp v0.0.0-20240823005443-9b4947da3948/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo= golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/src/handler/wikiHandler.go b/src/handler/wikiHandler.go index f4d8c9d..ac911b2 100644 --- a/src/handler/wikiHandler.go +++ b/src/handler/wikiHandler.go @@ -4,6 +4,7 @@ import ( "database/sql" "errors" "github.com/labstack/echo" + "golang.org/x/exp/slices" "log" "net/http" "quickwiki-backend/model" @@ -165,7 +166,7 @@ func WikiIdToResponse(h *Handler, c echo.Context, wikiIds []int) error { tmpSearchContent.ID = wikiId tmpSearchContent.Type = wikiContent.Type tmpSearchContent.Title = wikiContent.Name - tmpSearchContent.Abstract = firstTenChars(wikiContent.Content, 20) //Abstractを入れるべき + tmpSearchContent.Abstract = firstTenChars(wikiContent.Content, 50) //Abstractを入れるべき tmpSearchContent.CreatedAt = wikiContent.CreatedAt tmpSearchContent.UpdatedAt = wikiContent.UpdatedAt tmpSearchContent.OwnerTraqID = wikiContent.OwnerTraqID @@ -309,6 +310,7 @@ func (h *Handler) GetWikiByTagHandler(c echo.Context) error { searchResultWikiIds[i] = append(searchResultWikiIds[i], tag.WikiID) } + searchResultWikiIds[i] = slices.Compact(searchResultWikiIds[i]) } log.Println("searchResultWikiIds : ", searchResultWikiIds)