at the end of the day, it was inevitable

This commit is contained in:
Mo Elzubeir
2022-12-09 08:36:26 -06:00
commit 1218570914
1768 changed files with 887087 additions and 0 deletions
@@ -0,0 +1,188 @@
Feature: Use 'Article Date' advanced filter
As an authenticated user
I should be able to use 'Article Date' for filtering search results
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' which appears in documents from US and use `Article Date`
advanced filters with value '31 Days'.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"articleDate": "31 Days"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('source', field('country', 'US')),
field('published', gte('#now().modify(\"- 31 Days\").format(\"c\")#'))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"articleDate": "31 Days"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"articleDate": "31 Days"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('source', field('country', 'US')),
field('published', gte('#now().modify(\"- 31 Days\").format(\"c\")#'))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"articleDate": "31 Days"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
And database don't has entity CacheBundle:Query\SimpleQuery
| id | 5 |
| raw | cat |
@db-fixtures
Scenario:
I search 'cat' which appears in documents from US and also use `Article Date`
advanced filters with empty value.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"articleDate": ""
}
}
"""
Then I got response with code 400
And it's contains
"""
{
"errors": "@array@"
}
"""
And database don't has entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' which appears in documents from US and use `Article Date`
advanced filters with invalid value.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"articleDate": "111"
}
}
"""
Then I got response with code 400
And it's contains
"""
{
"errors": "@array@"
}
"""
And database don't has entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
@@ -0,0 +1,198 @@
Feature: Use 'Article Language' advanced filter
As an authenticated user
I should be able to use 'Article Language' for filtering search results
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' and use `Article Language` advanced filters with value
'en'.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"articleLanguage": "en"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('language', 'en')
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"articleLanguage": "en"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"articleLanguage": "en"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('language', 'en')
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"articleLanguage": "en"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
And database don't has entity CacheBundle:Query\SimpleQuery
| id | 5 |
| raw | cat |
@db-fixtures
Scenario:
I search 'cat' and use `Article Language` advanced filters with empty
value.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"articleLanguage": ""
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(entity('CacheBundle:Document', 'document, id'))",
"count": "@integer@",
"totalCount": "@integer@",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"articleLanguage": ""
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' and use `Article Language` advanced filters with invalid
value.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"articleLanguage": "some"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": [],
"count": 0,
"totalCount": 0,
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"articleLanguage": "some"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
@@ -0,0 +1,240 @@
Feature: Use 'Author' advanced filter
As an authenticated user
I should be able to use 'Author' for filtering search results
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' which appears in documents from US and use `Author`
advanced filters with value 'Gracie Pfeffer'.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"author": "Gracie Pfeffer"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('source', field('country', 'US')),
field('author', field('name', 'Gracie Pfeffer'))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"author": "Gracie Pfeffer"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"author": "Gracie Pfeffer"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('source', field('country', 'US')),
field('author', field('name', 'Gracie Pfeffer'))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"author": "Gracie Pfeffer"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
And database don't has entity CacheBundle:Query\SimpleQuery
| id | 5 |
| raw | cat |
@db-fixtures
Scenario:
I search 'cat' which appears in documents from US and use `Author`
advanced filters with empty value.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"author": ""
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('source', field('country', 'US'))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"author": ""
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' which appears in documents from US and use `Author`
advanced filters with invalid value.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"author": "some"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": [],
"count": 0,
"totalCount": 0,
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"author": "some"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
@@ -0,0 +1,198 @@
Feature: Use 'Publisher' advanced filter
As an authenticated user
I should be able to use 'Publisher' for filtering search results
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' and use `Publisher` advanced filters with value 'msnbc'.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"publisher": "msnbc"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('publisher', contains('msnbc', true))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"publisher": "msnbc"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"publisher": "msnbc"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('publisher', contains('msnbc', true))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"publisher": "msnbc"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
And database don't has entity CacheBundle:Query\SimpleQuery
| id | 5 |
| raw | cat |
@db-fixtures
Scenario:
I search 'cat' and use `Publisher` advanced filters with empty value.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"publisher": ""
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id')
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"publisher": ""
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' and use `Publisher` advanced filters with invalid value.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"publisher": "some"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": [],
"count": 0,
"totalCount": 0,
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"publisher": "some"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
@@ -0,0 +1,154 @@
Feature: Use 'Reach' advanced filter
As an authenticated user
I should be able to use 'Reach' for filtering search results
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' and use `Reach` advanced filters with value '10000+'.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"reach": "10000+"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('views', greaterThan(10000), lowerThan(25000))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"reach": "10000+"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"reach": "10000+"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('views', greaterThan(10000), lowerThan(25000))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"reach": "10000+"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
And database don't has entity CacheBundle:Query\SimpleQuery
| id | 5 |
| raw | cat |
@db-fixtures
Scenario:
I search 'cat' and use `Reach` advanced filters with empty value.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"reach": ""
}
}
"""
Then I got response with code 400
And it's contains
"""
{
"errors": "@array@"
}
"""
And database don't has entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' and use `Reach` advanced filters with invalid value.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"reach": "111"
}
}
"""
Then I got response with code 400
And it's contains
"""
{
"errors": "@array@"
}
"""
And database don't has entity CacheBundle:Query\SimpleQuery
| id | 3 |
| raw | cat |
@@ -0,0 +1,246 @@
Feature: Use 'Source' advanced filter
As an authenticated user
I should be able to use 'Source' for filtering search results
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' which appears in documents from US and after it add `source`
advanced filters with value 'CNN'.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"source": "CNN"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('source',
field('country', 'US'),
field('title', 'CNN')
)
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"source": "CNN"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"source": "CNN"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('source',
field('country', 'US'),
field('title', 'CNN')
)
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"source": "CNN"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
And database don't has entity CacheBundle:Query\SimpleQuery
| id | 5 |
| raw | cat |
@db-fixtures
Scenario:
I search 'cat' which appears in documents from US and after it add `source`
advanced filters with empty value.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"source": ""
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('source',
field('country', 'US')
)
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"source": ""
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
@db-fixtures
Scenario:
I search 'cat' and use `Source` advanced filters with unknown value.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"source": "some"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": [],
"count": 0,
"totalCount": 0,
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {
"source": "some"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
@@ -0,0 +1,198 @@
Feature: Use 'Source City' advanced filter
As an authenticated user
I should be able to use 'Source City' for filtering search results
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' and use `Source City` advanced filters with value 'Arizona'.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"sourceCity": "Amazing City"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('source', field('city', 'Amazing City'))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"sourceCity": "Amazing City"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"sourceCity": "Amazing City"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('source', field('city', 'Amazing City'))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"sourceCity": "Amazing City"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
And database don't has entity CacheBundle:Query\SimpleQuery
| id | 5 |
| raw | cat |
@db-fixtures
Scenario:
I search 'cat' and use `Source City` advanced filters with empty value.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"sourceCity": ""
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id')
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"sourceCity": ""
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' and after it add `sourceCity` advanced filters with invalid
value.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"sourceCity": "some"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": [],
"count": 0,
"totalCount": 0,
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"sourceCity": "some"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
@@ -0,0 +1,197 @@
Feature: Use 'Source Country' advanced filter
As an authenticated user
I should be able to use 'Source Country' for filtering search results
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' and use `Source Country` advanced filters with value 'US'.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"sourceCountry": "US"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('source', field('country', 'US'))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"sourceCountry": "US"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"sourceCountry": "US"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('source', field('country', 'US'))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"sourceCountry": "US"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
And database don't has entity CacheBundle:Query\SimpleQuery
| id | 5 |
| raw | cat |
@db-fixtures
Scenario:
I search 'cat' and use `Source Country` advanced filters with empty value.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"sourceCountry": ""
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id')
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"sourceCountry": ""
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' use `Source Country` advanced filters with invalid value.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"sourceCountry": "some"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": [],
"count": 0,
"totalCount": 0,
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"sourceCountry": "some"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
@@ -0,0 +1,197 @@
Feature: Use 'Source Section' advanced filter
As an authenticated user
I should be able to use 'Source Section' for filtering search results
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' and use `Source Section` advanced filters with value 'Lifestyle'.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"sourceSection": "Lifestyle"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('source', field('section', 'Lifestyle'))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"sourceSection": "Lifestyle"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"sourceSection": "Lifestyle"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('source', field('section', 'Lifestyle'))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"sourceSection": "Lifestyle"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
And don't has entity CacheBundle:Query\SimpleQuery
| id | 5 |
| raw | cat |
@db-fixtures
Scenario:
I search 'cat' and use `Source Section` advanced filters with empty value.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"sourceSection": ""
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id')
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"sourceSection": ""
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' and use `Source Section` advanced filters with invalid value.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"sourceSection": "some"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": [],
"count": 0,
"totalCount": 0,
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"sourceSection": "some"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
@@ -0,0 +1,197 @@
Feature: Use 'Source State' advanced filter
As an authenticated user
I should be able to use 'Source State' for filtering search results
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' and use `Source State` advanced filters with value 'Arizona'.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"sourceState": "Arizona"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('source', field('state', 'Arizona'))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"sourceState": "Arizona"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"sourceState": "Arizona"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('source', field('state', 'Arizona'))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"sourceState": "Arizona"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
And don't has entity CacheBundle:Query\SimpleQuery
| id | 5 |
| raw | cat |
@db-fixtures
Scenario:
I search 'cat' and use `Source State` advanced filters with empty value.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"sourceState": ""
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id')
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"sourceState": ""
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' and use `Source State` advanced filters with invalid value.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"advancedFilters": {
"sourceState": "some"
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": [],
"count": 0,
"totalCount": 0,
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {
"sourceState": "some"
}
},
"sources": [],
"sourceLists": []
}
}
"""
And database has 1 entity CacheBundle:Query\SimpleQuery
| id | 4 |
| raw | cat |
@@ -0,0 +1,207 @@
Feature: Use 'Country' filter
As an authenticated user
I should be able to use 'Country' for filtering search results
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' which appears in documents with US language.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"country": {
"include": [ "US" ]
}
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('source', field('country', 'US'))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"country": {
"include": [ "US" ]
}
},
"advancedFilters": {}
},
"sources": [],
"sourceLists": []
}
}
"""
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' which appears in documents not with US language.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"country": {
"exclude": [ "US" ]
}
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
not(field('source', field('country', 'US')))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"country": {
"exclude": [ "US" ]
}
},
"advancedFilters": {}
},
"sources": [],
"sourceLists": []
}
}
"""
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' which appears in documents with US and RU languages.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"country": {
"include": [ "US", "RU" ]
}
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('source', oneOf(
field('country', 'US'),
field('country', 'RU')
))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"country": {
"include": [ "US", "RU" ]
}
},
"advancedFilters": {}
},
"sources": [],
"sourceLists": []
}
}
"""
Scenario:
I search 'cat' which appears in documents with unknown language.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"country": {
"include": [ "unknown" ]
}
}
}
"""
Then I got response with code 400
And it's contains
"""
{
"errors": "@array@"
}
"""
Scenario:
I search 'cat' which appears in documents not with unknown language.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"country": {
"exclude": [ "unknown" ]
}
}
}
"""
Then I got response with code 400
And it's contains
"""
{
"errors": "@array@"
}
"""
@@ -0,0 +1,255 @@
Feature: Use 'Date' filter
As an authenticated user
I should be able to use 'Date' for filtering search results
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' in documents which found maximum 10 days ago.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"date": {
"type": "last"
"days": 10
}
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
oneOf(
field('title', contains('cat', true)),
field('content', contains('cat', true))
),
field('published', gte('#now().modify(\"- 10 days\").format(\"c\")#'))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@"
}
"""
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' in documents which found between some period.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"date": {
"type": "between",
"start": "#now().modify(\"- 30 days\").format(\"Y-m-d\")#",
"end": "#now().modify(\"- 1 days\").format(\"Y-m-d\")#"
}
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
oneOf(
field('title', contains('cat', true)),
field('content', contains('cat', true))
),
field('published', between(
'#now().modify(\"- 30 days\").format(\"c\")#',
'#now().modify(\"- 1 days\").format(\"c\")#'
))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@"
}
"""
Scenario:
I search 'cat' in documents which filtered by date filter with invalid type.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"date": {
"type": "invalid"
}
}
}
"""
Then I got response with code 400
And it's contains
"""
{
"errors": "@array@"
}
"""
Scenario:
I search 'cat' in documents which filtered by date filter with 'last' type
but not provide 'days' field.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"date": {
"type": "last"
}
}
}
"""
Then I got response with code 400
And it's contains
"""
{
"errors": "@array@"
}
"""
Scenario Outline:
I search 'cat' in documents which filtered by date filter with 'last' type
but provide invalid 'days' values.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"date": {
"type": "last",
"days": <value>
}
}
}
"""
Then I got response with code 400
And it's contains
"""
{
"errors": "@array@"
}
"""
Examples:
| value |
| "invalid" |
| 0 |
| -10 |
Scenario:
I search 'cat' in documents which filtered by date filter with 'between' type
but not provide 'start' and 'end' values.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"date": {
"type": "between"
}
}
}
"""
Then I got response with code 400
And it's contains
"""
{
"errors": "@array@"
}
"""
Scenario Outline:
I search 'cat' in documents which filtered by date filter with 'between' type
but provide invalid 'start' and 'end' values.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"date": {
"type": "between",
"start": "<date>",
"end": "<date>"
}
}
}
"""
Then I got response with code 400
And it's contains
"""
{
"errors": "@array@"
}
"""
Examples:
| date |
| 2017-13-20 |
| some |
| 2017-01-40 |
Scenario:
I search 'cat' in documents which filtered by date filter with 'between' type
but provide 'start' greater than 'end'.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"date": {
"type": "between",
"start": "#now().modify(\"- 15 days\").format(\"Y-m-d\")#",
"end": "#now().modify(\"- 30 days\").format(\"Y-m-d\")#"
}
}
}
"""
Then I got response with code 400
And it's contains
"""
{
"errors": "@array@"
}
"""
@@ -0,0 +1,129 @@
Feature: Use 'Has Image' filter
As an authenticated user
I should be able to use 'Has Image' for filtering search results
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' which appears in documents which have image.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"hasImage": true
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('image', isNotEmpty())
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"hasImage": true
},
"advancedFilters": {}
},
"sources": [],
"sourceLists": []
}
}
"""
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' which appears in documents which is may have images.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"hasImage": false
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
oneOf(
field('image', isEmpty()),
field('image', isNotEmpty())
)
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"hasImage": false
},
"advancedFilters": {}
},
"sources": [],
"sourceLists": []
}
}
"""
Scenario Outline:
I search 'cat' which appears in documents which filtered by hasImage filters
with invalid value.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"hasImage": <value>
}
}
"""
Then I got response with code 400
And it's contains
"""
{
"errors": "@array@"
}
"""
Examples:
| value |
| "some" |
| 10 |
| "true" |
@@ -0,0 +1,344 @@
Feature: Use 'Headline' filter
As an authenticated user
I should be able to use 'Headline' for filtering search results
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat'.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
oneOf(
field('title', contains('cat', true)),
field('title', contains('dog', true)),
field('title', contains('fish', true)),
field('content', contains('cat', true)),
field('content', contains('dog', true)),
field('content', contains('fish', true))
)
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {},
"advancedFilters": {}
},
"sources": [],
"sourceLists": []
}
}
"""
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat', and also include 'dog' in headline.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"headline": {
"include": "dog"
}
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
oneOf(
field('title', contains('cat', true)),
field('content', contains('cat', true))
),
field('title',
contains('cat', true),
contains('dog', true)
)
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"headline": {
"include": "dog"
}
},
"advancedFilters": {}
},
"sources": [],
"sourceLists": []
}
}
"""
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' which not include 'cat' in headline.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"headline": {
"exclude": "cat"
}
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
oneOf(
field('title', contains('cat', true)),
field('content', contains('cat', true))
),
field('title',
not(contains('cat', true)),
contains('some', true)
),
field('content', contains('cat', true))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"headline": {
"exclude": "cat"
}
},
"advancedFilters": {}
},
"sources": [],
"sourceLists": []
}
}
"""
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' without 'dog' and 'fish' in headline.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"headline": {
"exclude": "dog, fish"
}
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
oneOf(
field('title', contains('cat', true)),
field('content', contains('cat', true))
),
field('title',
not(contains('dog', true)),
not(contains('fish', true))
)
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"headline": {
"exclude": "dog, fish"
}
},
"advancedFilters": {}
},
"sources": [],
"sourceLists": []
}
}
"""
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' with 'dog' but without 'fish' in headline.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"headline": {
"include": "dog",
"exclude": "fish"
}
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
oneOf(
field('title', contains('cat', true)),
field('content', contains('cat', true))
),
field('title',
contains('cat', true),
contains('dog', true),
not(contains('fish', true))
)
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"headline": {
"include": "dog",
"exclude": "fish"
}
},
"advancedFilters": {}
},
"sources": [],
"sourceLists": []
}
}
"""
@external-index-fixtures @db-fixtures
Scenario:
I search documents 'fish' without 'cat' in headline.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "fish",
"page": 1,
"filters": {
"headline": {
"exclude": "cat"
}
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
oneOf(
field('title', contains('fish', true)),
field('content', contains('fish', true))
),
field('title', not(contains('cat', true)))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "fish",
"filters": {
"headline": {
"exclude": "cat"
}
},
"advancedFilters": {}
},
"sources": [],
"sourceLists": []
}
}
"""
@@ -0,0 +1,168 @@
Feature: Use 'Language' filter
As an authenticated user
I should be able to use 'Language' for filtering search results
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' which appears in documents with english language.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"language": [ "en" ]
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('language', 'en')
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"language": [ "en" ]
},
"advancedFilters": {}
},
"sources": [],
"sourceLists": []
}
}
"""
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' which appears in documents with english and russian languages.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"language": [ "en", "ru" ]
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
oneOf(
field('language', 'en'),
field('language', 'ru')
)
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"language": [ "en", "ru" ]
},
"advancedFilters": {}
},
"sources": [],
"sourceLists": []
}
}
"""
Scenario:
I search 'cat' which appears in documents with unknown languages.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"language": [ "unknown" ]
}
}
"""
Then I got response with code 400
And it's contains
"""
{
"errors": "@array@"
}
"""
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' which appears in documents with empty language filters.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"language": [ ]
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id')
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"language": []
},
"advancedFilters": {}
},
"sources": [],
"sourceLists": []
}
}
"""
@@ -0,0 +1,207 @@
Feature: Use 'State' filter
As an authenticated user
I should be able to use 'State' for filtering search results
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' which appears in documents from state Arizona.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"state": {
"include": [ "AZ" ]
}
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('source', field('state', 'Arizona'))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"state": {
"include": [ "AZ" ]
}
},
"advancedFilters": {}
},
"sources": [],
"sourceLists": []
}
}
"""
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' which appears in documents not from state Arizona.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"state": {
"exclude": [ "AZ" ]
}
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
not(field('source', field('state', 'Arizona')))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"state": {
"exclude": [ "AZ" ]
}
},
"advancedFilters": {}
},
"sources": [],
"sourceLists": []
}
}
"""
@external-index-fixtures @db-fixtures
Scenario:
I search 'cat' which appears in documents not from Louisiana and Maryland.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"state": {
"include": [ "LA", "MD" ]
}
}
}
"""
Then I got successful response
And it's contains
"""
{
"documents": {
"data": "@array@.every(
entity('CacheBundle:Document', 'document, id'),
field('source', oneOf(
field('state', 'Louisiana'),
field('state', 'Maryland')
))
)",
"count": "@integer@.greaterThan(0)",
"totalCount": "@integer@.greaterThan(0)",
"page": 1,
"limit": 100
},
"advancedFilters": "@array@",
"stats": "@object@",
"meta": {
"type": "query",
"status": "synced",
"search": {
"query": "cat",
"filters": {
"state": {
"include": [ "LA", "MD" ]
}
},
"advancedFilters": {}
},
"sources": [],
"sourceLists": []
}
}
"""
Scenario:
I search 'cat' which appears in documents from unknown state.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"state": {
"include": [ "unknown" ]
}
}
}
"""
Then I got response with code 400
And it's contains
"""
{
"errors": "@array@"
}
"""
Scenario:
I search 'cat' which appears in documents not from unknown state.
Given I authenticated as test@email.com with password test
When I make POST request to /api/v1/query/search
"""
{
"query": "cat",
"page": 1,
"filters": {
"state": {
"exclude": [ "unknown" ]
}
}
}
"""
Then I got response with code 400
And it's contains
"""
{
"errors": "@array@"
}
"""