Skip to content

Commit d9a1053

Browse files
committed
rename to "enableLogicalOperators", if false, lowercase all LogicalOperators
1 parent 86aa23d commit d9a1053

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,12 @@ client.setFilterObject(filter);
197197
client.setResultType('organic');
198198
```
199199

200-
#### Set ignoreLogicalOperatorCase
200+
#### Set enableLogicalOperators
201201
```js
202202
// (default: false)
203-
// If "true", we uppercase the logical operator AND/OR/NOT in the search query
204-
client.setIgnoreLogicalOperatorCase(true);
203+
// enableLogicalOperators(true) = Support user specified logical operators (and/or/not) in the search query like "cat and dog"
204+
// enableLogicalOperators(false) = Treat logical operators in the search query as literal strings
205+
client.enableLogicalOperators(true);
205206
```
206207

207208
### Facets

dist/addsearch-js-client.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/apifetch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ var executeApiFetch = function(apiHostname, sitekey, type, settings, cb, fuzzyRe
4141
kw = settings.keyword;
4242

4343
// Boolean operators (AND, OR, NOT) uppercase
44-
kw = settings.ignoreLogicalOperatorCase ?
44+
kw = settings.enableLogicalOperators ?
4545
kw.replace(/ and /g, ' AND ').replace(/ or /g, ' OR ').replace(/ not /g, ' NOT ') :
46-
kw;
46+
kw.replace(/ AND /g, ' and ').replace(/ OR /g, ' or ').replace(/ NOT /g, ' not ');
4747

4848
// Escape
4949
kw = encodeURIComponent(kw);

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ var client = function(sitekey, privatekey) {
159159
this.setThrottleTime = function(delay) { API_THROTTLE_TIME_MS = delay; }
160160
this.setStatsSessionId = function(id) { this.sessionId = id; }
161161
this.getStatsSessionId = function() { return this.sessionId; }
162-
this.setIgnoreLogicalOperatorCase = function(ignoreLogicalOperatorCase) { this.settings.setIgnoreLogicalOperatorCase(ignoreLogicalOperatorCase) }
162+
this.enableLogicalOperators = function(enableLogicalOperators) { this.settings.enableLogicalOperators(enableLogicalOperators) }
163163

164164
this.sendStatsEvent = function(type, keyword, data) {
165165
if (type === 'search') {

src/settings.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var settings = function() {
1818
autocomplete: {
1919
size: 10
2020
},
21-
ignoreLogicalOperatorCase: false
21+
enableLogicalOperators: false
2222
};
2323

2424
this.getSettings = function() {
@@ -64,8 +64,8 @@ var settings = function() {
6464
this.settings.fuzzy = fuzzy;
6565
}
6666

67-
this.setIgnoreLogicalOperatorCase = function(ignoreLogicalOperatorCase) {
68-
this.settings.ignoreLogicalOperatorCase = ignoreLogicalOperatorCase;
67+
this.enableLogicalOperators = function(enableLogicalOperators) {
68+
this.settings.enableLogicalOperators = enableLogicalOperators;
6969
}
7070

7171
this.setPostfixWildcard = function(wildcard) {

0 commit comments

Comments
 (0)