Example #1
0
        private static AbstractField CreateStringField(string name, string value, PerFieldIndexingInfo indexingInfo)
        {
            var index      = indexingInfo.IndexingMode ?? PerFieldIndexingInfo.DefaultIndexingMode;
            var store      = indexingInfo.IndexStoringMode ?? PerFieldIndexingInfo.DefaultIndexStoringMode;
            var termVector = indexingInfo.TermVectorStoringMode ?? PerFieldIndexingInfo.DefaultTermVectorStoringMode;

            return(new Lucene.Net.Documents.Field(name, value, store, index, termVector));
        }
Example #2
0
        private static NumericField GetNumericField(string fieldName, PerFieldIndexingInfo indexingInfo)
        {
            // Do not reusing any fields.
            var index    = indexingInfo.IndexingMode ?? PerFieldIndexingInfo.DefaultIndexingMode;
            var store    = indexingInfo.IndexStoringMode ?? PerFieldIndexingInfo.DefaultIndexStoringMode;
            var lucField = new Lucene.Net.Documents.NumericField(fieldName, store, index != Lucene.Net.Documents.Field.Index.NO);

            return(lucField);
        }
Example #3
0
		internal static void SetPerFieldIndexingInfo(string fieldName, string contentTypeName, PerFieldIndexingInfo indexingInfo)
		{
			if (!_indexingInfoTable.ContainsKey(fieldName))
			{
				_indexingInfoTable.Add(fieldName, indexingInfo);
				return;
			}
			var origInfo = _indexingInfoTable[fieldName];
			//--
			if (origInfo.IndexingMode == null)
				origInfo.IndexingMode = indexingInfo.IndexingMode;
			else if (indexingInfo.IndexingMode != null && indexingInfo.IndexingMode != origInfo.IndexingMode)
				throw new ContentRegistrationException("Cannot override IndexingMode", contentTypeName, fieldName);
			//--
			if (origInfo.IndexStoringMode == null)
				origInfo.IndexStoringMode = indexingInfo.IndexStoringMode;
			else if (indexingInfo.IndexStoringMode != null && indexingInfo.IndexStoringMode != origInfo.IndexStoringMode)
				throw new ContentRegistrationException("Cannot override IndexStoringMode", contentTypeName, fieldName);
			//--
			if (origInfo.TermVectorStoringMode == null)
				origInfo.TermVectorStoringMode = indexingInfo.TermVectorStoringMode;
			else if (indexingInfo.TermVectorStoringMode != null && indexingInfo.TermVectorStoringMode != origInfo.TermVectorStoringMode)
				throw new ContentRegistrationException("Cannot override TermVectorStoringMode", contentTypeName, fieldName);
			//--
			if (String.IsNullOrEmpty(origInfo.Analyzer))
				origInfo.Analyzer = indexingInfo.Analyzer;
			else if (!String.IsNullOrEmpty(indexingInfo.Analyzer) && indexingInfo.Analyzer != origInfo.Analyzer)
				throw new ContentRegistrationException("Cannot override Analyzer", contentTypeName, fieldName);
			//--
			//if (String.IsNullOrEmpty(origInfo.Parser))
			//    origInfo.IndexFieldHandler = indexingInfo.IndexFieldHandler;
			//else if (!String.IsNullOrEmpty(indexingInfo.Parser) && indexingInfo.Parser != origInfo.Parser)
			//    throw new ContentRegistrationException("Cannot override Parser", contentTypeName, fieldName);
		}
Example #4
0
 private static AbstractField CreateStringField(string name, string value, PerFieldIndexingInfo indexingInfo)
 {
     var index = indexingInfo.IndexingMode ?? PerFieldIndexingInfo.DefaultIndexingMode;
     var store = indexingInfo.IndexStoringMode ?? PerFieldIndexingInfo.DefaultIndexStoringMode;
     var termVector = indexingInfo.TermVectorStoringMode ?? PerFieldIndexingInfo.DefaultTermVectorStoringMode;
     return new Lucene.Net.Documents.Field(name, value, store, index, termVector);
 }