registry image search api added#368
Conversation
Reviewer's Guide by SourceryThis pull request adds a new API for searching registry images and implements the necessary backend functionality to support it. The changes include new functions for generating autocomplete words, a search function for registry images, and updates to the GraphQL schema and resolvers. File-Level Changes
Tips
|
There was a problem hiding this comment.
Hey @nxtcoder36 - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider optimizing the
generateAutocompleteWordsfunction for large metadata sets. The current implementation concatenates all values, which could be inefficient for extensive metadata. - The
SearchRegistryImagesfunction uses a hard-coded limit of 10 results. Consider making this a parameter for more flexibility in the API.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
| return partials | ||
| } | ||
|
|
||
| func generateAutocompleteWords(meta map[string]any) string { |
There was a problem hiding this comment.
suggestion: Improve handling of metadata for autocomplete words generation
The current approach of concatenating all metadata values into a single string may lead to issues with spaces or special characters. Consider a more structured approach, possibly treating each key-value pair separately. Also, evaluate the performance implications for large metadata sets.
func generateAutocompleteWords(meta map[string]any) []string {
words := make([]string, 0, len(meta))
for key, value := range meta {
words = append(words, fmt.Sprintf("%v:%v", key, value))
}
return words
}
Summary by Sourcery
Add a new search API for registry images, enabling users to perform text-based searches on image metadata. Enhance the search functionality by generating autocomplete words from metadata, and update the database indexing to support text searches.
New Features:
Enhancements: