コード例 #1
0
        internal static QueryFieldLevel GetFieldLevel(string fieldName, IPerFieldIndexingInfo indexingInfo)
        {
            QueryFieldLevel level;

            if (fieldName == IndexFieldName.AllText)
            {
                level = QueryFieldLevel.BinaryOrFullText;
            }
            else if (indexingInfo == null)
            {
                level = QueryFieldLevel.BinaryOrFullText;
            }
            else if (indexingInfo.FieldDataType == typeof(BinaryData))
            {
                level = QueryFieldLevel.BinaryOrFullText;
            }
            else if (fieldName == IndexFieldName.InFolder || fieldName == IndexFieldName.InTree ||
                     fieldName == IndexFieldName.Type || fieldName == IndexFieldName.TypeIs ||
                     HeadOnlyFields.Contains(fieldName))
            {
                level = QueryFieldLevel.HeadOnly;
            }
            else
            {
                level = QueryFieldLevel.NoBinaryOrFullText;
            }

            return(level);
        }
コード例 #2
0
        internal static IPerFieldIndexingInfo GetPerFieldIndexingInfo(string fieldName)
        {
            var ensureStart = Instance;

            IPerFieldIndexingInfo info = null;

            if (fieldName.Contains('.'))
            {
                info = Aspect.GetPerFieldIndexingInfo(fieldName);
            }

            if (info != null || Instance.IndexingInfo.TryGetValue(fieldName, out info))
            {
                return(info);
            }

            return(null);
        }
コード例 #3
0
 public string GetIndexFieldInfoErrorLog(string message, FieldSetting fieldSetting, IPerFieldIndexingInfo indexingInfo)
 {
     return(message +
            " (Field name: " + this.Name +
            ", Field type: " + this.GetType().Name +
            ", Content path: " + this.Content.Path +
            ", ContentType name: " + this.Content.ContentType.Name +
            (fieldSetting == null ? string.Empty : ", FieldSetting type: " + fieldSetting.GetType().Name) +
            (indexingInfo == null ? string.Empty : ", IndexingInfo IsInIndex: " + indexingInfo.IsInIndex.ToString()) +
            ")");
 }
コード例 #4
0
        internal static void SetPerFieldIndexingInfo(string fieldName, string contentTypeName, IPerFieldIndexingInfo indexingInfo)
        {
            IPerFieldIndexingInfo origInfo;

            if (!_indexingInfoTable.TryGetValue(fieldName, out origInfo))
            {
                lock (_syncRoot)
                {
                    if (!_indexingInfoTable.TryGetValue(fieldName, out origInfo))
                    {
                        _indexingInfoTable.Add(fieldName, indexingInfo);
                        return;
                    }
                }
            }

            if (origInfo.IndexingMode == IndexingMode.Default)
            {
                origInfo.IndexingMode = indexingInfo.IndexingMode;
            }
            else if (indexingInfo.IndexingMode != IndexingMode.Default && indexingInfo.IndexingMode != origInfo.IndexingMode)
            {
                throw new ContentRegistrationException("Cannot override IndexingMode", contentTypeName, fieldName);
            }

            if (origInfo.IndexStoringMode == IndexStoringMode.Default)
            {
                origInfo.IndexStoringMode = indexingInfo.IndexStoringMode;
            }
            else if (indexingInfo.IndexStoringMode != IndexStoringMode.Default && indexingInfo.IndexStoringMode != origInfo.IndexStoringMode)
            {
                throw new ContentRegistrationException("Cannot override IndexStoringMode", contentTypeName, fieldName);
            }

            if (origInfo.TermVectorStoringMode == IndexTermVector.Default)
            {
                origInfo.TermVectorStoringMode = indexingInfo.TermVectorStoringMode;
            }
            else if (indexingInfo.TermVectorStoringMode != IndexTermVector.Default && indexingInfo.TermVectorStoringMode != origInfo.TermVectorStoringMode)
            {
                throw new ContentRegistrationException("Cannot override TermVectorStoringMode", contentTypeName, fieldName);
            }

            if (origInfo.Analyzer == IndexFieldAnalyzer.Default)
            {
                origInfo.Analyzer = indexingInfo.Analyzer;
            }
            else if (indexingInfo.Analyzer != IndexFieldAnalyzer.Default && indexingInfo.Analyzer != origInfo.Analyzer)
            {
                throw new ContentRegistrationException("Cannot override Analyzer", contentTypeName, fieldName);
            }
        }