No results when searching for contacts on facet value












6















I'm trying to query contacts based on their e-mail value using xConnect, but my query doesn't return any results:



var queryable = client.Contacts
.Where(c => c.GetFacet<EmailAddressList>(EmailAddressList.DefaultFacetKey).PreferredEmail.SmtpAddress == email)
.WithExpandOptions(new ContactExpandOptions(PersonalInformation.DefaultFacetKey, EmailAddressList.DefaultFacetKey));

var enumerator = queryable.GetBatchEnumeratorSync(50);


However, when I just check if the SmtpAddress isn't empty, it does return results. The only downside is that I then have to search through all those contacts after retrieving them in-memory which is, let's say, kind of a performace hog (my local SQL Server instance is still churning away as I'm typing this):



var queryable = client.Contacts
.Where(c => c.GetFacet<EmailAddressList>(EmailAddressList.DefaultFacetKey).PreferredEmail.SmtpAddress != string.empty)
.WithExpandOptions(new ContactExpandOptions(PersonalInformation.DefaultFacetKey, EmailAddressList.DefaultFacetKey));

var enumerator = queryable.GetBatchEnumeratorSync(50);

while (enumerator.MoveNext())
{
foreach (var contact in enumerator.Current.Where(c => c.GetFacet<EmailAddressList>(EmailAddressList.DefaultFacetKey).PreferredEmail.SmtpAddress == email))
{...}
}


The e-mail address I'm looking for is definitely in the set of contacts as I can find it just fine with the second method, retrieving all contacts with a non-empty e-mail address and using the .Where() line from the first method when iterating on the batch result.



So what's the difference here, why can't I search for a string ìn the query?










share|improve this question



























    6















    I'm trying to query contacts based on their e-mail value using xConnect, but my query doesn't return any results:



    var queryable = client.Contacts
    .Where(c => c.GetFacet<EmailAddressList>(EmailAddressList.DefaultFacetKey).PreferredEmail.SmtpAddress == email)
    .WithExpandOptions(new ContactExpandOptions(PersonalInformation.DefaultFacetKey, EmailAddressList.DefaultFacetKey));

    var enumerator = queryable.GetBatchEnumeratorSync(50);


    However, when I just check if the SmtpAddress isn't empty, it does return results. The only downside is that I then have to search through all those contacts after retrieving them in-memory which is, let's say, kind of a performace hog (my local SQL Server instance is still churning away as I'm typing this):



    var queryable = client.Contacts
    .Where(c => c.GetFacet<EmailAddressList>(EmailAddressList.DefaultFacetKey).PreferredEmail.SmtpAddress != string.empty)
    .WithExpandOptions(new ContactExpandOptions(PersonalInformation.DefaultFacetKey, EmailAddressList.DefaultFacetKey));

    var enumerator = queryable.GetBatchEnumeratorSync(50);

    while (enumerator.MoveNext())
    {
    foreach (var contact in enumerator.Current.Where(c => c.GetFacet<EmailAddressList>(EmailAddressList.DefaultFacetKey).PreferredEmail.SmtpAddress == email))
    {...}
    }


    The e-mail address I'm looking for is definitely in the set of contacts as I can find it just fine with the second method, retrieving all contacts with a non-empty e-mail address and using the .Where() line from the first method when iterating on the batch result.



    So what's the difference here, why can't I search for a string ìn the query?










    share|improve this question

























      6












      6








      6








      I'm trying to query contacts based on their e-mail value using xConnect, but my query doesn't return any results:



      var queryable = client.Contacts
      .Where(c => c.GetFacet<EmailAddressList>(EmailAddressList.DefaultFacetKey).PreferredEmail.SmtpAddress == email)
      .WithExpandOptions(new ContactExpandOptions(PersonalInformation.DefaultFacetKey, EmailAddressList.DefaultFacetKey));

      var enumerator = queryable.GetBatchEnumeratorSync(50);


      However, when I just check if the SmtpAddress isn't empty, it does return results. The only downside is that I then have to search through all those contacts after retrieving them in-memory which is, let's say, kind of a performace hog (my local SQL Server instance is still churning away as I'm typing this):



      var queryable = client.Contacts
      .Where(c => c.GetFacet<EmailAddressList>(EmailAddressList.DefaultFacetKey).PreferredEmail.SmtpAddress != string.empty)
      .WithExpandOptions(new ContactExpandOptions(PersonalInformation.DefaultFacetKey, EmailAddressList.DefaultFacetKey));

      var enumerator = queryable.GetBatchEnumeratorSync(50);

      while (enumerator.MoveNext())
      {
      foreach (var contact in enumerator.Current.Where(c => c.GetFacet<EmailAddressList>(EmailAddressList.DefaultFacetKey).PreferredEmail.SmtpAddress == email))
      {...}
      }


      The e-mail address I'm looking for is definitely in the set of contacts as I can find it just fine with the second method, retrieving all contacts with a non-empty e-mail address and using the .Where() line from the first method when iterating on the batch result.



      So what's the difference here, why can't I search for a string ìn the query?










      share|improve this question














      I'm trying to query contacts based on their e-mail value using xConnect, but my query doesn't return any results:



      var queryable = client.Contacts
      .Where(c => c.GetFacet<EmailAddressList>(EmailAddressList.DefaultFacetKey).PreferredEmail.SmtpAddress == email)
      .WithExpandOptions(new ContactExpandOptions(PersonalInformation.DefaultFacetKey, EmailAddressList.DefaultFacetKey));

      var enumerator = queryable.GetBatchEnumeratorSync(50);


      However, when I just check if the SmtpAddress isn't empty, it does return results. The only downside is that I then have to search through all those contacts after retrieving them in-memory which is, let's say, kind of a performace hog (my local SQL Server instance is still churning away as I'm typing this):



      var queryable = client.Contacts
      .Where(c => c.GetFacet<EmailAddressList>(EmailAddressList.DefaultFacetKey).PreferredEmail.SmtpAddress != string.empty)
      .WithExpandOptions(new ContactExpandOptions(PersonalInformation.DefaultFacetKey, EmailAddressList.DefaultFacetKey));

      var enumerator = queryable.GetBatchEnumeratorSync(50);

      while (enumerator.MoveNext())
      {
      foreach (var contact in enumerator.Current.Where(c => c.GetFacet<EmailAddressList>(EmailAddressList.DefaultFacetKey).PreferredEmail.SmtpAddress == email))
      {...}
      }


      The e-mail address I'm looking for is definitely in the set of contacts as I can find it just fine with the second method, retrieving all contacts with a non-empty e-mail address and using the .Where() line from the first method when iterating on the batch result.



      So what's the difference here, why can't I search for a string ìn the query?







      xconnect






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 21 at 8:11









      Mark-DanneyMark-Danney

      355110




      355110






















          1 Answer
          1






          active

          oldest

          votes


















          3














          This is not working because of PIISensitive Attribute :



          [PIISensitive]
          public string SmtpAddress
          {
          get;
          set;
          }


          Solution:
          In order to enable searching by this sensitive information, you need to enable indexing of this kind of facets (decorated with [PIISensitive] facet).



          You need to set “true” in IndexPIISensitiveData setting in XConnect SearchIndexer settings.



          You need to rebuild xDB search index afterwards to make changes visible and therefore email facet searchable.



          Peter Prochazka wrote a nice blogpost regarding same issue:
          https://tothecore.sk/2018/06/21/searching-contacts-by-email-with-xconnect-in-sitecore-9/






          share|improve this answer


























          • Sadly, from that very article: "This solution is obviously not usable in scenario where you want to be complaint with GDPR [...]", which we do.

            – Mark-Danney
            Mar 21 at 9:08












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "664"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsitecore.stackexchange.com%2fquestions%2f17601%2fno-results-when-searching-for-contacts-on-facet-value%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          This is not working because of PIISensitive Attribute :



          [PIISensitive]
          public string SmtpAddress
          {
          get;
          set;
          }


          Solution:
          In order to enable searching by this sensitive information, you need to enable indexing of this kind of facets (decorated with [PIISensitive] facet).



          You need to set “true” in IndexPIISensitiveData setting in XConnect SearchIndexer settings.



          You need to rebuild xDB search index afterwards to make changes visible and therefore email facet searchable.



          Peter Prochazka wrote a nice blogpost regarding same issue:
          https://tothecore.sk/2018/06/21/searching-contacts-by-email-with-xconnect-in-sitecore-9/






          share|improve this answer


























          • Sadly, from that very article: "This solution is obviously not usable in scenario where you want to be complaint with GDPR [...]", which we do.

            – Mark-Danney
            Mar 21 at 9:08
















          3














          This is not working because of PIISensitive Attribute :



          [PIISensitive]
          public string SmtpAddress
          {
          get;
          set;
          }


          Solution:
          In order to enable searching by this sensitive information, you need to enable indexing of this kind of facets (decorated with [PIISensitive] facet).



          You need to set “true” in IndexPIISensitiveData setting in XConnect SearchIndexer settings.



          You need to rebuild xDB search index afterwards to make changes visible and therefore email facet searchable.



          Peter Prochazka wrote a nice blogpost regarding same issue:
          https://tothecore.sk/2018/06/21/searching-contacts-by-email-with-xconnect-in-sitecore-9/






          share|improve this answer


























          • Sadly, from that very article: "This solution is obviously not usable in scenario where you want to be complaint with GDPR [...]", which we do.

            – Mark-Danney
            Mar 21 at 9:08














          3












          3








          3







          This is not working because of PIISensitive Attribute :



          [PIISensitive]
          public string SmtpAddress
          {
          get;
          set;
          }


          Solution:
          In order to enable searching by this sensitive information, you need to enable indexing of this kind of facets (decorated with [PIISensitive] facet).



          You need to set “true” in IndexPIISensitiveData setting in XConnect SearchIndexer settings.



          You need to rebuild xDB search index afterwards to make changes visible and therefore email facet searchable.



          Peter Prochazka wrote a nice blogpost regarding same issue:
          https://tothecore.sk/2018/06/21/searching-contacts-by-email-with-xconnect-in-sitecore-9/






          share|improve this answer















          This is not working because of PIISensitive Attribute :



          [PIISensitive]
          public string SmtpAddress
          {
          get;
          set;
          }


          Solution:
          In order to enable searching by this sensitive information, you need to enable indexing of this kind of facets (decorated with [PIISensitive] facet).



          You need to set “true” in IndexPIISensitiveData setting in XConnect SearchIndexer settings.



          You need to rebuild xDB search index afterwards to make changes visible and therefore email facet searchable.



          Peter Prochazka wrote a nice blogpost regarding same issue:
          https://tothecore.sk/2018/06/21/searching-contacts-by-email-with-xconnect-in-sitecore-9/







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 21 at 14:27









          Bartłomiej Mucha

          1,001320




          1,001320










          answered Mar 21 at 8:28









          Vlad IobagiuVlad Iobagiu

          13.6k21034




          13.6k21034













          • Sadly, from that very article: "This solution is obviously not usable in scenario where you want to be complaint with GDPR [...]", which we do.

            – Mark-Danney
            Mar 21 at 9:08



















          • Sadly, from that very article: "This solution is obviously not usable in scenario where you want to be complaint with GDPR [...]", which we do.

            – Mark-Danney
            Mar 21 at 9:08

















          Sadly, from that very article: "This solution is obviously not usable in scenario where you want to be complaint with GDPR [...]", which we do.

          – Mark-Danney
          Mar 21 at 9:08





          Sadly, from that very article: "This solution is obviously not usable in scenario where you want to be complaint with GDPR [...]", which we do.

          – Mark-Danney
          Mar 21 at 9:08


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Sitecore Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsitecore.stackexchange.com%2fquestions%2f17601%2fno-results-when-searching-for-contacts-on-facet-value%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

          ComboBox Display Member on multiple fields

          Is it possible to collect Nectar points via Trainline?