SearchDocument
>=
4.9.6
Interface Function
Search document based on query criteria
Request Parameter
Parameter Type Required Remarks string False Required if call API by signature QueryKeyword string True Query keyword, allow empty string SearchCodeArray List<string>
True the Binding Search Codes of the App FilterConditions List<FilterCondition>
False Filtering criteria SortConditions List<QuerySort>
False Query Sort conditions PageIndex int False Page No for search result, starts from 1. Default value:1 PageSize int False Records amount in one page. Default value:10
FilterCondition
Parameter Type Remarks Field string Field name for filtering Operator string Operation performed during filtering. Enum value: [Equal], [NotEqual] Values List<string>
Filter values Type string Filter type. Enum value: [Terms], [RDate], [Range], dealing with string, datetime and number type SubFilters List<FilterCondition>
Sub level filtering criteria
SortSetting
Parameter Type Remarks SortFieldName string Field name in Elasticsearch index mapping for sorting DisplayField string Display name for sorting IsAscending bool Sorting direction, default order: descending [warning] warning
Range of
PageIndex
: Greater than 0. Set as default value 1 if invalid.Range of
PageSize
: Greater than 0. Set as default value 10 if invalid.
SearchCodeArray
: input at least one valid Search Code value.Only [Terms] type support cascading filtering, and 3 levels at most so far.
For [RDate] and [Range] filtering fields, the values are strings with structure like {RangeFrom}-{RangeTo}, the results will include the items which match the RangeForm value but not match RangTo value, date format for [RDate] value is dd/MM/yyyy. Another, RangeTo value could be empty. E.g., "01/01/2022-31/12/2022", "01/01/2022-", "100-120", "100-".
Return Data Type
Parameter Type Remark statusCode int The result status code. 200 when succeeded info string The message of the result data PerformElasticSearchResult[]
Returned data collection.
PerformElasticSearchResult
Parameter Type Remarks Total int Total search record count TotalPage int Total page number RecordPerPage int Records amount in one page ResultList List<IDictionary<string,object>>
Search result detail StatisticResult Statisticresult[]
Statistic result detail QuerySortCondition Querysortcondition[]
Sort conditions StatisticGroupSeparator string Statistic group separator StatisticValueSeparator string Statistic value separator SearchCode string Search Code
Statisticresult
Parameter Type Remarks Value string Aggregated values Count int Statistic count based on value ESName string Aggregated field in Elasticsearch index mapping SubTitle string Aggregation display name for sub statistic result Mapping MappingModel[]
Mapping model array From string Range from value in numric format To string Range to value in numric format FromAsString string Range from value in string format ToAsString string Range to value in string format DropDownTypeName string Statistic type. DisplayName string Aggregation display name UnitName string Unit name UnitValue string Unit value DisplayField string Display field in Elasticsearch index mapping MaxRangeValue string Range max value MinRangeValue string Range min value MinDocValue int Least document threshold for statistic
MappingModel
Parameter Type Remarks Value string Aggregated values Count int Statistic count based on value ESName string Aggregated field in Elasticsearch index mapping SubTitle string Aggregation display name for sub statistic result Mapping object[]
Mapping object array From string Range from value in numric format To string Range to value in numric format FromAsString string Range from value in string format ToAsString string Range to value in string format DropDownTypeName string Statistic type. DisplayName string Aggregation display name UnitName string Unit name UnitValue string Unit value DisplayField string Display field in Elasticsearch index mapping MaxRangeValue string Range max value MinRangeValue string Range min value MinDocValue int Least document threshold for statistic
Querysortcondition
Parameter Type Remarks QuerySortLst Querysortlst[]
Sort setting
Querysortlst
Parameter Type Remarks SortFieldName string Field name in Elasticsearch index mapping for sorting DisplayField string Display name for sorting IsAscending bool Sorting direction, default order: descending
Input Sample
Input at least one Search Code in SearchCodeArray:
{ "Email": "someone@test.com", "QueryKeyword": "明朝", "SearchCodeArray": [ "valid_search_code", "invalid_search_code" ], "FilterConditions": [{ "Field": "category.keyword", "Operator": "Equal", "Values": ["humanity"], "Type":"Terms", "SubFilters":[] }, { "Field": "price", "Operator": "Equal", "Values": ["20-80"], "Type":"Range", "SubFilters":[] }, { "Field": "C4-ModifyDate", "Operator": "Equal", "Values": ["11/06/2022-"], "Type":"RDate", "SubFilters":[] }], "SortConditions": [{ "SortFieldName": "name.keyword", "DisplayField": "name", "IsAscending": true }], "PageIndex": 1, "PageSize": 10 }
Return Sample
{
"StatusCode": 200,
"Info": "Request (or process) succeeded",
"Data": [
{
"Total": 2,
"TotalPage": 1,
"RecordPerPage": 10,
"ResultList": [
{
"Title": "明朝那些事儿 3",
"author": "当年明月",
"Price": "36",
"DataSource": "Data Source Name",
"NoNotesExternalSourceURL": "https://digitalmakerhost/tenant/appcode/vForm/book/preview/69c833eaf3264025a9ed7255deec4896",
"Type": "Documents",
"category": [
"humanity"
]
},
{
"Title": "明朝那些事儿 4",
"author": "当年明月",
"Price": "35",
"DataSource": "Data Source Name",
"NoNotesExternalSourceURL": "https://digitalmakerhost/tenant/appcode/vForm/book/preview/a26c3b29ab7c4be2a6c0776f70f0f88a",
"Type": "Documents",
"category": [
"humanity"
]
}
],
"StatisticResult": [
{
"Value": "",
"Count": 2,
"ESName": "",
"SubTitle": "P_DataType",
"Mapping": [
{
"Value": "Documents",
"Count": 2,
"ESName": "P_DataType",
"SubTitle": "",
"Mapping": [],
"From": "",
"To": "",
"FromAsString": "",
"ToAsString": "",
"DropDownTypeName": "",
"DisplayName": "",
"UnitName": "",
"UnitValue": "",
"DisplayField": "",
"MaxRangeValue": "",
"MinRangeValue": "",
"MinDocValue": 0
}
],
"From": "",
"To": "",
"FromAsString": "",
"ToAsString": "",
"DropDownTypeName": "Simpledropdown",
"DisplayName": "P_DataType",
"UnitName": "",
"UnitValue": "",
"DisplayField": "P_DataType",
"MaxRangeValue": "",
"MinRangeValue": "",
"MinDocValue": 0
}
],
"QuerySortCondition": [
{
"QuerySortLst": [
{
"SortFieldName": "name.keyword",
"DisplayField": "name",
"IsAscending": true
}
]
}
],
"StatisticGroupSeparator": "||",
"StatisticValueSeparator": "__",
"SearchCode": "valid_search_code"
},
{
"ErrorFlag": true,
"ErrorMsg": "No config file found for invalid_search_code",
"SearchCode": "invalid_search_code"
}
]
}
Input Sample
Input invalid parameters:
{ "Email": "someone@test.com", "QueryKeyword": "test", "SearchCodeArray": [] }
Return Sample
{
"StatusCode": 400,
"Info": "Request parameters are incomplete or incorrect",
"Data": null
}
Input Sample
There is no valid Search Code:
{ "Email": "someone@test.com", "QueryKeyword": "test", "SearchCodeArray": ["invalid_search_code"] }
Return Sample
{
"StatusCode": 500,
"Info": "System error",
"Data": [
{
"ErrorFlag": true,
"ErrorMsg": "No config file found for invalid_search_code",
"SearchCode": "invalid_search_code"
}
]
}