Skip to content

Commit 5242542

Browse files
committed
- Turing: fq.and, fq.or, fq.op, targetingRules Conditions
1 parent 68f5ddf commit 5242542

9 files changed

+160
-89
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[%header,cols=4*]
2+
|===
3+
| Attribute | Required / Optional | Description | Example
4+
| siteName | Required | Site Name | Sample
5+
|===
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[%header,cols=4*]
2+
|===
3+
| Attribute | Required / Optional | Description | Example
4+
| q | Required | Search Query. | q=foo
5+
| p | Required | Page Number, first page is 1. | p=1
6+
| sort | Required | Sort values: `relevance`, `newest` and `oldest`. Or *FIELD*: *SORT* | sort=relevance or sort=title:asc
7+
| fq[] | Optional | Query Field. Filter by field using default operator in configuration or using the `fqOperator`(request) or `fq.op` (query string), using the following pattern: *FIELD*: *VALUE*. | fq[]=title:bar
8+
| fq.and[] | Optional | Query Field. Filter `AND` by field, using the following pattern: *FIELD*: *VALUE*. | fq.and[]=title:bar
9+
| fq.or[] | Optional | Query Field. Filter `OR` by field, using the following pattern: *FIELD*: *VALUE*. | fq.or[]=title:bar
10+
| fq.op | Optional | Query Field Operator. Filter OR by field, Operator values: `AND` and `OR`. | fq.op=AND
11+
| rows | Optional | Number of rows that query will return. | rows=10
12+
| _setlocale | Required | Locale of Semantic Navigation Site | _setlocale=en_US
13+
| nfpr | Optional | Disable Auto Correction | nfpr=1
14+
| group | Optional | Group by attribute | group=type
15+
|===
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
*IMPORTANT* These parameters have precedence over the query string.
3+
4+
[%header,cols=3*]
5+
|===
6+
| Attribute | Required / Optional | Description
7+
| query | Required | Search Query.
8+
| page | Required | Page Number, first page is 1.
9+
| sort | Required | Sort values: `relevance`, `newest` and `oldest`. Or *FIELD*: *SORT*
10+
| fq | Optional | Query Field. Filter by field using default operator in configuration or using the `fqOperator`(request) or `fq.op` (query string), using the following pattern: *FIELD*: *VALUE*.
11+
| fqAnd | Optional | Query Field. Filter `AND` by field, using the following pattern: *FIELD*: *VALUE*.
12+
| fqOr | Optional | Query Field. Filter `OR` by field, using the following pattern: *FIELD*: *VALUE*.
13+
| fqOperator | Optional | Query Field Operator. Filter OR by field, Operator values: `AND` and `OR`.
14+
| rows | Optional | Number of rows that query will return.
15+
| locale | Required | Locale of Semantic Navigation Site
16+
| group | Optional | Group by attribute
17+
| targetingRules | String[] | Optional | Targeting Rules. Restrict search based in: *FIELD*: *VALUE*.
18+
| targetingRulesWithCondition | Optional | Targueting Rules with Condition
19+
| targetingRulesWithConditionAND | Optional | Targueting Rules `AND` with Condition
20+
| targetingRulesWithConditionOR | Optional | Targueting Rules `OR` with Condition
21+
| populateMetrics | Boolean | Optional | If populate metrics
22+
| userId | String| Optional | User Id
23+
|===

docs/_adoc_includes/turing/0.3.9/api/turing-api-search-between-dates.adoc

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,20 @@ GET|POST http://localhost:2700/api/sn/{{siteName}}/search
1212
include::turing-api-headers.adoc[]
1313

1414
===== Path Parameters
15-
[%header,cols=4*]
16-
|===
17-
| Attribute | Required / Optional | Description | Example
18-
| siteName | Required | Site Name | Sample
19-
|===
15+
16+
include::turing-api-path.adoc[]
2017

2118
===== Query String
22-
[%header,cols=4*]
23-
|===
24-
| Attribute | Required / Optional | Description | Example
25-
| q | Required | Search Query. | q=foo
26-
| p | Required | Page Number, first page is 1. | p=1
27-
| sort | Required | Sort values: `relevance`, `newest` and `oldest`. Or *FIELD*: *SORT* | sort=relevance or sort=title:asc
28-
| *fq[]* | Optional | Query Field. Filter by field, using the following pattern: *FIELD*: *VALUE*. | fq[]=title:bar
29-
| rows | Optional | Number of rows that query will return. | rows=10
30-
| _setlocale | Required | Locale of Semantic Navigation Site | _setlocale=en_US
31-
| nfpr | Optional | Disable Auto Correction | nfpr=1
32-
| group | Optional | Group by attribute | group=type
33-
|===
34-
35-
You will use fq[] to define the dates using the expression with the following date format: `yyyy-MM-dd'T'HH:mm:ss'Z`
19+
20+
include::turing-api-query-string.adoc[]
21+
22+
*IMPORTANT* You will use `fq[]`, `fq.and[]` and `fq.or[]` to define the dates using the expression with the following date format: `yyyy-MM-dd'T'HH:mm:ss'Z`
23+
24+
===== Request Parameters
25+
26+
include::turing-api-request.adoc[]
27+
28+
*IMPORTANT* You will use `fq`, `fqAnd`, `fqOr` to define the dates using the expression with the following date format: `yyyy-MM-dd'T'HH:mm:ss'Z`
3629

3730

3831
===== Between Dates

docs/_adoc_includes/turing/0.3.9/api/turing-api-search-latest.adoc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@ POST http://localhost:2700/api/sn/{{siteName}}/search/latest
1212
include::turing-api-headers.adoc[]
1313

1414
===== Path Parameters
15-
[%header,cols=5*]
16-
|===
17-
| Attribute | Type | Required / Optional | Description | Example
18-
| sitename | String| Required | Site Name. | Sample
19-
|===
15+
16+
include::turing-api-path.adoc[]
2017

2118
===== Query String
2219
[%header,cols=6*]

docs/_adoc_includes/turing/0.3.9/api/turing-api-search-locales.adoc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@ GET http://localhost:2700/api/sn/{{siteName}}/search/locales
88
....
99

1010
===== Path Parameters
11-
[%header,cols=5*]
12-
|===
13-
| Attribute | Type | Required / Optional | Description | Example
14-
| sitename | String| Required | Site Name. | Sample
15-
|===
11+
12+
include::turing-api-path.adoc[]
1613

1714
===== Example - Request
1815
```bash

docs/_adoc_includes/turing/0.3.9/api/turing-api-search-with-group-by.adoc

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,41 @@ GET|POST http://localhost:2700/api/sn/{{siteName}}/search
1212
include::turing-api-headers.adoc[]
1313

1414
===== Path Parameters
15-
[%header,cols=4*]
16-
|===
17-
| Attribute | Required / Optional | Description | Example
18-
| siteName | Required | Site Name | Sample
19-
|===
15+
16+
include::turing-api-path.adoc[]
2017

2118
===== Query String
22-
[%header,cols=4*]
23-
|===
24-
| Attribute | Required / Optional | Description | Example
25-
| q | Required | Search Query. | q=foo
26-
| p | Required | Page Number, first page is 1. | p=1
27-
| sort | Required | Sort values: `relevance`, `newest` and `oldest`. Or *FIELD*: *SORT* | sort=relevance or sort=title:asc
28-
| fq[] | Optional | Query Field. Filter by field, using the following pattern: *FIELD*: *VALUE*. | fq[]=title:bar
29-
| rows | Optional | Number of rows that query will return. | rows=10
30-
| _setlocale | Required | Locale of Semantic Navigation Site | _setlocale=en_US
31-
| nfpr | Optional | Disable Auto Correction | nfpr=1
32-
| *group* | Optional | Group by attribute | group=type
33-
|===
19+
20+
include::turing-api-query-string.adoc[]
21+
22+
===== Request Parameters
23+
24+
include::turing-api-request.adoc[]
3425

3526
===== Example - Request
3627
```bash
3728
curl -X 'GET' \
38-
'http://localhost:2700/api/sn/Sample/search?q=foobar&p=1&group=type&sort=relevance&rows=10&nfpr=0&_setlocale=en_US' \
29+
'http://localhost:2700/api/sn/Sample/search?q=foobar&p=1&group=type&sort=relevance&rows=10_setlocale=en_US' \
3930
-H 'Content-Type: application/json'
4031
```
4132

33+
34+
===== Example - Request
35+
```bash
36+
curl -X 'POST' \
37+
'http://localhost:2700/api/sn/Sample/search' \
38+
-H 'Key: {{Enter your API KEY}}' \
39+
-H 'Content-Type: application/json' \
40+
-d '{
41+
"query": "foobar",
42+
"page": 1,
43+
"group": "type",
44+
"sort": "relevance",
45+
"rows": 10,
46+
"locale": "en_US"
47+
}'
48+
```
49+
4250
===== Example - Response
4351
```json
4452
{

docs/_adoc_includes/turing/0.3.9/api/turing-api-search-with-targeting-rules.adoc

Lines changed: 47 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,17 @@ POST http://localhost:2700/api/sn/{{siteName}}/search
1212
include::turing-api-headers.adoc[]
1313

1414
===== Path Parameters
15-
[%header,cols=4*]
16-
|===
17-
| Attribute | Required / Optional | Description | Example
18-
| siteName | Required | Site Name | Sample
19-
|===
2015

21-
===== Query String
22-
[%header,cols=4*]
16+
include::turing-api-path.adoc[]
2317

24-
|===
25-
| Attribute | Required / Optional | Description | Example
26-
| q | Required | Search Query. | q=foo
27-
| p | Required | Page Number, first page is 1. | p=1
28-
| sort | Required | Sort values: `relevance`, `newest` and `oldest`. Or *FIELD*: *SORT* | sort=relevance or sort=title:asc
29-
| fq[] | Optional | Query Field. Filter by field, using the following pattern: *FIELD*: *VALUE*. | fq[]=title:bar
18+
===== Query String
3019

31-
| rows | Optional | Number of rows that query will return. | rows=10
32-
| _setlocale | Required | Locale of Semantic Navigation Site | _setlocale=en_US
33-
| nfpr | Optional | Disable Auto Correction | nfpr=1
34-
| group | Optional | Group by attribute | group=type
35-
|===
20+
include::turing-api-query-string.adoc[]
3621

3722

3823
===== Request Parameters
39-
[%header,cols=4*]
40-
|===
41-
| Attribute | Type | Required / Optional | Description
42-
| userId | String| Optional | User Id
43-
| *targetingRules* | String[] | Optional | Targeting Rule. Restrict search based in: *FIELD*: *VALUE*.
44-
| populateMetrics | Boolean | Optional | If populate metrics
45-
|===
24+
25+
include::turing-api-request.adoc[]
4626

4727
===== Example - Request
4828
```bash
@@ -60,6 +40,48 @@ curl -X 'POST' \
6040
}'
6141
```
6242

43+
===== Example - Request
44+
```bash
45+
curl -X 'POST' \
46+
'http://localhost:2700/api/sn/Sample/search?q=foobar&p=1&fq%5B%5D=state%3AWA&sort=relevance&rows=10&nfpr=0&_setlocale=en_US' \
47+
-H 'Content-Type: application/json' \
48+
-H 'Key: {{Enter your API KEY}}' \
49+
-d '{
50+
"userId": "string",
51+
"populateMetrics": true,
52+
"targetingRulesCondition": {
53+
"type:News": [
54+
"department:HR",
55+
"profile:Principal"
56+
],
57+
"type:Article": [
58+
"department:IT",
59+
"profile:Consultant"
60+
]
61+
},
62+
"targetingRulesConditionAND": {
63+
"type:Event": [
64+
"department:HR",
65+
"profile:Manager"
66+
],
67+
"type:Report": [
68+
"department:IT",
69+
"profile:Coordinator"
70+
]
71+
},
72+
"targetingRulesConditionOR": {
73+
"type:Faq": [
74+
"department:HR",
75+
"profile:Junior"
76+
],
77+
"type:Text": [
78+
"department:IT",
79+
"profile:Junior"
80+
]
81+
}
82+
}'
83+
```
84+
6385
===== Example - Response
6486

6587
```json

docs/_adoc_includes/turing/0.3.9/api/turing-api-search.adoc

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,46 @@ Search on the semantic navigation site.
44

55
===== API Endpoint
66
....
7-
GET http://localhost:2700/api/sn/{{siteName}}/search
7+
GET|POST http://localhost:2700/api/sn/{{siteName}}/search
88
....
99

10+
===== Headers
11+
12+
include::turing-api-headers.adoc[]
13+
1014
===== Path Parameters
11-
[%header,cols=4*]
12-
|===
13-
| Attribute | Required / Optional | Description | Example
14-
| siteName | Required | Site Name | Sample
15-
|===
15+
16+
include::turing-api-path.adoc[]
1617

1718
===== Query String
18-
[%header,cols=4*]
19-
|===
20-
| Attribute | Required / Optional | Description | Example
21-
| q | Required | Search Query. | q=foo
22-
| p | Required | Page Number, first page is 1. | p=1
23-
| sort | Required | Sort values: `relevance`, `newest` and `oldest`. Or *FIELD*: *SORT* | sort=relevance or sort=title:asc
24-
| fq[] | Optional | Query Field. Filter by field, using the following pattern: *FIELD*: *VALUE*. | fq[]=title:bar
25-
| rows | Optional | Number of rows that query will return. | rows=10
26-
| _setlocale | Required | Locale of Semantic Navigation Site | _setlocale=en_US
27-
| nfpr | Optional | Disable Auto Correction | nfpr=1
28-
|===
19+
20+
include::turing-api-query-string.adoc[]
21+
22+
===== Request Parameters
23+
24+
include::turing-api-request.adoc[]
2925

3026
===== Example - Request
3127
```bash
3228
curl -X 'GET' \
3329
'http://localhost:2700/api/sn/Sample/search?q=foobar&p=1&fq[]=state:WA&sort=relevance&rows=10&nfpr=0&_setlocale=en_US' \
3430
-H 'Content-Type: application/json'
3531
```
32+
OR +
33+
34+
```bash
35+
curl -X 'POST' \
36+
'http://localhost:2700/api/sn/Sample/search' \
37+
-H 'Key: {{Enter your API KEY}}' \
38+
-H 'Content-Type: application/json' \
39+
-d '{
40+
"query": "foobar",
41+
"fq": "state:WA",
42+
"sort": "relevance",
43+
"rows": 10,
44+
"locale": "en_US"
45+
}'
46+
```
3647

3748
===== Example - Response
3849
```json

0 commit comments

Comments
 (0)