#8879: Adding GetNullableDateTime to ISearchHit and LuceneSearchHit (#8883)
Some checks failed
Compile / Compile .NET solution (push) Has been cancelled
Compile / Compile Client-side Assets (push) Has been cancelled
SpecFlow Tests / SpecFlow Tests (push) Has been cancelled
Build Crowdin Translation Packages / build-crowdin-translation-packages (push) Has been cancelled

This commit is contained in:
Benedek Farkas
2026-01-09 15:13:43 +01:00
committed by GitHub
parent f2f67d3c0b
commit 9de766de29
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);
}
}