Explorar el Código

Update 1core.go

wibyweb hace 1 año
padre
commit
4ff0314b12
Se han modificado 1 ficheros con 6 adiciones y 2 borrados
  1. 6 2
      go/core/1core.go

+ 6 - 2
go/core/1core.go

@@ -87,11 +87,15 @@ func handler(w http.ResponseWriter, r *http.Request) {
 
 
 	//Check if query and page params exist
 	//Check if query and page params exist
 	if _, ok := m["q"]; ok {
 	if _, ok := m["q"]; ok {
-		query = strings.Replace(m["q"][0], "'", "''", -1)
+		query = m["q"][0]
+		query = strings.Replace(query, "'", "''", -1)
+		query = strings.Replace(query, "+ ", " ", -1)
+		query = strings.Replace(query, "- ", " ", -1)
 		queryNoQuotes = query
 		queryNoQuotes = query
 	}
 	}
 	if _, ok := m["p"]; ok {//gets page num, will convert to offset further down
 	if _, ok := m["p"]; ok {//gets page num, will convert to offset further down
-		page = strings.Replace(m["p"][0], "'", "''", -1)
+		page = m["p"][0]
+		page = strings.Replace(page, "'", "''", -1)
 		offset = page
 		offset = page
 	}
 	}