added modular text search

This commit is contained in:
partisan 2024-05-16 18:29:26 +02:00
parent 4fd8404a08
commit dafa3605d3
3 changed files with 19 additions and 2 deletions

2
run.sh
View file

@ -1,3 +1,3 @@
#!/bin/bash
go run main.go text-google.go images.go imageproxy.go video.go map.go
go run main.go text-google.go images.go imageproxy.go video.go map.go text.go

View file

@ -74,7 +74,7 @@ func PerformTextSearch(query, safe, lang string) ([]TextSearchResult, error) {
return results, nil
}
func handleTextSearch(w http.ResponseWriter, query, safe, lang string) {
func handleTextSearchGoogle(w http.ResponseWriter, query, safe, lang string) {
// Perform the text search
results, err := PerformTextSearch(query, safe, lang)
if err != nil {

17
text.go
View file

@ -0,0 +1,17 @@
// text.go
package main
import (
"net/http"
)
// HandleTextSearch determines which text search engine to use and calls the appropriate function
func handleTextSearch(w http.ResponseWriter, query, safe, lang string) {
// Add logic here to determine which search engine to use, for now it just uses Google
handleTextSearchGoogle(w, query, safe, lang)
}
func displayResults(w http.ResponseWriter, results string) {
// Implement your result display logic here
w.Write([]byte(results))
}