Skip to content

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

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

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

Conversation

@guacamole
Copy link
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
}

func (r *registry) GetImageNamespace(ctx echo.Context) error {
searchQuery := ctx.QueryParam("search_query")
Copy link
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?

router/router.go Outdated

// GET /v2/_catalog
group.Add(http.MethodGet, Catalog, reg.Catalog)
group.Add(http.MethodGet, "/search", reg.GetImageNamespace)
Copy link
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

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

Copy link
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

defer cancel()
rows, err := p.conn.Query(childCtx, queries.GetImageNamespace, "%"+search+"%")
if err != nil {
return nil, err
Copy link
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

for rows.Next() {
var ns string
if err := rows.Scan(&ns); err != nil {
return nil, err
Copy link
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
Copy link
Member

@jay-dee7 jay-dee7 left a comment

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