Page tree
Skip to end of metadata
Go to start of metadata

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

URLMETHODInputOutput
http://yourAieHost:17000/rest/searchApi/searchPOSTSimplified JSON Query RequestSimplified JSON Query Response
http://yourAieHost:17000/rest/searchApi/simpleCgiGETHTTP REST API CGI parametersSimplified JSON Query Response
http://yourAieHost:17000/rest/searchApi/legacyCgiGETHTTP REST API CGI parametersStandard/Legacy XML Query Response
http://yourAieHost:17000/rest/searchApi/viewSampleRequestGET 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
    }
  }
}
ParameterRequiredDefaultDescription
workflow searchThe query workflow with which to process the query
query(tick) The query to execute
queryLanguage advancedThe query language to use for the query (simple or advanced).
locale  The locale to use for all linguistic processing of the query
rows 10The 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

ParameterRequiredDefaultDescription
abc.enabledYes, if searchProfile parameter is set.falseA flag that tells AIE that this query request must be enabled for search using Business Center rules.
searchProfileNo
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

Document
{
  "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.

 

 

ParameterDescription
documentsAny array of document objects
documents.childrenA list of child documents created as a result of a JOIN query
documents.fieldsName to List of values for the field. Strings, Dates, and number types are supported.
facetsA list of facet responses
facets.bucketsA list of buckets for the facet
facets.buckets.countThe number of documents for this query that are a part of this bucket
facets.buckets.filterAn advanced query string that can be used to filter the current result set wit the facet bucket
facets.buckets.labelAn optional display label to represent the bucket in the UI. Typically only available for filter based facet requests and range facets.
facets.buckets.maxThe max value for the bucket's range (only available for range facets)
facets.buckets.minThe min value for the bucket's range (only available for range facets)
facets.buckets.valueThe value for the bucket.
facets.labelThe label to use in the UI representing a single facet. This is often time the field name of the field being faceted on
facets.statisticsStatistics for a facet (if available, for numeric fields only)
facets.statistics.countSum of count for all buckets
facets.statistics.maxMaximum value for all values in facet field.
facets.statistics.meanAverage value for field
facets.statistics.midpointMidpoint between minimum and maximum value.
facets.statistics.minMinimum value for all values in facet field.
facets.statistics.stdevStandard deviation for all values in facet field.
facets.statistics.sumSum of all values in facet field.
facets.statistics.varStatistical variance for all values in facet field.
feedbackList of feedback messages from the server
feedback.messageThe user visible text of the message to display
feedback.message.propertiesA String to String map of properties for the message
feedback.messageNameThe name of the message
feedback.stageName
The stage that generated the message
placementsPlacements added by the Attivio Business Center
placements.imageUrlThe image for the placement
placements.labelThe label for the placement
placements.linkTextThe text for the placement's link
placements.linkUrlThe link for the placement
placements.markupAny HTML markup associated with the placement
totalHitsThe total number of hits found for this query
totalTimeThe total amount of time in ms it took to process the query