Skip to content

Commit f7151a1

Browse files
Merge pull request #141 from groupby/feature/SRC-309
Add iNav flag to Query
2 parents 3f51805 + 1a6509b commit f7151a1

3 files changed

Lines changed: 47 additions & 2 deletions

File tree

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</parent>
1111

1212
<artifactId>api-java-flux</artifactId>
13-
<version>3.0.2-SNAPSHOT</version>
13+
<version>3.1.0-SNAPSHOT</version>
1414

1515
<packaging>jar</packaging>
1616

@@ -31,7 +31,7 @@
3131
<repo.upload.retryAttempts>3</repo.upload.retryAttempts>
3232

3333
<!-- ### Versions -->
34-
<groupbyinc.common.version>189</groupbyinc.common.version>
34+
<groupbyinc.common.version>190</groupbyinc.common.version>
3535
<api.servlet.version>2.5</api.servlet.version>
3636
<api.jsp.version>2.2</api.jsp.version>
3737
<junit.version>4.12</junit.version>

src/main/java/com/groupbyinc/api/Query.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public class Query {
7171
private RestrictNavigation restrictNavigation;
7272
private Biasing biasing = new Biasing();
7373
private boolean bot = false;
74+
private Boolean intelligentNavigationEnabled;
7475

7576
/**
7677
* <code>
@@ -120,6 +121,8 @@ private Request populateRequest(String clientKey) {
120121
request.setRestrictNavigation(convertRestrictNavigation());
121122
request.setWildcardSearchEnabled(isWildcardSearchEnabled());
122123
request.setSecuredPayload(securedPayload);
124+
request.setIntelligentNavigationEnabled(intelligentNavigationEnabled);
125+
123126
if (CollectionUtils.isNotEmpty(sort)) {
124127
for (Sort s : sort) {
125128
request.setSort(convertSort(s));
@@ -1659,4 +1662,30 @@ public void setBot(boolean bot) {
16591662
this.queryUrlParams.remove("bot");
16601663
}
16611664
}
1665+
1666+
/**
1667+
* @return The intelligent navigation flag.
1668+
*/
1669+
public Boolean getIntelligentNavigationEnabled() {
1670+
return intelligentNavigationEnabled;
1671+
}
1672+
1673+
/**
1674+
* <code>
1675+
* Explicitly enable or disable Intelligent Navigation (iNav), which will override any configuration applied to Areas or Rules that might trigger.
1676+
* Leave 'null' to allow the Area or Rule configurations to take priority.
1677+
*
1678+
* iNav will attempt to reorder your navigations and refinements based on popularity.
1679+
*
1680+
*
1681+
* </code>
1682+
*
1683+
* @param intelligentNavigationEnabled
1684+
* The intelligent navigation flag.
1685+
*
1686+
* @internal
1687+
*/
1688+
public void setIntelligentNavigationEnabled(Boolean intelligentNavigationEnabled) {
1689+
this.intelligentNavigationEnabled = intelligentNavigationEnabled;
1690+
}
16621691
}

src/test/java/com/groupbyinc/api/QueryTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,4 +592,20 @@ public void testPreFilterExpression() {
592592
" 'pre-filter': 'brand = \\\"shiny\\\"'" + //
593593
"}", test);
594594
}
595+
596+
@Test
597+
public void testIntelligentNavigation() {
598+
test.setQuery("Linen");
599+
test.setIntelligentNavigationEnabled(true);
600+
601+
assertQuery("{" + //
602+
" 'clientKey': 'aoeu'," + //
603+
" 'pageSize': 10," + //
604+
" 'pruneRefinements': true," + //
605+
" 'query': 'Linen'," + //
606+
" 'returnBinary': true," + //
607+
" 'skip': 0," + //
608+
" 'iNavEnabled': true" + //
609+
"}", test);
610+
}
595611
}

0 commit comments

Comments
 (0)