Skip to content

Commit fe8a938

Browse files
authored
Fixed analytics (#6)
This client was reporting itself as "app search", instead of "site search".
1 parent 19ca71e commit fe8a938

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+794
-666
lines changed

elastic_site_search/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from .version import VERSION
1717

18-
CLIENT_NAME = 'elastic-app-search-python'
18+
CLIENT_NAME = 'elastic-site-search-python'
1919
DEFAULT_API_HOST = 'api.swiftype.com'
2020
DEFAULT_API_BASE_PATH = '/api/v1/'
2121

fixtures/analytics_autoselects.yaml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
interactions:
2-
- request:
3-
body: ''
4-
headers:
5-
Content-Type: [application/json]
6-
X-Swiftype-Client: elastic-app-search-python
7-
X-Swiftype-Client-Version: 2.0.0
8-
method: GET
9-
uri: http://localhost:3000/api/v1/engines/api-test/analytics/autoselects.json?auth_token=a-test-api-key
10-
response:
11-
body: {string: '[["2014-01-06",0],["2014-01-05",0],["2014-01-04",0],["2014-01-03",0],["2014-01-02",0],["2014-01-01",0],["2013-12-31",0],["2013-12-30",0],["2013-12-29",0],["2013-12-28",0],["2013-12-27",0],["2013-12-26",0],["2013-12-25",0],["2013-12-24",0],["2013-12-23",0]]'}
12-
headers: {}
13-
status: {code: 200, message: OK}
2+
- request:
3+
body: ""
4+
headers:
5+
Content-Type: [application/json]
6+
X-Swiftype-Client: elastic-site-search-python
7+
X-Swiftype-Client-Version: 2.0.0
8+
method: GET
9+
uri: http://localhost:3000/api/v1/engines/api-test/analytics/autoselects.json?auth_token=a-test-api-key
10+
response:
11+
body:
12+
{
13+
string: '[["2014-01-06",0],["2014-01-05",0],["2014-01-04",0],["2014-01-03",0],["2014-01-02",0],["2014-01-01",0],["2013-12-31",0],["2013-12-30",0],["2013-12-29",0],["2013-12-28",0],["2013-12-27",0],["2013-12-26",0],["2013-12-25",0],["2013-12-24",0],["2013-12-23",0]]',
14+
}
15+
headers: {}
16+
status: { code: 200, message: OK }
1417
version: 1

fixtures/analytics_autoselects_pagination.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ interactions:
33
body: ''
44
headers:
55
Content-Type: [application/json]
6-
X-Swiftype-Client: elastic-app-search-python
6+
X-Swiftype-Client: elastic-site-search-python
77
X-Swiftype-Client-Version: 2.0.0
88
method: GET
99
uri: http://localhost:3000/api/v1/engines/api-test/analytics/autoselects.json?auth_token=a-test-api-key&start_date=2013-12-31&end_date=2014-01-01

fixtures/analytics_searches.yaml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
interactions:
2-
- request:
3-
body: ''
4-
headers:
5-
Content-Type: [application/json]
6-
X-Swiftype-Client: elastic-app-search-python
7-
X-Swiftype-Client-Version: 2.0.0
8-
method: GET
9-
uri: http://localhost:3000/api/v1/engines/api-test/analytics/searches.json?auth_token=a-test-api-key
10-
response:
11-
body: {string: '[["2014-01-06",0],["2014-01-05",0],["2014-01-04",0],["2014-01-03",0],["2014-01-02",0],["2014-01-01",0],["2013-12-31",0],["2013-12-30",0],["2013-12-29",0],["2013-12-28",0],["2013-12-27",0],["2013-12-26",0],["2013-12-25",0],["2013-12-24",0],["2013-12-23",0]]'}
12-
headers: {}
13-
status: {code: 200, message: OK}
2+
- request:
3+
body: ""
4+
headers:
5+
Content-Type: [application/json]
6+
X-Swiftype-Client: elastic-site-search-python
7+
X-Swiftype-Client-Version: 2.0.0
8+
method: GET
9+
uri: http://localhost:3000/api/v1/engines/api-test/analytics/searches.json?auth_token=a-test-api-key
10+
response:
11+
body:
12+
{
13+
string: '[["2014-01-06",0],["2014-01-05",0],["2014-01-04",0],["2014-01-03",0],["2014-01-02",0],["2014-01-01",0],["2013-12-31",0],["2013-12-30",0],["2013-12-29",0],["2013-12-28",0],["2013-12-27",0],["2013-12-26",0],["2013-12-25",0],["2013-12-24",0],["2013-12-23",0]]',
14+
}
15+
headers: {}
16+
status: { code: 200, message: OK }
1417
version: 1
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
interactions:
2-
- request:
3-
body: ''
4-
headers:
5-
Content-Type: [application/json]
6-
X-Swiftype-Client: elastic-app-search-python
7-
X-Swiftype-Client-Version: 2.0.0
8-
method: GET
9-
uri: http://localhost:3000/api/v1/engines/api-test/analytics/searches.json?auth_token=a-test-api-key&start_date=2013-12-31&end_date=2014-01-01
10-
response:
11-
body: {string: '[["2014-01-01",0],["2013-12-31",0]]'}
12-
headers: {}
13-
status: {code: 200, message: OK}
2+
- request:
3+
body: ""
4+
headers:
5+
Content-Type: [application/json]
6+
X-Swiftype-Client: elastic-site-search-python
7+
X-Swiftype-Client-Version: 2.0.0
8+
method: GET
9+
uri: http://localhost:3000/api/v1/engines/api-test/analytics/searches.json?auth_token=a-test-api-key&start_date=2013-12-31&end_date=2014-01-01
10+
response:
11+
body: { string: '[["2014-01-01",0],["2013-12-31",0]]' }
12+
headers: {}
13+
status: { code: 200, message: OK }
1414
version: 1
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
interactions:
2-
- request:
3-
body: ''
4-
headers:
5-
Content-Type: [application/json]
6-
X-Swiftype-Client: elastic-app-search-python
7-
X-Swiftype-Client-Version: 2.0.0
8-
method: GET
9-
uri: http://localhost:3000/api/v1/engines/api-test/analytics/top_no_result_queries_in_range.json?auth_token=a-test-api-key
10-
response:
11-
body: {string: '[["foo",2],["bar",1]]'}
12-
headers: {}
13-
status: {code: 200, message: OK}
2+
- request:
3+
body: ""
4+
headers:
5+
Content-Type: [application/json]
6+
X-Swiftype-Client: elastic-site-search-python
7+
X-Swiftype-Client-Version: 2.0.0
8+
method: GET
9+
uri: http://localhost:3000/api/v1/engines/api-test/analytics/top_no_result_queries_in_range.json?auth_token=a-test-api-key
10+
response:
11+
body: { string: '[["foo",2],["bar",1]]' }
12+
headers: {}
13+
status: { code: 200, message: OK }
1414
version: 1
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
interactions:
2-
- request:
3-
body: ''
4-
headers:
5-
Content-Type: [application/json]
6-
X-Swiftype-Client: elastic-app-search-python
7-
X-Swiftype-Client-Version: 2.0.0
8-
method: GET
9-
uri: http://localhost:3000/api/v1/engines/api-test/analytics/top_no_result_queries_in_range.json?auth_token=a-test-api-key&start_date=2013-12-31&end_date=2014-01-01
10-
response:
11-
body: {string: '[["foo",2],["bar",1]]'}
12-
headers: {}
13-
status: {code: 200, message: OK}
2+
- request:
3+
body: ""
4+
headers:
5+
Content-Type: [application/json]
6+
X-Swiftype-Client: elastic-site-search-python
7+
X-Swiftype-Client-Version: 2.0.0
8+
method: GET
9+
uri: http://localhost:3000/api/v1/engines/api-test/analytics/top_no_result_queries_in_range.json?auth_token=a-test-api-key&start_date=2013-12-31&end_date=2014-01-01
10+
response:
11+
body: { string: '[["foo",2],["bar",1]]' }
12+
headers: {}
13+
status: { code: 200, message: OK }
1414
version: 1

fixtures/analytics_top_queries.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
interactions:
2-
- request:
3-
body: ''
4-
headers:
5-
Content-Type: [application/json]
6-
X-Swiftype-Client: elastic-app-search-python
7-
X-Swiftype-Client-Version: 2.0.0
8-
method: GET
9-
uri: http://localhost:3000/api/v1/engines/api-test/analytics/top_queries.json?auth_token=a-test-api-key
10-
response:
11-
body: {string: '[["dostoyevsky",2],["gatsby",1]]'}
12-
headers: {}
13-
status: {code: 200, message: OK}
2+
- request:
3+
body: ""
4+
headers:
5+
Content-Type: [application/json]
6+
X-Swiftype-Client: elastic-site-search-python
7+
X-Swiftype-Client-Version: 2.0.0
8+
method: GET
9+
uri: http://localhost:3000/api/v1/engines/api-test/analytics/top_queries.json?auth_token=a-test-api-key
10+
response:
11+
body: { string: '[["dostoyevsky",2],["gatsby",1]]' }
12+
headers: {}
13+
status: { code: 200, message: OK }
1414
version: 1
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
interactions:
2-
- request:
3-
body: ''
4-
headers:
5-
Content-Type: [application/json]
6-
X-Swiftype-Client: elastic-app-search-python
7-
X-Swiftype-Client-Version: 2.0.0
8-
method: GET
9-
uri: http://localhost:3000/api/v1/engines/api-test/analytics/top_queries_in_range.json?auth_token=a-test-api-key&start_date=2013-12-31&end_date=2014-01-01
10-
response:
11-
body: {string: '[["dostoyevsky",2],["gatsby",1]]'}
12-
headers: {}
13-
status: {code: 200, message: OK}
2+
- request:
3+
body: ""
4+
headers:
5+
Content-Type: [application/json]
6+
X-Swiftype-Client: elastic-site-search-python
7+
X-Swiftype-Client-Version: 2.0.0
8+
method: GET
9+
uri: http://localhost:3000/api/v1/engines/api-test/analytics/top_queries_in_range.json?auth_token=a-test-api-key&start_date=2013-12-31&end_date=2014-01-01
10+
response:
11+
body: { string: '[["dostoyevsky",2],["gatsby",1]]' }
12+
headers: {}
13+
status: { code: 200, message: OK }
1414
version: 1
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
interactions:
2-
- request:
3-
body: ''
4-
headers:
5-
Content-Type: [application/json]
6-
X-Swiftype-Client: elastic-app-search-python
7-
X-Swiftype-Client-Version: 2.0.0
8-
method: GET
9-
uri: http://localhost:3000/api/v1/engines/api-test/analytics/top_queries.json?per_page=10&auth_token=a-test-api-key&page=2
10-
response:
11-
body: {string: '[["dostoyevsky",2],["gatsby",1]]'}
12-
headers: {}
13-
status: {code: 200, message: OK}
2+
- request:
3+
body: ""
4+
headers:
5+
Content-Type: [application/json]
6+
X-Swiftype-Client: elastic-site-search-python
7+
X-Swiftype-Client-Version: 2.0.0
8+
method: GET
9+
uri: http://localhost:3000/api/v1/engines/api-test/analytics/top_queries.json?per_page=10&auth_token=a-test-api-key&page=2
10+
response:
11+
body: { string: '[["dostoyevsky",2],["gatsby",1]]' }
12+
headers: {}
13+
status: { code: 200, message: OK }
1414
version: 1

fixtures/crawl_domain.yaml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
interactions:
2-
- request:
3-
body: '{"url": "http://crawler-demo-site.herokuapp.com/2012/01/01/first-post.html"}'
4-
headers:
5-
Content-Type: [application/json]
6-
X-Swiftype-Client: elastic-app-search-python
7-
X-Swiftype-Client-Version: 2.0.0
8-
method: PUT
9-
uri: http://localhost:3000/api/v1/engines/crawler-demo/domains/52c754fb3ae7406fd3000001/crawl_url.json?auth_token=a-test-api-key
10-
response:
11-
body: {string: '{"external_id":"9508ace2e1ba669854eb49fbe9429952ff1a6d4c","url":"http://crawler-demo-site.herokuapp.com/2012/01/01/first-post.html"}'}
12-
headers: {}
13-
status: {code: 200, message: OK}
2+
- request:
3+
body: '{"url": "http://crawler-demo-site.herokuapp.com/2012/01/01/first-post.html"}'
4+
headers:
5+
Content-Type: [application/json]
6+
X-Swiftype-Client: elastic-site-search-python
7+
X-Swiftype-Client-Version: 2.0.0
8+
method: PUT
9+
uri: http://localhost:3000/api/v1/engines/crawler-demo/domains/52c754fb3ae7406fd3000001/crawl_url.json?auth_token=a-test-api-key
10+
response:
11+
body:
12+
{
13+
string: '{"external_id":"9508ace2e1ba669854eb49fbe9429952ff1a6d4c","url":"http://crawler-demo-site.herokuapp.com/2012/01/01/first-post.html"}',
14+
}
15+
headers: {}
16+
status: { code: 200, message: OK }
1417
version: 1

fixtures/create_document.yaml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
interactions:
2-
- request:
3-
body: '{"document": {"external_id": "doc_id"}}'
4-
headers:
5-
Content-Type: [application/json]
6-
X-Swiftype-Client: elastic-app-search-python
7-
X-Swiftype-Client-Version: 2.0.0
8-
method: POST
9-
uri: http://localhost:3000/api/v1/engines/api-test/document_types/books/documents.json?auth_token=a-test-api-key
10-
response:
11-
body: {string: '{"external_id":"doc_id","engine_id":"52c73e443ae7403ec900001e","document_type_id":"52c742b63ae7401cb6000004","id":"52cb1f823ae7403ec900003e","_id":"52cb1f823ae7403ec900003e","updated_at":"2014-01-06T21:26:26Z"}'}
12-
headers: {}
13-
status: {code: 200, message: OK}
2+
- request:
3+
body: '{"document": {"external_id": "doc_id"}}'
4+
headers:
5+
Content-Type: [application/json]
6+
X-Swiftype-Client: elastic-site-search-python
7+
X-Swiftype-Client-Version: 2.0.0
8+
method: POST
9+
uri: http://localhost:3000/api/v1/engines/api-test/document_types/books/documents.json?auth_token=a-test-api-key
10+
response:
11+
body:
12+
{
13+
string: '{"external_id":"doc_id","engine_id":"52c73e443ae7403ec900001e","document_type_id":"52c742b63ae7401cb6000004","id":"52cb1f823ae7403ec900003e","_id":"52cb1f823ae7403ec900003e","updated_at":"2014-01-06T21:26:26Z"}',
14+
}
15+
headers: {}
16+
status: { code: 200, message: OK }
1417
version: 1

fixtures/create_document_type.yaml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
interactions:
2-
- request:
3-
body: '{"document_type": {"name": "videos"}}'
4-
headers:
5-
Content-Type: [application/json]
6-
X-Swiftype-Client: elastic-app-search-python
7-
X-Swiftype-Client-Version: 2.0.0
8-
method: POST
9-
uri: http://localhost:3000/api/v1/engines/api-test/document_types.json?auth_token=a-test-api-key
10-
response:
11-
body: {string: '{"id":"52cb1ee93ae7403ec900003c","name":"videos","slug":"videos","engine_id":"52c73e443ae7403ec900001e","updated_at":"2014-01-06T21:23:53Z","document_count":0,"field_mapping":{}}'}
12-
headers: {}
13-
status: {code: 200, message: OK}
2+
- request:
3+
body: '{"document_type": {"name": "videos"}}'
4+
headers:
5+
Content-Type: [application/json]
6+
X-Swiftype-Client: elastic-site-search-python
7+
X-Swiftype-Client-Version: 2.0.0
8+
method: POST
9+
uri: http://localhost:3000/api/v1/engines/api-test/document_types.json?auth_token=a-test-api-key
10+
response:
11+
body:
12+
{
13+
string: '{"id":"52cb1ee93ae7403ec900003c","name":"videos","slug":"videos","engine_id":"52c73e443ae7403ec900001e","updated_at":"2014-01-06T21:23:53Z","document_count":0,"field_mapping":{}}',
14+
}
15+
headers: {}
16+
status: { code: 200, message: OK }
1417
version: 1

fixtures/create_documents.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
interactions:
2-
- request:
3-
body: '{"documents": [{"external_id": "doc_id1"}, {"external_id": "doc_id2"}]}'
4-
headers:
5-
Content-Type: [application/json]
6-
X-Swiftype-Client: elastic-app-search-python
7-
X-Swiftype-Client-Version: 2.0.0
8-
method: POST
9-
uri: http://localhost:3000/api/v1/engines/api-test/document_types/books/documents/bulk_create.json?auth_token=a-test-api-key
10-
response:
11-
body: {string: '[true,true]'}
12-
headers: {}
13-
status: {code: 200, message: OK}
2+
- request:
3+
body: '{"documents": [{"external_id": "doc_id1"}, {"external_id": "doc_id2"}]}'
4+
headers:
5+
Content-Type: [application/json]
6+
X-Swiftype-Client: elastic-site-search-python
7+
X-Swiftype-Client-Version: 2.0.0
8+
method: POST
9+
uri: http://localhost:3000/api/v1/engines/api-test/document_types/books/documents/bulk_create.json?auth_token=a-test-api-key
10+
response:
11+
body: { string: "[true,true]" }
12+
headers: {}
13+
status: { code: 200, message: OK }
1414
version: 1

fixtures/create_domain.yaml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
interactions:
2-
- request:
3-
body: '{"domain": {"submitted_url": "http://www.example.com"}}'
4-
headers:
5-
Content-Type: [application/json]
6-
X-Swiftype-Client: elastic-app-search-python
7-
X-Swiftype-Client-Version: 2.0.0
8-
method: POST
9-
uri: http://localhost:3000/api/v1/engines/crawler-demo/domains.json?auth_token=a-test-api-key
10-
response:
11-
body: {string: '{"id":"52cb2a8a3ae7403ec9000047","engine_id":"52c74ea83ae7403ec9000032","submitted_url":"http://www.example.com","start_crawl_url":"http://www.example.com/","crawling":false,"document_count":0,"updated_at":"2014-01-06T22:13:30Z"}'}
12-
headers: {}
13-
status: {code: 200, message: OK}
2+
- request:
3+
body: '{"domain": {"submitted_url": "http://www.example.com"}}'
4+
headers:
5+
Content-Type: [application/json]
6+
X-Swiftype-Client: elastic-site-search-python
7+
X-Swiftype-Client-Version: 2.0.0
8+
method: POST
9+
uri: http://localhost:3000/api/v1/engines/crawler-demo/domains.json?auth_token=a-test-api-key
10+
response:
11+
body:
12+
{
13+
string: '{"id":"52cb2a8a3ae7403ec9000047","engine_id":"52c74ea83ae7403ec9000032","submitted_url":"http://www.example.com","start_crawl_url":"http://www.example.com/","crawling":false,"document_count":0,"updated_at":"2014-01-06T22:13:30Z"}',
14+
}
15+
headers: {}
16+
status: { code: 200, message: OK }
1417
version: 1

0 commit comments

Comments
 (0)