本文整理汇总了C#中Lucene.Net.Documents.Field.Name方法的典型用法代码示例。如果您正苦于以下问题:C# Field.Name方法的具体用法?C# Field.Name怎么用?C# Field.Name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lucene.Net.Documents.Field
的用法示例。
在下文中一共展示了Field.Name方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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;
}
示例4: 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());
}
示例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);
}
示例6: SearchField
public SearchField(Field field, IndexField properties)
: this(field.Name(), properties.Caption, field.StringValue(), field.StringValue(), properties.Boost, properties.IsTitle, true, properties.Order)
{
}