|
@@ -21,13 +21,14 @@ namespace Masuit.LuceneEFCore.SearchEngine
|
|
#if Int
|
|
#if Int
|
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
public int Id { get; set; }
|
|
public int Id { get; set; }
|
|
|
|
+
|
|
#endif
|
|
#endif
|
|
#if Long
|
|
#if Long
|
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
- public long Id { get; set; }
|
|
|
|
|
|
+ public long Id { get; set; }
|
|
#endif
|
|
#endif
|
|
#if String
|
|
#if String
|
|
- public string Id { get; set; }
|
|
|
|
|
|
+ public string Id { get; set; }
|
|
#endif
|
|
#endif
|
|
#if Guid
|
|
#if Guid
|
|
public Guid Id { get; set; }
|
|
public Guid Id { get; set; }
|
|
@@ -41,6 +42,7 @@ namespace Masuit.LuceneEFCore.SearchEngine
|
|
public string IndexId
|
|
public string IndexId
|
|
{
|
|
{
|
|
get => GetType().Name + ":" + Id;
|
|
get => GetType().Name + ":" + Id;
|
|
|
|
+
|
|
set
|
|
set
|
|
{
|
|
{
|
|
}
|
|
}
|
|
@@ -78,18 +80,23 @@ namespace Masuit.LuceneEFCore.SearchEngine
|
|
case DateTime time:
|
|
case DateTime time:
|
|
doc.Add(new StringField(name, time.ToString("yyyy-MM-dd HH:mm:ss"), attr.Store));
|
|
doc.Add(new StringField(name, time.ToString("yyyy-MM-dd HH:mm:ss"), attr.Store));
|
|
break;
|
|
break;
|
|
|
|
+
|
|
case int num:
|
|
case int num:
|
|
doc.Add(new Int32Field(name, num, attr.Store));
|
|
doc.Add(new Int32Field(name, num, attr.Store));
|
|
break;
|
|
break;
|
|
|
|
+
|
|
case long num:
|
|
case long num:
|
|
doc.Add(new Int64Field(name, num, attr.Store));
|
|
doc.Add(new Int64Field(name, num, attr.Store));
|
|
break;
|
|
break;
|
|
|
|
+
|
|
case float num:
|
|
case float num:
|
|
doc.Add(new SingleField(name, num, attr.Store));
|
|
doc.Add(new SingleField(name, num, attr.Store));
|
|
break;
|
|
break;
|
|
|
|
+
|
|
case double num:
|
|
case double num:
|
|
doc.Add(new DoubleField(name, num, attr.Store));
|
|
doc.Add(new DoubleField(name, num, attr.Store));
|
|
break;
|
|
break;
|
|
|
|
+
|
|
default:
|
|
default:
|
|
string value = attr.IsHtml ? propertyValue.ToString().RemoveHtmlTag() : propertyValue.ToString();
|
|
string value = attr.IsHtml ? propertyValue.ToString().RemoveHtmlTag() : propertyValue.ToString();
|
|
doc.Add(new TextField(name, value, attr.Store));
|
|
doc.Add(new TextField(name, value, attr.Store));
|
|
@@ -101,4 +108,4 @@ namespace Masuit.LuceneEFCore.SearchEngine
|
|
return doc;
|
|
return doc;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}
|