Skip to content

Feat: basic implementation for search for auto-completion api - #112

Merged
guacamole merged 2 commits into
masterfrom
search-with-autocomplete
Mar 5, 2022
Merged

Feat: basic implementation for search for auto-completion api#112
guacamole merged 2 commits into
masterfrom
search-with-autocomplete

Conversation

@guacamole

Copy link
Copy Markdown
Member
  • This is the most basic implementation for auto-complete api
  • We are using index with text_pattern_ops
  • Optimisations to come as we test and integrate it with frontend

@guacamole
guacamole requested a review from jay-dee7 March 5, 2022 05:05
@guacamole guacamole self-assigned this Mar 5, 2022
@jay-dee7 jay-dee7 added enhancement New feature or request P1 P1 label is used for this that we see of highest priority. Critical bugs, security issues, etc labels Mar 5, 2022
@jay-dee7
jay-dee7 requested a review from Sanyambansal76 March 5, 2022 05:10
Comment thread registry/v2/registry.go
}

func (r *registry) GetImageNamespace(ctx echo.Context) error {
searchQuery := ctx.QueryParam("search_query")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guacamole can we check for emptiness here?

Comment thread router/router.go Outdated

// GET /v2/_catalog
group.Add(http.MethodGet, Catalog, reg.Catalog)
group.Add(http.MethodGet, "/search", reg.GetImageNamespace)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets put this in a const like we did with Catalog and the path can be /v2/catalog/search

Comment thread router/router.go
@@ -114,4 +114,6 @@ func Docker(group *echo.Group, reg registry.Registry) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also worth noting that the Function here called Docker can totally be called Extensions

Comment thread store/postgres/container_image.go Outdated
defer cancel()
rows, err := p.conn.Query(childCtx, queries.GetImageNamespace, "%"+search+"%")
if err != nil {
return nil, err

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrap this error with a little description

Comment thread store/postgres/container_image.go Outdated
for rows.Next() {
var ns string
if err := rows.Scan(&ns); err != nil {
return nil, err

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also this one

@jay-dee7
jay-dee7 removed the request for review from Sanyambansal76 March 5, 2022 06:03

@jay-dee7 jay-dee7 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🥇 🥇 🥇

@guacamole
guacamole merged commit 12f3ba4 into master Mar 5, 2022
@jay-dee7
jay-dee7 deleted the search-with-autocomplete branch March 30, 2022 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request P1 P1 label is used for this that we see of highest priority. Critical bugs, security issues, etc

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants