-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(search): added skeleton for suggest func
- Loading branch information
1 parent
b035242
commit eef938c
Showing
4 changed files
with
53 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package search | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
|
||
"github.com/rs/zerolog/log" | ||
|
||
"github.com/hearchco/agent/src/search/engines" | ||
"github.com/hearchco/agent/src/search/engines/options" | ||
"github.com/hearchco/agent/src/utils/anonymize" | ||
) | ||
|
||
func Suggest(query string, locale options.Locale) ([]string, error) { | ||
// Capture start time. | ||
startTime := time.Now() | ||
|
||
if err := validateSuggestParams(query, locale); err != nil { | ||
return nil, err | ||
} | ||
|
||
log.Debug(). | ||
Str("query", anonymize.String(query)). | ||
Str("locale", locale.String()). | ||
Msg("Suggesting") | ||
|
||
// TODO: Implement the suggest function. | ||
suggestions := []string{} | ||
responders := []engines.Name{} | ||
|
||
log.Debug(). | ||
Int("suggestions", len(suggestions)). | ||
Str("query", anonymize.String(query)). | ||
Str("responders", fmt.Sprintf("%v", responders)). | ||
Dur("duration", time.Since(startTime)). | ||
Msg("Scraping finished") | ||
|
||
// Return the suggestions. | ||
return suggestions, nil | ||
} |