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


C# Field.StringValue方法代码示例

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


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

示例1: GetPropertyFromDocument

                static protected Property GetPropertyFromDocument (Field f, Document doc, bool from_primary_index)
                {
                        // Note: we don't use the document that we pass in,
                        // but in theory we could.  At some later point we
                        // might need to split a property's data across two or
                        // more fields in the document.

                        if (f == null)
                                return null;

                        bool internal_prop = false;

                        string field_name;
                        field_name = f.Name ();
                        if (field_name.Length < 7
                            || ! field_name.StartsWith ("prop:")) {
                                if (DumpIndexMode)
                                        internal_prop = true;
                                else
                                        return null;
                        }

                        string field_value;
                        field_value = f.StringValue ();

                        Property prop;
                        prop = new Property ();

                        if (DumpIndexMode) {
                                prop.Type = CodeToType ( internal_prop ? 'k' : field_name [5]);
                                prop.Key = (internal_prop ? field_name : field_name.Substring (7));
                                prop.Value = (internal_prop ? field_value : field_value.Substring (3));
                        } else {
                                prop.Type = CodeToType (field_name [5]);
                                prop.Key = field_name.Substring (7);
                                prop.Value = field_value.Substring (3);
                        }

                        prop.IsSearched = (field_value [0] == 's');
                        prop.IsPersistent = (field_value [1] == 'p');
                        prop.IsMutable = ! from_primary_index;
                        prop.IsStored = true; // Unstored fields cannot be retrieved

                        return prop;
                }
开发者ID:zweib730,项目名称:beagrep,代码行数:45,代码来源:LuceneCommon.cs

示例2: CreateProperty

		private static KeyValuePair<string, RavenJToken> CreateProperty(Field fld, Document document)
		{
			var stringValue = fld.StringValue();
			if (document.GetField(fld.Name() + "_ConvertToJson") != null)
			{
				var val = RavenJToken.Parse(fld.StringValue()) as RavenJObject;
				return new KeyValuePair<string, RavenJToken>(fld.Name(), val);
			}
			if (stringValue == Constants.NullValue)
				stringValue = null;
			if (stringValue == Constants.EmptyString)
				stringValue = string.Empty; 
			return new KeyValuePair<string, RavenJToken>(fld.Name(), stringValue);
		}
开发者ID:richSourceShaper,项目名称:ravendb,代码行数:14,代码来源:Index.cs

示例3: CreateProperty

 private static JProperty CreateProperty(Field fld, Document document)
 {
     if (document.GetField(fld.Name() + "_ConvertToJson") != null)
     {
         var val = JsonConvert.DeserializeObject(fld.StringValue());
         return new JProperty(fld.Name(), val);
     }
     return new JProperty(fld.Name(), fld.StringValue());
 }
开发者ID:dplaskon,项目名称:ravendb,代码行数:9,代码来源:Index.cs

示例4: CreateProperty

		private static JProperty CreateProperty(Field fld, Document document)
		{
			var stringValue = fld.StringValue();
			if (document.GetField(fld.Name() + "_ConvertToJson") != null)
			{
				object val = JsonConvert.DeserializeObject(stringValue);
				return new JProperty(fld.Name(), val);
			}
			if (stringValue == Constants.NullValue)
				stringValue = null;
			return new JProperty(fld.Name(), stringValue);
		}
开发者ID:philiphoy,项目名称:ravendb,代码行数:12,代码来源:Index.cs

示例5: FieldIsPredicate

		// FIXME: This basically queries the value against the field
		// and is really really slow!
		private bool FieldIsPredicate (Field field, string value)
		{
			string field_name = field.Name ();
			string field_value = field.StringValue ();
			Console.WriteLine ("Reverse searching for '{0}' value in {1}='{2}'", value, field_name, field_value);
			// Simply run the value of the property against the right analyzer
			// and check if there is any match
			TokenStream source = IndexingAnalyzer.TokenStream (field_name, new StringReader (field_value));
			StringBuilder sb = new StringBuilder ();
			try {
				Lucene.Net.Analysis.Token token;
				while (true) {
					token = source.Next ();
					if (token == null)
						break;
					sb.Append (token.TermText ());
					sb.Append (" ");
					break;
				}
			} finally {
				try {
					source.Close ();
				} catch { }
			}

			string field_analyzed = sb.ToString ();
			sb.Length = 0;

			source = QueryAnalyzer.TokenStream (field_name, new StringReader (value));
			try {
				Lucene.Net.Analysis.Token token;
				while (true) {
					token = source.Next ();
					if (token == null)
						break;
					sb.Append (token.TermText ());
					sb.Append (" ");
					break;
				}
			} finally {
				try {
					source.Close ();
				} catch { }
			}

			string value_analyzed = sb.ToString ();
			return field_analyzed.Contains (value_analyzed);
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:50,代码来源:LuceneQueryingDriver.cs

示例6: AddFieldRow

        private void AddFieldRow(string fieldName, Field f)
        {
            string feature;
            ListViewItem item = new ListViewItem("<" + fieldName + ">");

            if (f != null && f.IsIndexed()) feature = "+";
            else feature = " ";
            item.SubItems.Add(feature);

            if (f != null && f.IsTokenized()) feature = "+";
            else feature = " ";
            item.SubItems.Add(feature);

            if (f != null && f.IsStored()) feature = "+";
            else feature = " ";
            item.SubItems.Add(feature);

            if (f != null && f.IsTermVectorStored()) feature = "+";
            else feature = " ";
            item.SubItems.Add(feature);

            if (f != null)
                item.SubItems.Add(f.GetBoost().ToString("0.0####"));
            else item.SubItems.Add("");

            if (f != null)
                item.SubItems.Add(f.StringValue());
            else
            {
                item.SubItems.Add(_luke.resources.GetString("FieldNotAvailable"));
            }

            listDocFields.Items.Add(item);
        }
开发者ID:mammo,项目名称:LukeSharp,代码行数:34,代码来源:DocumentsTabPage.cs

示例7: SearchField

 public SearchField(Field field, IndexField properties)
     : this(field.Name(), properties.Caption, field.StringValue(), field.StringValue(), properties.Boost, properties.IsTitle, true, properties.Order)
 { 
 }
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:4,代码来源:SearchField.cs


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