Query Profiles API

The Query Profiles API allows users to manage query profiles. Query profiles allow users to change query pipelines during search time while pointing the search toward a static endpoint. This gives flexibility to test different stage combinations without reconfiguration. For information, see Query Profiles.

Create, List, Update or Delete a Query Profile

The path for this request is:

/api/apollo/collections/<collectionName>/query-profiles/<profileName>

where <collectionName> is the name of an specific collection and<profileName> is the name of a new or existing profile.

  • GET - returns the details of the profile, or all profiles for the collection is profile name is not specified.

  • PUT - create a new profile or update an existing one. No response returned.

  • DELETE - remove the profile. No response returned.

Use a Profile to Run a Query

`GET /api/apollo/collections/collection/query-profiles/alias/handler?key=value `

`POST /api/apollo/collections/collection/query-profiles/alias/handler?key=value `

where <collectionName> is the name of an specific collection, <profileName> is the name of a query profile, and <handler> is a Solr request handler, e.g. "select" and<solrQuery> is any valid Solr query.

If the length of your query exceeds normal GET limitations, then the query can be sent as the body of the POST request.

This returns a standard Solr response containing the documents requested in the format requested. The output will vary depending on how the query pipeline has been configured. For example, if a Facets stage has been added to the query pipeline, the response will include facet information.

Examples

Create a profile named 'testProfile' for the 'docs' collection and associate it with the pipeline named 'docs-default':

REQUEST

curl -u user:pass -X PUT -H 'Content-type: application/json' -d '"docs-default"' http://localhost:8764/api/apollo/collections/docs/query-profiles/testProfile

RESPONSE

None.

Query for the term 'title:fusion' in the 'docs' collection, using the profile named 'newProfile':

INPUT

curl -u user:pass http://localhost:8764/api/apollo/collections/docs/query-profiles/newProfile/select?q=title:fusion&wt=json&fl=title

Note that we have also added a few other query parameters, such as 'wt=json' to get the results in JSON format, and 'fl=title' to only retrieve document titles.

OUTPUT

{
    "response": {
        "numFound": 85,
        "start": 0,
        "docs": [
            {
                "title": [
                    "Fusion Services - Fusion Documentation - Lucidworks"
                ]
            },
            {
                "title": [
                    "Lucidworks Fusion Documentation - Fusion Documentation - Lucidworks"
                ]
            },
            {
                "title": [
                    "Installation - Fusion Documentation - Lucidworks"
                ]
            },
            {
                "title": [
                    "Searching - Fusion Documentation - Lucidworks"
                ]
            },
            {
                "title": [
                    "Collections - Fusion Documentation - Lucidworks"
                ]
            },
            {
                "title": [
                    "Recommendations - Fusion Documentation - Lucidworks"
                ]
            },
            {
                "title": [
                    "Connectors - Fusion Documentation - Lucidworks"
                ]
            },
            {
                "title": [
                    "Reporting - Fusion Documentation - Lucidworks"
                ]
            },
            {
                "title": [
                    "Schedules - Fusion Documentation - Lucidworks"
                ]
            },
            {
                "title": [
                    "Profiles - Fusion Documentation - Lucidworks"
                ]
            }
        ]
    },
    "responseHeader": {
        "status": 0,
        "QTime": 1,
        "params": {
            "facet": "true",
            "fl": "title",
            "lw.pipelineId": "docs-default",
            "q": "title:fusion",
            "wt": "json",
            "defType": "edismax",
            "rows": "10"
        }
    }
}