Adding GetNullableDateTime to ISearchHit and LuceneSearchHit

This commit is contained in:
Benedek Farkas
2026-01-06 19:49:48 +01:00
parent 165505b1db
commit 0f4589aaaf
2 changed files with 8 additions and 1 deletions

View File

@@ -38,7 +38,7 @@ namespace Lucene.Models
public string GetString(string name)
{
var field = _doc.GetField(name);
return field == null ? null : field.StringValue;
return field?.StringValue;
}
public DateTime GetDateTime(string name)
@@ -46,5 +46,11 @@ namespace Lucene.Models
var field = _doc.GetField(name);
return field == null ? DateTime.MinValue : DateTools.StringToDate(field.StringValue);
}
public DateTime? GetNullableDateTime(string name)
{
var field = _doc.GetField(name);
return field == null ? default(DateTime?) : DateTools.StringToDate(field.StringValue);
}
}
}

View File

@@ -11,5 +11,6 @@ namespace Orchard.Indexing
bool GetBoolean(string name);
string GetString(string name);
DateTime GetDateTime(string name);
DateTime? GetNullableDateTime(string name);
}
}