added modular text search
This commit is contained in:
parent
797c5f869f
commit
cdbde2919c
3 changed files with 19 additions and 2 deletions
2
run.sh
2
run.sh
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/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
|
|
@ -74,7 +74,7 @@ func PerformTextSearch(query, safe, lang string) ([]TextSearchResult, error) {
|
||||||
return results, nil
|
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
|
// Perform the text search
|
||||||
results, err := PerformTextSearch(query, safe, lang)
|
results, err := PerformTextSearch(query, safe, lang)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
17
text.go
17
text.go
|
@ -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))
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue