public override Dictionary <string, long> GetHighlightsOrder(Type cardType) { var dictionary = new Dictionary <string, long>(); if (cardType != null && typeof(IEmailMessageFullTextSearchObject) == cardType) { dictionary.Add(LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Subject), 100L); dictionary.Add(LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Text), 200L); } return(dictionary); }
public override Dictionary <string, Weight> GetWeightSearchFields(Type cardType) { var dictionary = new Dictionary <string, Weight>(); if (cardType != null && typeof(IEmailMessageFullTextSearchObject) == cardType) { dictionary.Add(LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Subject), Weight.High); dictionary.Add(LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Text), Weight.Medium); } return(dictionary); }
public override Dictionary <string, string> GetReverseMapping(Type cardType) { var dictionary = new Dictionary <string, string>(); if (cardType != null && typeof(IEmailMessageFullTextSearchObject) == cardType) { dictionary.Add(LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Subject), SR.T("Тема")); dictionary.Add(LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Text), SR.T("Тело")); } return(dictionary); }
public override List <string> GetHighlightFields(Type cardType) { if (cardType != null && typeof(IEmailMessageFullTextSearchObject) == cardType) { var list2 = new List <string>(); list2.Add(LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Subject)); list2.Add(LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Text)); return(list2); } return(new List <string>()); }
public override FilterList GetFilterFields(Type cardType, FullTextSearchResultModel searchModel) { if (cardType == null || typeof(IEmailMessageFullTextSearchObject) != cardType) { return(new FilterList()); } var filterList = new FilterList(); var emailMessageFullTextSearchResultModel = searchModel as EmailMessageFullTextSearchResultModel; if (emailMessageFullTextSearchResultModel != null && emailMessageFullTextSearchResultModel.TypeUid != Guid.Empty) { var classMetadata = MetadataLoader.LoadMetadata(emailMessageFullTextSearchResultModel.TypeUid) as ClassMetadata; if (classMetadata != null) { var list = (from c in MetadataLoader.GetChildClasses(classMetadata) where c != null select c).ToList(); list.Add(classMetadata); var list2 = new List <object>(); list2.AddRange(from c in list select c.Uid.ToString("n")); filterList.Add(new FilterListItem(LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.TypeUid), list2, FilterListItemType.Must, FullTextFieldType.String)); } } var emailMessageFullTextSearchResultModel2 = searchModel as EmailMessageFullTextSearchResultModel; if (emailMessageFullTextSearchResultModel2?.Contractor != null) { var contractorId = emailMessageFullTextSearchResultModel2.Contractor.Id; filterList.Add(new FilterListItem(LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Contractors), new List <object>() { contractorId }, FilterListItemType.Must, FullTextFieldType.Long)); } if (emailMessageFullTextSearchResultModel2?.Contact != null) { var contactId = emailMessageFullTextSearchResultModel2.Contact.Id; filterList.Add(new FilterListItem(LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Contacts), new List <object>() { contactId }, FilterListItemType.Must, FullTextFieldType.Long)); } filterList.Add(new FilterListItem(LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.IsDeleted), new List <object> { "false" }, FilterListItemType.Must, FullTextFieldType.String)); return(filterList); }
public override List <string> GetSearchFields(Type cardType, IEntityFilter filter) { if (cardType == null || typeof(IEmailMessageFullTextSearchObject) != cardType) { return(new List <string>()); } var searchFields = base.GetSearchFields(cardType); searchFields.AddRange(new List <string> { LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Subject), LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Text) }); return(searchFields); }
public override List <string> GetFields(Type cardType) { if (cardType == null || typeof(IEmailMessageFullTextSearchObject) != cardType) { return(new List <string>()); } var fields = base.GetFields(cardType); fields.AddRange(new List <string> { LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Text), LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Subject), LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.From), LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.To), LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Owners), LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Contractors), LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Contacts) }); return(fields); }
/// <inheritdoc /> public override List <QueueToIndex> ProcessingMergedIndexQueue(List <KeyValuePair <string, object> > mergedIndexQueueItem, long id, Guid typeUid) { var list = new List <QueueToIndex>(); if (mergedIndexQueueItem == null) { return(list); } var queueToIndex = new QueueToIndex { Id = id, CardType = typeof(IEmailMessageFullTextSearchObject), Properties = new List <KeyValuePair <string, object> >() }; var idPair = mergedIndexQueueItem.Find( p => Equals(p.Key, LinqUtils.NameOf((IEmailMessage d) => d.Id))); if (idPair.Key != null) { queueToIndex.Properties.Add( new KeyValuePair <string, object>( LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Id), idPair.Value)); } var typeUidPair = mergedIndexQueueItem.Find(p => Equals(p.Key, LinqUtils.NameOf((IEmailMessage d) => d.TypeUid))); if (typeUidPair.Key != null) { queueToIndex.Properties.Add( new KeyValuePair <string, object>( LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.TypeUid), typeUidPair.Value)); } var deletedPair = mergedIndexQueueItem.Find(p => Equals(p.Key, LinqUtils.NameOf((IEmailMessage d) => d.IsDeleted))); if (deletedPair.Key != null) { queueToIndex.Properties.Add( new KeyValuePair <string, object>( LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.IsDeleted), deletedPair.Value)); } var datePair = mergedIndexQueueItem.Find(p => Equals(p.Key, LinqUtils.NameOf((IEmailMessage d) => d.DateUtc))); if (datePair.Key != null) { queueToIndex.Properties.Add( new KeyValuePair <string, object>(LinqUtils.NameOf( (IEmailMessageFullTextSearchObject d) => d.DateUtc), datePair.Value)); } var subjectPair = mergedIndexQueueItem.Find(p => Equals(p.Key, LinqUtils.NameOf((IEmailMessage d) => d.Subject))); if (subjectPair.Key != null) { queueToIndex.Properties.Add( new KeyValuePair <string, object>(LinqUtils.NameOf( (IEmailMessageFullTextSearchObject d) => d.Subject), subjectPair.Value)); } var textPair = mergedIndexQueueItem.Find(p => Equals(p.Key, LinqUtils.NameOf((IEmailMessage d) => d.Text))); if (textPair.Key != null) { if (textPair.Value != null) { var textPairValue = textPair.Value.ToString(); queueToIndex.Properties.Add( new KeyValuePair <string, object>(LinqUtils.NameOf( (IEmailMessageFullTextSearchObject d) => d.Text), textPairValue)); } } var fromPair = mergedIndexQueueItem.Find(p => Equals(p.Key, LinqUtils.NameOf((IEmailMessage d) => d.From))); var toPair = mergedIndexQueueItem.Find(p => Equals(p.Key, LinqUtils.NameOf((IEmailMessage d) => d.To))); if (toPair.Key != null || fromPair.Key != null) { var emailMessage = EmailMessageManager.LoadOrNull(id); if (emailMessage != null) { var from = emailMessage.From.Select(c => c.EmailString).ToArray(); var to = emailMessage.To.Select(c => c.EmailString).ToArray(); queueToIndex.Properties.Add( new KeyValuePair <string, object>(LinqUtils.NameOf( (IEmailMessageFullTextSearchObject d) => d.From), new SerializableList <object>(from))); queueToIndex.Properties.Add( new KeyValuePair <string, object>(LinqUtils.NameOf( (IEmailMessageFullTextSearchObject d) => d.To), new SerializableList <object>(to))); queueToIndex.Properties.Add( new KeyValuePair <string, object>(LinqUtils.NameOf( (IEmailMessageFullTextSearchObject d) => d.Contractors), new SerializableList <long>(emailMessage.Contractors.Select(c => c.Id).ToArray()))); queueToIndex.Properties.Add( new KeyValuePair <string, object>(LinqUtils.NameOf( (IEmailMessageFullTextSearchObject d) => d.Contacts), new SerializableList <long>(emailMessage.Contacts.Select(c => c.Id).ToArray()))); } var ownersPair = mergedIndexQueueItem.Find(p => Equals(p.Key, LinqUtils.NameOf((IEmailMessage d) => d.Owners))); if (ownersPair.Value is ISet <IUserMailbox> ownersPairValue) { var owners = new SerializableList <object>(ownersPairValue.Select(c => c.EmailLogin)); queueToIndex.Properties.Add(new KeyValuePair <string, object>(LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Owners), owners)); } } queueToIndex.DynamicProperties.AddRange((from i in mergedIndexQueueItem select i.Value).OfType <FieldIndexListItem>()); if (queueToIndex.Properties.Any() || queueToIndex.DynamicProperties.Any()) { list.Add(queueToIndex); } return(list); }
public override void ReconstructEntity(Type cardType, IFullTextSearchResultItem resultItem, IEntity <long> fakeEntity) { if (cardType == null || typeof(IEmailMessageFullTextSearchObject) != cardType || resultItem?.ResultData == null || fakeEntity == null) { return; } if (!(fakeEntity is IEmailMessage dmsObject)) { return; } var webDataItem = resultItem.ResultData.Items.FirstOrDefault(i => i.Name == LinqUtils.NameOf((IEmailMessageFullTextSearchObject d) => d.Subject)); if (webDataItem != null) { dmsObject.Subject = webDataItem.Value; } }