6

I'm trying to write some xConnect search functionality that will search through all identifiers of all contacts.

SOLR is running and I have added a set of sample contacts using the xConnect API.

This code executes as expected and finds a contact based on a twitter source:

using (var client = new XConnectClient(config))
{    
    var reference = new IdentifiedContactReference("twitter", "Twitter1");

    Task<Contact> contactTask = client.GetAsync<Contact>(reference, new ContactExpandOptions() { });

    Contact contact = await contactTask;
}

However code below doesn't return any contacts (and I would expect it to based on the above):

using (var client = new XConnectClient(config))
{    
    var queryable = client.Contacts.Where(x => x.Identifiers.Any(y => y.Identifier == "Twitter1")).GetBatchEnumerator(10);

    var enumerator = await queryable;

    while (await enumerator.MoveNext())
    {
        if (enumerator.Current != null)
        {
            foreach (var contact in enumerator.Current)
            {
                // process each contact
            }
        }
    }
}

This code is an attempt to match the string "Twitter1" to any identifier source, not just a twitter source. If anyone knows what I might be doing wrong or another way of approaching this I'd be very grateful for some advice.

3
  • 1
    And if you try to change your query to something like this y.Source == "twitter"? Do you see any results? I think that the Identifier is PIISensitive or nonindexable field and that's why it won't work. Just an assumption, need to decompile code. Maybe you are facing similar problem as this one -> sitecore.stackexchange.com/questions/11308/… Commented Jun 15, 2018 at 17:24
  • Yes, you're correct - identifiers are PII sensitive.
    – grg
    Commented Jun 15, 2018 at 17:54
  • You might want to go into work around mode, ideas: 1) XConnect plugin that maps any identifier to a single identifier (ignoring duplicates while doing that) 2) XConnect plug-in that stores all sources somewhere else and then you can generate a query that use get by identifier trying all the different sources
    – eglasius
    Commented Jun 19, 2018 at 19:33

1 Answer 1

4

Contact Identifiers are considered PII sensitive and are not indexed by default. To enable indexing of PII sensitive data, set IndexPIISensitiveData to true for xConnect index worker which is typically installed under xConnect website. Configuration file to update: App_data\jobs\continuous\IndexWorker\App_data\Config\Sitecore\sc.Xdb.Collection.IndexerSettings.xml or patch the setting by creating a patch file.

Also see the note about identifiers in the official documentation.

As Peter Prochazka wrote in the comment - be aware of GDPR requirements when indexing PII sensitive data, i.e. get user consent before storing any PII data. In case you need more context about GDPR in Sitecore 9, this document might be a good start.

2
  • 1
    Don't forget that in terms of GDPR you need to have consent from your users to index these sensitive information as you are effectively processing their personal data. So be precautious turning this to true to solve your problem... Commented Jun 15, 2018 at 18:29
  • Yes, good point. I will update the answer.
    – grg
    Commented Jun 15, 2018 at 19:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.