private void ProcessFullTextIndexes(TypeDef typeDef) { if (ShouldSkipFulltextIndex(typeDef)) { return; } var fullTextIndexDef = new FullTextIndexDef(typeDef); foreach (var fieldDef in typeDef.Fields.Where(f => f.UnderlyingProperty != null)) { var fullTextAttribute = fieldDef.UnderlyingProperty .GetAttribute <FullTextAttribute>(AttributeSearchOptions.InheritAll); if (fullTextAttribute == null) { continue; } var fullTextField = new FullTextFieldDef(fieldDef.Name, fullTextAttribute.Analyzed) { Configuration = fullTextAttribute.Configuration, TypeFieldName = fullTextAttribute.DataTypeField }; fullTextIndexDef.Fields.Add(fullTextField); } if (fullTextIndexDef.Fields.Count > 0) { context.ModelDef.FullTextIndexes.Add(fullTextIndexDef); } }
private static FullTextColumnInfo GetFullTextColumn(TypeInfo type, FullTextFieldDef fullTextFieldDef) { var column = type.Fields[fullTextFieldDef.Name].Column; ColumnInfo typeColumn = null; if (fullTextFieldDef.TypeFieldName != null) { FieldInfo field; if (!type.Fields.TryGetValue(fullTextFieldDef.TypeFieldName, out field)) { throw new DomainBuilderException(string.Format(Strings.ExColumnXIsNotFound, fullTextFieldDef.TypeFieldName)); } if (field.ValueType != WellKnownTypes.String) { throw new DomainBuilderException(string.Format(Strings.ExTypeColumnXForFulltextColumnYMustBeTypeOfString, field.Name, column.Name)); } typeColumn = field.Column; } return(new FullTextColumnInfo(column) { IsAnalyzed = fullTextFieldDef.IsAnalyzed, Configuration = fullTextFieldDef.Configuration, TypeColumn = typeColumn }); }