diff --git a/google.go b/google.go index cb90a68..9ae929c 100644 --- a/google.go +++ b/google.go @@ -16,6 +16,8 @@ const ( excludeTag = "-" intitleTag = "intitle:" intextTag = "intext:" + operatorOr = "|" + operatorAnd = "+" ) // GoogleSearch is the Google search implementation for Dorkgen @@ -59,7 +61,7 @@ func (e *GoogleSearch) Site(site string) *GoogleSearch { // Or puts an OR operator in the request func (e *GoogleSearch) Or() *GoogleSearch { - e.tags = append(e.tags, "OR") + e.tags = append(e.tags, operatorOr) return e } diff --git a/google_test.go b/google_test.go index 7d6247b..150d917 100644 --- a/google_test.go +++ b/google_test.go @@ -123,7 +123,7 @@ func TestInit(t *testing.T) { Site("twitter.com"). String() - assert.Equal(result, "site:facebook.com OR site:twitter.com", "they should be equal") + assert.Equal(result, "site:facebook.com | site:twitter.com", "they should be equal") }) t.Run("should handle group tag correctly", func(t *testing.T) { @@ -134,7 +134,7 @@ func TestInit(t *testing.T) { Group((NewGoogleSearch()).Intext("1").Or().Intext("2")). String() - assert.Equal(result, "site:linkedin.com (intext:\"1\" OR intext:\"2\")", "they should be equal") + assert.Equal(result, "site:linkedin.com (intext:\"1\" | intext:\"2\")", "they should be equal") }) t.Run("should handle group tag correctly", func(t *testing.T) { @@ -146,7 +146,7 @@ func TestInit(t *testing.T) { Intitle("jordan"). String() - assert.Equal(result, "site:linkedin.com (intext:\"1\" OR intext:\"2\") intitle:\"jordan\"", "they should be equal") + assert.Equal(result, "site:linkedin.com (intext:\"1\" | intext:\"2\") intitle:\"jordan\"", "they should be equal") }) t.Run("should return URL values", func(t *testing.T) { @@ -159,7 +159,7 @@ func TestInit(t *testing.T) { QueryValues() assert.Equal(url.Values{ - "q": []string{"site:linkedin.com (intext:\"1\" OR intext:\"2\") intitle:\"jordan\""}, + "q": []string{"site:linkedin.com (intext:\"1\" | intext:\"2\") intitle:\"jordan\""}, }, result, "they should be equal") }) }