Skip to content

Commit

Permalink
fix(gae): add gae_search prefix to all regions (#5088)
Browse files Browse the repository at this point in the history
Co-authored-by: Eric Schmidt <erschmid@google.com>
  • Loading branch information
OremGLG and telpirion authored Jan 21, 2025
1 parent d56618b commit 0251f91
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions docs/appengine/search/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

package sample

// [START creating_a_document]
// [START gae_search_creating_a_document]
import (
"context"
"fmt"
Expand Down Expand Up @@ -43,9 +43,9 @@ func putHandler(w http.ResponseWriter, r *http.Request) {
Birthday: time.Date(1960, time.June, 19, 0, 0, 0, 0, nil),
}
// ...
// [END creating_a_document]
// [END gae_search_creating_a_document]

// [START putting_documents_in_an_index_1]
// [START gae_search_putting_documents_in_an_index_1]
// ...
ctx := appengine.NewContext(r)
index, err := search.Open("users")
Expand All @@ -60,19 +60,19 @@ func putHandler(w http.ResponseWriter, r *http.Request) {
}
fmt.Fprint(w, "OK")

// [END putting_documents_in_an_index_1]
// [END gae_search_putting_documents_in_an_index_1]

// [START putting_documents_in_an_index_2]
// [START gae_search_putting_documents_in_an_index_2]
id, err = index.Put(ctx, "", user)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
fmt.Fprint(w, id)
// [END putting_documents_in_an_index_2]
// [END gae_search_putting_documents_in_an_index_2]
}

// [START retrieving_documents_by_doc_ids]
// [START gae_search_retrieving_documents_by_doc_ids]
func getHandler(w http.ResponseWriter, r *http.Request) {
ctx := appengine.NewContext(r)

Expand All @@ -91,9 +91,9 @@ func getHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Retrieved document: ", user)
}

// [END retrieving_documents_by_doc_ids]
// [END gae_search_retrieving_documents_by_doc_ids]

// [START deleting_documents_from_an_index]
// [START gae_search_deleting_documents_from_an_index]
func deleteHandler(w http.ResponseWriter, r *http.Request) {
ctx := appengine.NewContext(r)

Expand All @@ -112,11 +112,11 @@ func deleteHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Deleted document: ", id)
}

// [END deleting_documents_from_an_index]
// [END gae_search_deleting_documents_from_an_index]

type Doc struct{}

// [START search_example_1]
// [START gae_search_search_example_1]
func searchHandler(w http.ResponseWriter, r *http.Request) {
ctx := appengine.NewContext(r)

Expand All @@ -139,23 +139,23 @@ func searchHandler(w http.ResponseWriter, r *http.Request) {
}
}

// [END search_example_1]
// [END gae_search_search_example_1]

func sample() {
var ctx context.Context
var index search.Index

// [START queries_1]
// [START gae_search_queries_1]
index.Search(ctx, "rose water", nil)
// [END queries_1]
// [END gae_search_queries_1]

// [START queries_2]
// [START gae_search_queries_2]
index.Search(ctx, "1776-07-04", nil)
// [END queries_2]
// [END gae_search_queries_2]

// [START queries_3]
// [START gae_search_queries_3]
// search for documents with pianos that cost less than $5000
index.Search(ctx, "Product = piano AND Price < 5000", nil)
// [END queries_3]
// [END gae_search_queries_3]

}

0 comments on commit 0251f91

Please sign in to comment.