From 1b3d9308e143bbeced9f944a08e641034593db56 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Fri, 18 Sep 2015 19:07:55 +0900 Subject: [PATCH] Updating server --- search.go | 2 +- types.go | 2 +- util.go | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/search.go b/search.go index 41af9d0..4e1d6af 100644 --- a/search.go +++ b/search.go @@ -336,7 +336,7 @@ func handleAccessReview(rw http.ResponseWriter, req *http.Request) { } if rowsAffected == 0 || len(request.Profile) == 0 { - http.Error(rw, err.Error(), http.StatusInternalServerError) + http.Error(rw, "invalid profile", http.StatusInternalServerError) return } diff --git a/types.go b/types.go index 6aa30c2..8da9b90 100644 --- a/types.go +++ b/types.go @@ -62,7 +62,7 @@ type record struct { Id int `json:"id"` Name string `json:"name"` Score float64 `json:"score"` - Url string `json:"url"` + Urls string `json:"urls"` features map[string]float64 geo geoData } diff --git a/util.go b/util.go index 808b32e..9d78281 100644 --- a/util.go +++ b/util.go @@ -256,7 +256,7 @@ func computeRecordCompat(db *sql.DB, entries []record, context queryContext) err } func fetchRecords(db *sql.DB, context queryContext) ([]record, error) { - rows, err := db.Query("SELECT name, url, delicious, accommodating, affordable, atmospheric, latitude, longitude, closestStnDist, closestStnName, accessCount, id FROM reviews") + rows, err := db.Query("SELECT name, urls, delicious, accommodating, affordable, atmospheric, latitude, longitude, closestStnDist, closestStnName, accessCount, id FROM reviews") if err != nil { return nil, err } @@ -265,7 +265,7 @@ func fetchRecords(db *sql.DB, context queryContext) ([]record, error) { var entries []record for rows.Next() { var ( - name, url, closestStn string + name, urls, closestStn string delicious, accommodating, affordable, atmospheric float64 latitude, longitude, distanceToStn float64 accessCount, id int @@ -273,7 +273,7 @@ func fetchRecords(db *sql.DB, context queryContext) ([]record, error) { rows.Scan( &name, - &url, + &urls, &delicious, &accommodating, &affordable, @@ -287,7 +287,7 @@ func fetchRecords(db *sql.DB, context queryContext) ([]record, error) { entry := record{ Name: name, - Url: url, + Urls: urls, DistanceToStn: distanceToStn, ClosestStn: closestStn, AccessCount: accessCount,