当前位置: 首页>>代码示例>>C#>>正文


C# Field.SetOmitNorms方法代码示例

本文整理汇总了C#中Lucene.Net.Documents.Field.SetOmitNorms方法的典型用法代码示例。如果您正苦于以下问题:C# Field.SetOmitNorms方法的具体用法?C# Field.SetOmitNorms怎么用?C# Field.SetOmitNorms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lucene.Net.Documents.Field的用法示例。


在下文中一共展示了Field.SetOmitNorms方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddPropertyToDocument

                static protected void AddPropertyToDocument (Property prop, Document doc)
                {
                        if (prop == null || String.IsNullOrEmpty (prop.Value))
                                return;

                        // Don't actually put properties in the UnindexedNamespace
                        // in the document.  A horrible (and yet lovely!) hack.
                        if (prop.Key.StartsWith (StringFu.UnindexedNamespace))
                                return;

                        Field f;

                        if (prop.IsSearched) {
                                string wildcard_field = TypeToWildcardField (prop.Type);

                                f = new Field (wildcard_field,
                                               prop.Value,
                                               Field.Store.NO,
                                               TypeToIndexInstruction (prop.Type));

                                // We don't want to include norms for non-text
                                // fields, even if we do tokenize them.
                                if (prop.Type == PropertyType.Keyword || prop.Type == PropertyType.Date)
                                        f.SetOmitNorms (true);

                                doc.Add (f);

                                if (prop.Type == PropertyType.Date)
                                        AddDateFields (wildcard_field, prop, doc);
                        }

                        string coded_value;
                        coded_value = String.Format ("{0}{1}:{2}",
                                                     prop.IsSearched ? 's' : '_',
                                                     prop.IsPersistent ? 'p' : '_',
                                                     prop.Value);

                        string field_name = PropertyToFieldName (prop.Type, prop.Key);

                        f = new Field (field_name,
                                       coded_value,
                                       prop.IsStored ? Field.Store.YES : Field.Store.NO,
                                       Field.Index.TOKENIZED);
                        doc.Add (f);

                        if (prop.Type == PropertyType.Date)
                                AddDateFields (field_name, prop, doc);
                }
开发者ID:zweib730,项目名称:beagrep,代码行数:48,代码来源:LuceneCommon.cs

示例2: AddField

		private void  AddField(Document doc, FieldInfo fi, bool binary, bool compressed, bool tokenize)
		{
			
			//we have a binary stored field, and it may be compressed
			if (binary)
			{
				int toRead = fieldsStream.ReadVInt();
				byte[] b = new byte[toRead];
				fieldsStream.ReadBytes(b, 0, b.Length);
				if (compressed)
					doc.Add(new Field(fi.name, Uncompress(b), Field.Store.COMPRESS));
				else
					doc.Add(new Field(fi.name, b, Field.Store.YES));
			}
			else
			{
				Field.Store store = Field.Store.YES;
				Field.Index index = GetIndexType(fi, tokenize);
				Field.TermVector termVector = GetTermVectorType(fi);
				
				AbstractField f;
				if (compressed)
				{
					store = Field.Store.COMPRESS;
					int toRead = fieldsStream.ReadVInt();
					
					byte[] b = new byte[toRead];
					fieldsStream.ReadBytes(b, 0, b.Length);
					f = new Field(fi.name, false, System.Text.Encoding.GetEncoding("UTF-8").GetString(Uncompress(b)), store, index, termVector);
					f.SetOmitTermFreqAndPositions(fi.omitTermFreqAndPositions);
					f.SetOmitNorms(fi.omitNorms);
				}
				else
				{
					f = new Field(fi.name, false, fieldsStream.ReadString(), store, index, termVector);
					f.SetOmitTermFreqAndPositions(fi.omitTermFreqAndPositions);
					f.SetOmitNorms(fi.omitNorms);
				}
				doc.Add(f);
			}
		}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:41,代码来源:FieldsReader.cs


注:本文中的Lucene.Net.Documents.Field.SetOmitNorms方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。