Overview
The standard QueryRequest and QueryResponse model have been simplified to make this API easier to work with in a JavaScript-only environment as opposed to porting over the full Java-based object model. Query requests can be created either by using the existing CGI-query string syntax (but pointing to a different servlet than our existing REST API) or by creating a JSON query request object, below, and posting it to server.
Required Modules
These features require that the rest module be included when you run createproject
to create your Attivio project.
REST API Parameters
The master list of QueryRequest REST parameters is located on the HTTP REST APIs page.
View incoming links.
Endpoint URIs
URL | METHOD | Input | Output |
---|---|---|---|
http://yourAieHost:17000/rest/searchApi/search | POST | Simplified JSON Query Request | Simplified JSON Query Response |
http://yourAieHost:17000/rest/searchApi/simpleCgi | GET | HTTP REST API CGI parameters | Simplified JSON Query Response |
http://yourAieHost:17000/rest/searchApi/legacyCgi | GET | HTTP REST API CGI parameters | Standard/Legacy XML Query Response |
http://yourAieHost:17000/rest/searchApi/viewSampleRequest | GET | Simplified JSON Query Request |
Admin UI
With the REST module added to your project, the "Debug Search" page in the Admin UI will have a new option labeled Output Format as shown below:
Simplified JSON Query Request
This is an example of a Simplified JSON Query Request.
{ "workflow": "search", "query": "*:*", "queryLanguage": "advanced", "locale": "en", "rows": 10, "filters": [ "author:me", "OR(title:c*, title:d*)" ], "facets": [ "cat", "date" ], "facetFilters": [ { "name": "Language", "label": "English", "filter": "language:FACET(English)" } ], "sort": [ "date:DESC" ], "fields": [ ".id", "title", "text", "date", "SCOPETEASER(text) as scopeTeaser" ], "username": "me", "realm": "myrealm", "restParams": { "zones": [ "default" ], "offset": [ 10 ], "highlight": [ "true" ], "abcEnabled": [ "true" ], "searchProfile": [ "attivio" ], "includeMetadataInResponse": [ "true" ] }, "relevancyModel": { "name": "default", "defaultSearchField": { "defaultBoost": 100, "proximityMode": "DEFAULT", "fieldNorms": true, "termBoosts": [ { "field": "title", "boost": 200, "norms": true, "mode": "TFIDF" }, { "field": "anchortext", "boost": 200, "norms": true, "mode": "TFIDF" } ], "phraseBoosts": [ { "field": "title", "boost": 300, "norms": true, "mode": "TFIDF" }, { "field": "anchortext", "boost": 300, "norms": true, "mode": "TFIDF" } ], "completenessBoosts": [ { "field": "title", "boost": 1000, "norms": true, "mode": "TFIDF" }, { "field": "anchortext", "boost": 1000, "norms": true, "mode": "TFIDF" } ], "proximityBoosts": [], "scoreMode": "TFIDF" }, "staticBoosts": [ { "field": "linkfactor", "normalization": 1 } ], "fields": [], "freshness": { "field": "date", "decay": 0.085, "resolution": "HOURS", "normalization": 1 } } }
Parameter | Required | Default | Description |
---|---|---|---|
workflow | search | The query workflow with which to process the query | |
query | The query to execute | ||
queryLanguage | advanced | The query language to use for the query (simple or advanced ). | |
locale | The locale to use for all linguistic processing of the query | ||
rows | 10 | The number of search results (documents) to return for this query | |
filters | A list of queries in Advanced Query Language syntax; only results passing these filters will be returned | ||
facets | A list of facet requests. For examples of complex facet requests see Discrete Facets. | ||
facetFilters | A list of facet filters. Each facet filter represents a facet bucket that is being used to refine the result set. | ||
relevancyModel | The relevancy model to use for the query. | ||
sort | A list of sort expressions used for ordering the query's results | ||
fields | * | A list of schema fields or field expressions to be returned for each matching document in the result set | |
username | The username/ID of the Content Security principal to set for the query request | ||
realm | The realm of the Content Security principal to set for the query request | ||
restParams | A map of Key to List of values for legacy REST API query parameters, which are parsed according to the standard CGI argument parsing. Note that you must specify whether a parameter is single-valued or multiple-valued for every parameter. As every value specified for the key is extracted and set, if multiple values are specified for a single-valued parameter, the last value specified takes effect. |
Attivio Business Center-Specific Query Request Parameters
Parameter | Required | Default | Description |
---|---|---|---|
abc.enabled | Yes, if searchProfile parameter is set. | false | A flag that tells AIE that this query request must be enabled for search using Business Center rules. |
searchProfile | No | The name of the search profile to use for triggering Business Center rules under that searchProfile. |
You must set abc.enabled = true
if you are setting a value for searchProfile
.
Simplified JSON Query Response
{ "totalTime": 21, "totalHits": 2, "documents": [ { "fields": { "title": [ "Document 1 title" ], "date": [ 20000 ], ".id": [ "doc1" ] }, "children": null }, { "fields": { "title": [ "Document 2 title" ], "date": [ 20000 ], ".id": [ "doc2" ] }, "children": null } ], "facets": [ { "label": "Category", "field": "cat", "buckets": [ { "value": "cat1", "count": 1, "filter": "cat:FACET(cat1)" }, { "value": "cat2", "count": 1, "filter": "cat:FACET(cat2)" } ] }, { "label": "size", "field": "size", "buckets": [ { "value": 150, "count": 1, "filter": "size:FACET(150)" }, { "value": 120, "count": 1, "filter": "size:FACET(120)" } ], "statistics": { "count": 2, "sum": 270, "min": 120, "max": 150, "mean": 135, "midpoint": 135, "stdev": 21.213203435596427, "var": 450 } } ], "feedback": [ { "messageName": "myMessage", "stageName": "Stage1", "message": "This is a feedback message", "properties": { "prop1": "val1" } } ], "placements": [ { "label": "my placement label", "linkUrl": "link uri1", "linkText": "my link text", "imageUrl": "imgeUrl1", "markup": "some markup <a href=\"here\">here</a>" } ] }
By default, printed output is not formatted as above, To format output as shown, install a JSON pretty-print plugin for your browser.
Parameter | Description |
---|---|
documents | Any array of document objects |
documents.children | A list of child documents created as a result of a JOIN query |
documents.fields | Name to List of values for the field. Strings, Dates, and number types are supported. |
facets | A list of facet responses |
facets.buckets | A list of buckets for the facet |
facets.buckets.count | The number of documents for this query that are a part of this bucket |
facets.buckets.filter | An advanced query string that can be used to filter the current result set wit the facet bucket |
facets.buckets.label | An optional display label to represent the bucket in the UI. Typically only available for filter based facet requests and range facets. |
facets.buckets.max | The max value for the bucket's range (only available for range facets) |
facets.buckets.min | The min value for the bucket's range (only available for range facets) |
facets.buckets.value | The value for the bucket. |
facets.label | The label to use in the UI representing a single facet. This is often time the field name of the field being faceted on |
facets.statistics | Statistics for a facet (if available, for numeric fields only) |
facets.statistics.count | Sum of count for all buckets |
facets.statistics.max | Maximum value for all values in facet field. |
facets.statistics.mean | Average value for field |
facets.statistics.midpoint | Midpoint between minimum and maximum value. |
facets.statistics.min | Minimum value for all values in facet field. |
facets.statistics.stdev | Standard deviation for all values in facet field. |
facets.statistics.sum | Sum of all values in facet field. |
facets.statistics.var | Statistical variance for all values in facet field. |
feedback | List of feedback messages from the server |
feedback.message | The user visible text of the message to display |
feedback.message.properties | A String to String map of properties for the message |
feedback.messageName | The name of the message |
feedback.stageName | The stage that generated the message |
placements | Placements added by the Attivio Business Center |
placements.imageUrl | The image for the placement |
placements.label | The label for the placement |
placements.linkText | The text for the placement's link |
placements.linkUrl | The link for the placement |
placements.markup | Any HTML markup associated with the placement |
totalHits | The total number of hits found for this query |
totalTime | The total amount of time in ms it took to process the query |