Product Selector

Fusion 5.9
    Fusion 5.9

    Use metadata tags to refine search results

    Web data source metadata tags can be ingested as fields. The examples here show how metadata tags can be used to refine search results.

    Facet with metadata tags

    Using the browse endpoint, this example has a music lessons website send a request to see all pages with a count of the metadata tags for faceting. The request contains field names for the instrument type and player competency levels. The response includes a count for each of the facet values found.

    Use the facets request parameter and pass the page.metatags.METADATA_NAME to get back the counts of metadata tags for faceting. This example includes fieldList to simplify the results to only show the specified metadata tag fields.

    Request

    {
       "sessionId": "864782f0-af36-4dee-8430-9e73d6006eaa",
       "utcOffset": "-05:00",
       "fieldList":["page.metatags.instrument","page.metatags.difficulty"],
       "facets": ["page.metatags.instrument","page.metatags.difficulty"]
    }

    Response

    {   "queryId": "fd110486-f168-47c0-a419-1518a4840589",
        "hits": 43,
        "docs": [
            {   "type": "page",
                "id": "441eb3be-7de6-470a-8141-e416a15c7db1-6a092bd4-5098-466c-94aa-40bf68294303-68708807657148371333355819934570439731",
                "rank": 1,
                "datasourceLabels": [],
                "fields": {
                    "page.metatags.instrument": "piano",
                    "page.metatags.difficulty": "beginner"
                }},
            {   "type": "page",
                "id": "441eb3be-7de6-470a-8141-e416a15c7db1-6a092bd4-5098-466c-94aa-40bf68294303-68708807657148371333355819934570439731",
                "rank": 1,
                "datasourceLabels": [],
                "fields": {
                    "page.metatags.instrument": "guitar",
                    "page.metatags.difficulty": "advanced"
                }},
    ...
        ],
        "facets": {
            "field": {
                "page.metatags.difficulty": {
                    "missing": 5,
                    "counts": [
                        {
                            "name": "beginner",
                            "count": 20
                        },
                        {
                            "name": "advanced",
                            "count": 18
                        }]},
                "page.metatags.instrument": {
                    "missing": 96,
                    "counts": [
                        {
                            "name": "guitar",
                            "count": 26
                        },
                        {
                            "name": "piano",
                            "count": 12
                        }]}
    }}}

    Filter with metadata tags

    When you know the facets, you can use them to apply a filter to display selected results. A reader for a music lessons website only wants to see advanced music lessons. Using the browse endpoint, this example has a music lessons website send a request to see all advanced lessons for piano.

    Use the filters request parameter and pass the page.metatags.METADATA_NAME and values to filter the search results. This example includes fieldList to simplify the results to only show the specified metadata tag fields.

    Request

    {
       "sessionId": "864782f0-af36-4dee-8430-9e73d6006eaa",
       "utcOffset": "-05:00",
       "fieldList":["page.metatags.instrument","page.metatags.difficulty"],
       "facets": ["page.metatags.instrument","page.metatags.difficulty"],
       "filters": [
       {"field": "page.metatags.difficulty", "values": ["advanced"]},
       {"field": "page.metatags.instrument", "values": ["piano"]}
       ],
       "debug": true
    }

    Response

    {
        "queryId": "{placeholderQueryId}",
        "hits": 4,
        "docs": [
            {   "type": "page",
                "id": "{placeholderDocumentId}",
                "rank": 1,
                "datasourceLabels": [],
                "fields": {
                    "page.metatags.instrument": " piano",
                    "page.metatags.difficulty": " advanced"}
            },
            {   "type": "page",
                "id": "{placeholderDocumentId}",
                "rank": 1,
                "datasourceLabels": [],
                "fields": {
                    "page.metatags.instrument": " piano",
                    "page.metatags.difficulty": " advanced"}
            },
            {   "type": "page",
                "id": "{placeholderDocumentId}",
                "rank": 1,
                "datasourceLabels": [],
                "fields": {
                    "page.metatags.instrument": " piano",
                    "page.metatags.difficulty": " advanced"}
            },
            {   "type": "page",
                "id": "{placeholderDocumentId}",
                "rank": 1,
                "datasourceLabels": [],
                "fields": {
                    "page.metatags.instrument": " piano",
                    "page.metatags.difficulty": " advanced"}
            }
    ]}