-
Notifications
You must be signed in to change notification settings - Fork 17
Search example
Thomas Don Gallon edited this page Feb 26, 2016
·
17 revisions
The scope is not passed in time variable in the body of the request. It is now specified through the url of the request. For example :
- ALL : POST /common/search
- MOVIE : POST /movie/search
- PERSON : POST /person/search
- SCOPE : ALL
- URL : POST /common/search
Request :
{
"criteria": "string"
}
Response :
{
"groups": [
{
"Persons": [
{
"code": 105159,
"fullname": "Kristen Bell",
"sex": "F"
},
{
"code": 1305,
"fullname": "Christopher Lee",
"sex": "M",
}
]
},
{
"Movies": [
{
"code": 136230,
"title": "Star Wars: The Clone Wars",
"titleSortOnly": "Star Wars: The Clone Wars",
"movieType": "Long-métrage",
"productionYear": 2008
}
]
}
],
"facets": [
{
"FCT_SCOPE": [
{
"Persons": 2
},
{
"Movies": 1
}
]
}
],
"totalCount": 3
}
- SCOPE : MOVIE
- URL : POST /movie/search
Request without facets and grouping :
{
"criteria": "star wars",
"facets": {}
}
Request with facets and without grouping :
{
"criteria": "star wars",
"facets": { "FCT_MOVIE_TYPE": "Long-métrage" }
}
Request with facets and grouping :
{
{
"criteria": "star wars",
"facets": { "FCT_MOVIE_TYPE": "Long-métrage" },
"group": "FCT_MOVIE_TITLE"
}
Response :
{
list: [ ...people... ],
facets: {
'FCT_PEOPLE_TITLE': {
'f': 200,
'm': 275
},
'FCT_PEOPLE_PROFESSION': {
'composer': 46,
'actor': 355,
'producer': 74
}
},
totalCount: 475
}
Request :
{
criteria: {
query: 'test',
scope: 'PEOPLE'
},
facets: {},
group: 'FCT_PEOPLE_PROFESSION'
}
Response without groups :
{
"list": [
{
"code": 136230,
"title": "Star Wars: The Clone Wars",
"titleSortOnly": "Star Wars: The Clone Wars",
"movieType": "Long-métrage",
"productionYear": 2008
}
],
"facets": [
{
"FCT_MOVIE_TYPE": [
{
"Long-métrage": 1
}
]
},
{
"FCT_MOVIE_TITLE": [
{
"#": 0
},
{
"a-f": 0
},
{
"g-m": 0
},
{
"n-s": 1
},
{
"t-z": 0
}
]
},
{
"FCT_MOVIE_YEAR": [
{
"< années 30": 0
},
{
"années 30": 0
},
{
"années 40": 0
},
{
"années 50": 0
},
{
"années 60": 0
},
{
"années 70": 0
},
{
"années 80": 0
},
{
"années 90": 0
},
{
"années 2000": 1
},
{
"> années 2010": 0
}
]
}
],
"totalCount": 1
}
Response with groups:
{
"groups": [
{
"#": []
},
{
"a-f": []
},
{
"g-m": []
},
{
"n-s": [
{
"code": 136230,
"title": "Star Wars: The Clone Wars",
"titleSortOnly": "Star Wars: The Clone Wars",
"movieType": "Long-métrage",
"productionYear": 2008
}
]
},
{
"t-z": []
}
],
"facets": [
{
"FCT_MOVIE_TYPE": [
{
"Long-métrage": 1
}
]
},
{
"FCT_MOVIE_TITLE": [
{
"#": 0
},
{
"a-f": 0
},
{
"g-m": 0
},
{
"n-s": 1
},
{
"t-z": 0
}
]
},
{
"FCT_MOVIE_YEAR": [
{
"< années 30": 0
},
{
"années 30": 0
},
{
"années 40": 0
},
{
"années 50": 0
},
{
"années 60": 0
},
{
"années 70": 0
},
{
"années 80": 0
},
{
"années 90": 0
},
{
"années 2000": 1
},
{
"> années 2010": 0
}
]
}
],
"totalCount": 1
}
Those parameters are transmitted using query parameters :
-
sortFieldName
- sort field name
-
sortDesc
-
true
for descending order -
false
for ascending order
-
-
skip
- number of items to skip (used for pagination)
The service expected by the AdvancedSearch
component must have this structure :
const service = {
scoped(config) {
/* config.urlData : URL parameters */
/* config.data : message body */
},
unscoped(config) {
/* config.urlData : URL parameters */
/* config.data : message body */
}
}