Reference Screen – Matching items that share facet values

For a demo at a client I try to set up the Reference Screen feature that is being used. In the case of the client there are documents that relate to each other based on mutual facet values. For instance, the documents would be annual reports and are being tagged by a client_name_true -facet. For the reference screen I would now like on opening up one annual report of a particular company (as in the client_name_true -facet) to suggest the annual report from other years for comparison. Following the docs I have trouble understanding how I would do that. So far I assume that the query -approach would be the way to go and my config looks as follows:

{
    "ref_types": [
        {
            "icon": "lightbulb",
            "ref_type": "reference2",
            "subtypes": [
                {
                    "query": "item.keywords.client_name_true == ref_item.keywords.client_name_true",
                    "ref_type": "reference2.mentions",
                    "title": "Same Client"
                }
            ],
            "title": "Reference Documents"
        },
    ]
}

Does anybody have good insights on how to achieve the matching described?

2 Likes

hey @thomas.moellers, I figured it out for your case you can use:

{
    "ref_types": [
        {
            "icon": "lightbulb",
            "ref_type": "reference2",
            "subtypes": [
                {
                    "query": "{%if item.keywords.client_name_true%}client_name_true:"{{ item.keywords.client_name_true[0] }}"{% endif %}",
                    "ref_type": "reference2.mentions",
                    "title": "Same Client"
                }
            ],
            "title": "Reference Documents"
        }
    ]
}

look at the query:
β€œ{%if item.keywords.client_name_true%}client_name_true:”{{ item.keywords.client_name_true[0] }}"{% endif %}"

it basically takes the keyword client_name_true. Because that is a list/array, we need to limit it to the first item. Since you likely have only one, that will do, otherwise we need to loop over them.

Then we take the value from the facet and define a facet specific search.

Lets say client_name_true = [β€œTeslaβ€œ] then the above will give you:

client_name_true:β€œTesla”

3 Likes