-
Notifications
You must be signed in to change notification settings - Fork 65
feat: add endpoint for fuzzy search #407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add endpoint for fuzzy search #407
Conversation
Reviewer's GuideThis PR implements a new fuzzy-search endpoint for quickstarts by leveraging PostgreSQL’s fuzzystrmatch Levenshtein function on the spec.displayName field, adds the necessary schema extension, and verifies behavior through extensive tests. Sequence diagram for the new fuzzy search endpoint request flowsequenceDiagram
actor User
participant API as "ServerAdapter (API)"
participant DB as "Database"
User->>API: GET /quickstarts/fuzzy-search?q=term&max_distance=3&limit=50&offset=0
API->>DB: Execute Levenshtein fuzzy search query
DB-->>API: Return matching quickstarts with distance
API-->>User: Respond with JSON (data, search_term, max_distance)
Entity relationship diagram for fuzzy search result data structureerDiagram
QUICKSTART {
uint ID
string Name
bytes Content
}
FUZZY_SEARCH_RESULT {
int Distance
}
FUZZY_SEARCH_RESULT ||--|{ QUICKSTART : contains
Class diagram for FuzzySearchResult and related typesclassDiagram
class FuzzySearchResult {
+Quickstart Quickstart
+int Distance
}
class Quickstart {
+BaseModel BaseModel
+string Name
+[]byte Content
}
class BaseModel {
+uint ID
}
FuzzySearchResult --> Quickstart
Quickstart --> BaseModel
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- In GetQuickstartsFuzzySearch you’re encoding a generated.BadRequest for server-side errors—consider returning a dedicated InternalServerError response to match the 500 status.
- Tests register the route as /fuzzy-search but the handler name implies /quickstarts/fuzzy-search—make sure the endpoint path matches your production router setup.
- Instead of executing CREATE EXTENSION at runtime, consider managing the fuzzystrmatch extension through a database migration so it’s version-controlled and only applied once.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In GetQuickstartsFuzzySearch you’re encoding a generated.BadRequest for server-side errors—consider returning a dedicated InternalServerError response to match the 500 status.
- Tests register the route as /fuzzy-search but the handler name implies /quickstarts/fuzzy-search—make sure the endpoint path matches your production router setup.
- Instead of executing CREATE EXTENSION at runtime, consider managing the fuzzystrmatch extension through a database migration so it’s version-controlled and only applied once.
## Individual Comments
### Comment 1
<location> `pkg/routes/quickstarts_test.go:488-489` </location>
<code_context>
+ assert.GreaterOrEqual(t, len(payload.Data), 0)
+ })
+
+ t.Run("should respect pagination", func(t *testing.T) {
+ request, _ := http.NewRequest(http.MethodGet, "/fuzzy-search?q=Configuration&limit=1", nil)
+ response := httptest.NewRecorder()
+ router.ServeHTTP(response, request)
+
+ // Skip test if PostgreSQL extension is not available
+ if response.Code == 500 {
+ t.Skip("Skipping fuzzy search test - PostgreSQL fuzzystrmatch extension not available")
+ }
+
+ var payload *fuzzySearchResponse
+ json.NewDecoder(response.Body).Decode(&payload)
+ assert.Equal(t, 200, response.Code)
+ assert.LessOrEqual(t, len(payload.Data), 1)
+ })
+
</code_context>
<issue_to_address>
**suggestion (testing):** Add a test for offset pagination.
Please add a test case for the offset parameter to ensure it returns the correct subset of results during pagination.
```suggestion
assert.LessOrEqual(t, len(payload.Data), 1)
})
t.Run("should respect offset pagination", func(t *testing.T) {
// First, get all results for the query
requestAll, _ := http.NewRequest(http.MethodGet, "/fuzzy-search?q=Configuration", nil)
responseAll := httptest.NewRecorder()
router.ServeHTTP(responseAll, requestAll)
if responseAll.Code == 500 {
t.Skip("Skipping fuzzy search test - PostgreSQL fuzzystrmatch extension not available")
}
var payloadAll *fuzzySearchResponse
json.NewDecoder(responseAll.Body).Decode(&payloadAll)
assert.Equal(t, 200, responseAll.Code)
if len(payloadAll.Data) < 2 {
t.Skip("Not enough results to test offset pagination")
}
// Now, get the second result using offset=1&limit=1
requestOffset, _ := http.NewRequest(http.MethodGet, "/fuzzy-search?q=Configuration&limit=1&offset=1", nil)
responseOffset := httptest.NewRecorder()
router.ServeHTTP(responseOffset, requestOffset)
if responseOffset.Code == 500 {
t.Skip("Skipping fuzzy search test - PostgreSQL fuzzystrmatch extension not available")
}
var payloadOffset *fuzzySearchResponse
json.NewDecoder(responseOffset.Body).Decode(&payloadOffset)
assert.Equal(t, 200, responseOffset.Code)
assert.Equal(t, 1, len(payloadOffset.Data))
assert.Equal(t, payloadAll.Data[1], payloadOffset.Data[0])
})
```
</issue_to_address>
### Comment 2
<location> `pkg/routes/quickstarts_test.go:449-454` </location>
<code_context>
+ }
+ })
+
+ t.Run("should find fuzzy matches with typos", func(t *testing.T) {
+ request, _ := http.NewRequest(http.MethodGet, "/fuzzy-search?q=Geting Startd&max_distance=5", nil)
+ response := httptest.NewRecorder()
+ router.ServeHTTP(response, request)
+
+ // Skip test if PostgreSQL extension is not available
+ if response.Code == 500 {
+ t.Skip("Skipping fuzzy search test - PostgreSQL fuzzystrmatch extension not available")
+ }
+
+ var payload *fuzzySearchResponse
+ json.NewDecoder(response.Body).Decode(&payload)
+ assert.Equal(t, 200, response.Code)
+ assert.Equal(t, "Geting Startd", payload.SearchTerm)
+ assert.Equal(t, 5, payload.MaxDistance)
+ // Should find matches despite typos
+ assert.GreaterOrEqual(t, len(payload.Data), 0)
+ })
+
</code_context>
<issue_to_address>
**suggestion (testing):** Assert on the actual content of fuzzy matches for typo queries.
Consider updating the test to assert that the expected quickstart(s) are present in the results, such as by checking for specific displayName values. This will better validate the fuzzy matching logic.
```suggestion
assert.Equal(t, 200, response.Code)
assert.Equal(t, "Geting Startd", payload.SearchTerm)
assert.Equal(t, 5, payload.MaxDistance)
// Should find matches despite typos
assert.GreaterOrEqual(t, len(payload.Data), 0)
// Assert that the expected quickstart is present in the results
found := false
for _, result := range payload.Data {
if result.DisplayName == "Getting Started with Applications" {
found = true
break
}
}
assert.True(t, found, "Expected quickstart 'Getting Started with Applications' not found in fuzzy search results")
})
```
</issue_to_address>
### Comment 3
<location> `pkg/routes/quickstarts_test.go:507-524` </location>
<code_context>
+ assert.Equal(t, 0, len(payload.Data))
+ })
+
+ t.Run("should find quickstarts by displayName with fuzzy matching", func(t *testing.T) {
+ request, _ := http.NewRequest(http.MethodGet, "/fuzzy-search?q=Configure&max_distance=2", nil)
+ response := httptest.NewRecorder()
+ router.ServeHTTP(response, request)
+
+ // Skip test if PostgreSQL extension is not available
+ if response.Code == 500 {
+ t.Skip("Skipping fuzzy search test - PostgreSQL fuzzystrmatch extension not available")
+ }
+
+ var payload *fuzzySearchResponse
+ json.NewDecoder(response.Body).Decode(&payload)
+ assert.Equal(t, 200, response.Code)
+ assert.Equal(t, "Configure", payload.SearchTerm)
+ assert.Equal(t, 2, payload.MaxDistance)
+ // Should find quickstarts with "Configure" in displayName
+ assert.GreaterOrEqual(t, len(payload.Data), 0)
+ })
+}
</code_context>
<issue_to_address>
**suggestion (testing):** Consider adding a test for fuzzy search with special characters or case insensitivity.
Tests for queries with special characters, mixed case, or whitespace differences are missing. Please add coverage for these edge cases to ensure the fuzzy search endpoint behaves as expected.
```suggestion
t.Run("should find quickstarts by displayName with fuzzy matching", func(t *testing.T) {
request, _ := http.NewRequest(http.MethodGet, "/fuzzy-search?q=Configure&max_distance=2", nil)
response := httptest.NewRecorder()
router.ServeHTTP(response, request)
// Skip test if PostgreSQL extension is not available
if response.Code == 500 {
t.Skip("Skipping fuzzy search test - PostgreSQL fuzzystrmatch extension not available")
}
var payload *fuzzySearchResponse
json.NewDecoder(response.Body).Decode(&payload)
assert.Equal(t, 200, response.Code)
assert.Equal(t, "Configure", payload.SearchTerm)
assert.Equal(t, 2, payload.MaxDistance)
// Should find quickstarts with "Configure" in displayName
assert.GreaterOrEqual(t, len(payload.Data), 0)
})
t.Run("should handle fuzzy search with special characters", func(t *testing.T) {
request, _ := http.NewRequest(http.MethodGet, "/fuzzy-search?q=Confi!gure&max_distance=2", nil)
response := httptest.NewRecorder()
router.ServeHTTP(response, request)
if response.Code == 500 {
t.Skip("Skipping fuzzy search test - PostgreSQL fuzzystrmatch extension not available")
}
var payload *fuzzySearchResponse
json.NewDecoder(response.Body).Decode(&payload)
assert.Equal(t, 200, response.Code)
assert.Equal(t, "Confi!gure", payload.SearchTerm)
assert.Equal(t, 2, payload.MaxDistance)
// Should still find results if fuzzy matching works with special characters
assert.GreaterOrEqual(t, len(payload.Data), 0)
})
t.Run("should handle fuzzy search with mixed case", func(t *testing.T) {
request, _ := http.NewRequest(http.MethodGet, "/fuzzy-search?q=conFIgURe&max_distance=2", nil)
response := httptest.NewRecorder()
router.ServeHTTP(response, request)
if response.Code == 500 {
t.Skip("Skipping fuzzy search test - PostgreSQL fuzzystrmatch extension not available")
}
var payload *fuzzySearchResponse
json.NewDecoder(response.Body).Decode(&payload)
assert.Equal(t, 200, response.Code)
assert.Equal(t, "conFIgURe", payload.SearchTerm)
assert.Equal(t, 2, payload.MaxDistance)
// Should find results regardless of case
assert.GreaterOrEqual(t, len(payload.Data), 0)
})
t.Run("should handle fuzzy search with whitespace differences", func(t *testing.T) {
request, _ := http.NewRequest(http.MethodGet, "/fuzzy-search?q=Con figure&max_distance=2", nil)
response := httptest.NewRecorder()
router.ServeHTTP(response, request)
if response.Code == 500 {
t.Skip("Skipping fuzzy search test - PostgreSQL fuzzystrmatch extension not available")
}
var payload *fuzzySearchResponse
json.NewDecoder(response.Body).Decode(&payload)
assert.Equal(t, 200, response.Code)
assert.Equal(t, "Con figure", payload.SearchTerm)
assert.Equal(t, 2, payload.MaxDistance)
// Should find results even with whitespace differences
assert.GreaterOrEqual(t, len(payload.Data), 0)
})
```
</issue_to_address>
### Comment 4
<location> `pkg/routes/quickstarts_handlers.go:123` </location>
<code_context>
+}
+
+// GetQuickstartsFuzzySearch handles GET /quickstarts/fuzzy-search
+func (s *ServerAdapter) GetQuickstartsFuzzySearch(w http.ResponseWriter, r *http.Request) {
+ searchTerm := r.URL.Query().Get("q")
+ if searchTerm == "" {
</code_context>
<issue_to_address>
**issue (complexity):** Consider refactoring the handler by extracting query parsing, JSON writing, and SQL logic into helpers and a service layer to keep the handler concise.
```suggestion
Consider extracting all the low-level plumbing (query‐param parsing, JSON error/success writing, raw SQL→model mapping) into small helpers or moving the fuzzy-search SQL into your service layer. This will keep the handler at ~20 lines:
1) pkg/utils/http.go – parse ints & write JSON:
```go
// ParseIntQuery returns the integer value of ?key or def if missing/invalid.
func ParseIntQuery(r *http.Request, key string, def int) int {
if v := r.URL.Query().Get(key); v != "" {
if i, err := strconv.Atoi(v); err == nil {
return i
}
}
return def
}
// WriteJSON sets headers, status and encodes v to JSON.
func WriteJSON(w http.ResponseWriter, status int, v interface{}) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(status)
json.NewEncoder(w).Encode(v)
}
```
2) pkg/services/quickstart.go – move raw SQL into service and use GORM’s builder:
```go
func (svc *QuickstartService) FuzzySearch(ctx context.Context,
term string, maxDist int, p Pagination,
) ([]FuzzySearchResult, error) {
var results []FuzzySearchResult
err := svc.db.
Model(&models.Quickstart{}).
Select("quickstarts.*, levenshtein(content->'spec'->>'displayName', ?) AS distance", term).
Where("levenshtein(content->'spec'->>'displayName', ?) <= ?", term, maxDist).
Order("distance ASC, content->'spec'->>'displayName' ASC").
Limit(p.Limit).Offset(p.Offset).
Scan(&results).Error
return results, err
}
```
3) routes/serveradapter.go – the handler becomes:
```go
func (s *ServerAdapter) GetQuickstartsFuzzySearch(w http.ResponseWriter, r *http.Request) {
q := r.URL.Query().Get("q")
if q == "" {
utils.WriteJSON(w, http.StatusBadRequest, generated.BadRequest{Msg: ptr("missing 'q'")})
return
}
pagination := Pagination{
Limit: utils.ParseIntQuery(r, "limit", 50),
Offset: utils.ParseIntQuery(r, "offset", 0),
}
maxDist := utils.ParseIntQuery(r, "max_distance", 3)
results, err := s.quickstartService.FuzzySearch(r.Context(), q, maxDist, pagination)
if err != nil {
utils.WriteJSON(w, http.StatusInternalServerError, generated.BadRequest{Msg: ptr(err.Error())})
return
}
utils.WriteJSON(w, http.StatusOK, map[string]interface{}{
"data": results,
"search_term": q,
"max_distance": maxDist,
})
}
```
This preserves all functionality but collapses ~120 lines of boilerplate into focused helpers & service code.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| assert.LessOrEqual(t, len(payload.Data), 1) | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (testing): Add a test for offset pagination.
Please add a test case for the offset parameter to ensure it returns the correct subset of results during pagination.
| assert.LessOrEqual(t, len(payload.Data), 1) | |
| }) | |
| assert.LessOrEqual(t, len(payload.Data), 1) | |
| }) | |
| t.Run("should respect offset pagination", func(t *testing.T) { | |
| // First, get all results for the query | |
| requestAll, _ := http.NewRequest(http.MethodGet, "/fuzzy-search?q=Configuration", nil) | |
| responseAll := httptest.NewRecorder() | |
| router.ServeHTTP(responseAll, requestAll) | |
| if responseAll.Code == 500 { | |
| t.Skip("Skipping fuzzy search test - PostgreSQL fuzzystrmatch extension not available") | |
| } | |
| var payloadAll *fuzzySearchResponse | |
| json.NewDecoder(responseAll.Body).Decode(&payloadAll) | |
| assert.Equal(t, 200, responseAll.Code) | |
| if len(payloadAll.Data) < 2 { | |
| t.Skip("Not enough results to test offset pagination") | |
| } | |
| // Now, get the second result using offset=1&limit=1 | |
| requestOffset, _ := http.NewRequest(http.MethodGet, "/fuzzy-search?q=Configuration&limit=1&offset=1", nil) | |
| responseOffset := httptest.NewRecorder() | |
| router.ServeHTTP(responseOffset, requestOffset) | |
| if responseOffset.Code == 500 { | |
| t.Skip("Skipping fuzzy search test - PostgreSQL fuzzystrmatch extension not available") | |
| } | |
| var payloadOffset *fuzzySearchResponse | |
| json.NewDecoder(responseOffset.Body).Decode(&payloadOffset) | |
| assert.Equal(t, 200, responseOffset.Code) | |
| assert.Equal(t, 1, len(payloadOffset.Data)) | |
| assert.Equal(t, payloadAll.Data[1], payloadOffset.Data[0]) | |
| }) |
| assert.Equal(t, 200, response.Code) | ||
| assert.Equal(t, "Geting Startd", payload.SearchTerm) | ||
| assert.Equal(t, 5, payload.MaxDistance) | ||
| // Should find matches despite typos | ||
| assert.GreaterOrEqual(t, len(payload.Data), 0) | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (testing): Assert on the actual content of fuzzy matches for typo queries.
Consider updating the test to assert that the expected quickstart(s) are present in the results, such as by checking for specific displayName values. This will better validate the fuzzy matching logic.
| assert.Equal(t, 200, response.Code) | |
| assert.Equal(t, "Geting Startd", payload.SearchTerm) | |
| assert.Equal(t, 5, payload.MaxDistance) | |
| // Should find matches despite typos | |
| assert.GreaterOrEqual(t, len(payload.Data), 0) | |
| }) | |
| assert.Equal(t, 200, response.Code) | |
| assert.Equal(t, "Geting Startd", payload.SearchTerm) | |
| assert.Equal(t, 5, payload.MaxDistance) | |
| // Should find matches despite typos | |
| assert.GreaterOrEqual(t, len(payload.Data), 0) | |
| // Assert that the expected quickstart is present in the results | |
| found := false | |
| for _, result := range payload.Data { | |
| if result.DisplayName == "Getting Started with Applications" { | |
| found = true | |
| break | |
| } | |
| } | |
| assert.True(t, found, "Expected quickstart 'Getting Started with Applications' not found in fuzzy search results") | |
| }) |
| t.Run("should find quickstarts by displayName with fuzzy matching", func(t *testing.T) { | ||
| request, _ := http.NewRequest(http.MethodGet, "/fuzzy-search?q=Configure&max_distance=2", nil) | ||
| response := httptest.NewRecorder() | ||
| router.ServeHTTP(response, request) | ||
|
|
||
| // Skip test if PostgreSQL extension is not available | ||
| if response.Code == 500 { | ||
| t.Skip("Skipping fuzzy search test - PostgreSQL fuzzystrmatch extension not available") | ||
| } | ||
|
|
||
| var payload *fuzzySearchResponse | ||
| json.NewDecoder(response.Body).Decode(&payload) | ||
| assert.Equal(t, 200, response.Code) | ||
| assert.Equal(t, "Configure", payload.SearchTerm) | ||
| assert.Equal(t, 2, payload.MaxDistance) | ||
| // Should find quickstarts with "Configure" in displayName | ||
| assert.GreaterOrEqual(t, len(payload.Data), 0) | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (testing): Consider adding a test for fuzzy search with special characters or case insensitivity.
Tests for queries with special characters, mixed case, or whitespace differences are missing. Please add coverage for these edge cases to ensure the fuzzy search endpoint behaves as expected.
| t.Run("should find quickstarts by displayName with fuzzy matching", func(t *testing.T) { | |
| request, _ := http.NewRequest(http.MethodGet, "/fuzzy-search?q=Configure&max_distance=2", nil) | |
| response := httptest.NewRecorder() | |
| router.ServeHTTP(response, request) | |
| // Skip test if PostgreSQL extension is not available | |
| if response.Code == 500 { | |
| t.Skip("Skipping fuzzy search test - PostgreSQL fuzzystrmatch extension not available") | |
| } | |
| var payload *fuzzySearchResponse | |
| json.NewDecoder(response.Body).Decode(&payload) | |
| assert.Equal(t, 200, response.Code) | |
| assert.Equal(t, "Configure", payload.SearchTerm) | |
| assert.Equal(t, 2, payload.MaxDistance) | |
| // Should find quickstarts with "Configure" in displayName | |
| assert.GreaterOrEqual(t, len(payload.Data), 0) | |
| }) | |
| t.Run("should find quickstarts by displayName with fuzzy matching", func(t *testing.T) { | |
| request, _ := http.NewRequest(http.MethodGet, "/fuzzy-search?q=Configure&max_distance=2", nil) | |
| response := httptest.NewRecorder() | |
| router.ServeHTTP(response, request) | |
| // Skip test if PostgreSQL extension is not available | |
| if response.Code == 500 { | |
| t.Skip("Skipping fuzzy search test - PostgreSQL fuzzystrmatch extension not available") | |
| } | |
| var payload *fuzzySearchResponse | |
| json.NewDecoder(response.Body).Decode(&payload) | |
| assert.Equal(t, 200, response.Code) | |
| assert.Equal(t, "Configure", payload.SearchTerm) | |
| assert.Equal(t, 2, payload.MaxDistance) | |
| // Should find quickstarts with "Configure" in displayName | |
| assert.GreaterOrEqual(t, len(payload.Data), 0) | |
| }) | |
| t.Run("should handle fuzzy search with special characters", func(t *testing.T) { | |
| request, _ := http.NewRequest(http.MethodGet, "/fuzzy-search?q=Confi!gure&max_distance=2", nil) | |
| response := httptest.NewRecorder() | |
| router.ServeHTTP(response, request) | |
| if response.Code == 500 { | |
| t.Skip("Skipping fuzzy search test - PostgreSQL fuzzystrmatch extension not available") | |
| } | |
| var payload *fuzzySearchResponse | |
| json.NewDecoder(response.Body).Decode(&payload) | |
| assert.Equal(t, 200, response.Code) | |
| assert.Equal(t, "Confi!gure", payload.SearchTerm) | |
| assert.Equal(t, 2, payload.MaxDistance) | |
| // Should still find results if fuzzy matching works with special characters | |
| assert.GreaterOrEqual(t, len(payload.Data), 0) | |
| }) | |
| t.Run("should handle fuzzy search with mixed case", func(t *testing.T) { | |
| request, _ := http.NewRequest(http.MethodGet, "/fuzzy-search?q=conFIgURe&max_distance=2", nil) | |
| response := httptest.NewRecorder() | |
| router.ServeHTTP(response, request) | |
| if response.Code == 500 { | |
| t.Skip("Skipping fuzzy search test - PostgreSQL fuzzystrmatch extension not available") | |
| } | |
| var payload *fuzzySearchResponse | |
| json.NewDecoder(response.Body).Decode(&payload) | |
| assert.Equal(t, 200, response.Code) | |
| assert.Equal(t, "conFIgURe", payload.SearchTerm) | |
| assert.Equal(t, 2, payload.MaxDistance) | |
| // Should find results regardless of case | |
| assert.GreaterOrEqual(t, len(payload.Data), 0) | |
| }) | |
| t.Run("should handle fuzzy search with whitespace differences", func(t *testing.T) { | |
| request, _ := http.NewRequest(http.MethodGet, "/fuzzy-search?q=Con figure&max_distance=2", nil) | |
| response := httptest.NewRecorder() | |
| router.ServeHTTP(response, request) | |
| if response.Code == 500 { | |
| t.Skip("Skipping fuzzy search test - PostgreSQL fuzzystrmatch extension not available") | |
| } | |
| var payload *fuzzySearchResponse | |
| json.NewDecoder(response.Body).Decode(&payload) | |
| assert.Equal(t, 200, response.Code) | |
| assert.Equal(t, "Con figure", payload.SearchTerm) | |
| assert.Equal(t, 2, payload.MaxDistance) | |
| // Should find results even with whitespace differences | |
| assert.GreaterOrEqual(t, len(payload.Data), 0) | |
| }) |
dec74f9 to
09bf18f
Compare
Hyperkid123
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this query:
http://localhost:8000/api/quickstarts/v1/quickstarts/fuzzy-search?q=Advanced Cluster Security
The Advanced Cluster Security is a partial of Learn about Red Hat Advanced Cluster Security display name used in the acs-getting-started-acscs doc and got no results.
I think the query and how its structured is expecting the whole string and measures distance on that, not on a sub string.
| github.com/prometheus/client_golang v1.23.2 | ||
| github.com/redhatinsights/app-common-go v1.6.8 | ||
| github.com/redhatinsights/platform-go-middlewares/v2 v2.0.0 | ||
| github.com/redhatinsights/platform-go-middlewares v1.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need these dependency downgrades? Did you ran into any issues?
09bf18f to
23124bb
Compare
23124bb to
5923bab
Compare
5923bab to
3d1fcd3
Compare
RHCLOUD-40633
Summary by Sourcery
Add fuzzy search endpoint for quickstarts by matching displayName using Levenshtein distance with configurable tolerance and pagination; enable database fuzzystrmatch extension; update tests and sample data accordingly.
New Features:
Enhancements:
Deployment:
Tests: