sunnyContactTokenizer top-level property

SearchTermBuilder<ISunnyContact> sunnyContactTokenizer
final

Implementation

final SearchTermBuilder<ISunnyContact> sunnyContactTokenizer = (contact) {
  final tokens = <FTSToken>[];
  tokens.addToken(contact.firstName!, _fnToken);
  tokens.addToken(contact.lastName!, _lnToken);
  tokens.addToken(contact.fullName!, _nmToken);
  tokens.addToken(contact.companyName!, _coToken);
  tokens.addToken(contact.title!, _jtToken);

  if (contact.firstName.isNotNullOrBlank && contact.lastName.isNotNullOrBlank) {
    tokens.addToken("${contact.lastName}, ${contact.firstName}", _nmToken);
  }

  tokens.addNamed(_emToken, contact.identities!.expand((identity) => identity.emails!).map((email) => email.email));
  tokens.addNamed(_phToken,
      contact.identities!.expand((identity) => identity.phones!).expand((phone) => sd.tokenizePhoneNumber(phone.number)));
  return tokens;
};