Fixes DateTime indexed fields

This commit is contained in:
Shannon
2015-02-26 06:36:38 +01:00
parent fc9f75ab9e
commit 701dbd865d
6 changed files with 18 additions and 29 deletions
+2 -3
View File
@@ -43,11 +43,10 @@ More information and documentation can be found on CodePlex: http://umbracoexami
<add Name="MemberId" />
<add Name="ParentId" />
<add Name="Replies" />
<add Name="Updated" EnableSorting="true" Type="DateTime" />
<add Name="UrlName" />
<add Name="CommentsContent" />
<add Name="nodeTypeAlias" />
<add Name="updateDate" EnableSorting="true" />
<add Name="updateDate" EnableSorting="true" Type="DateTime" />
</IndexUserFields>
<IncludeNodeTypes/>
<ExcludeNodeTypes />
@@ -64,7 +63,7 @@ More information and documentation can be found on CodePlex: http://umbracoexami
<add Name="searchAblePath"/>
<add Name="dateCreated" EnableSorting="true" Type="DateTime"/>
<add Name="updateDate" EnableSorting="true" />
<add Name="updateDate" EnableSorting="true" Type="DateTime"/>
<add Name="url"/>
<add Name="nodeTypeAlias" />
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<FileIndexerConfig
<DocumentationIndexConfig
SupportedFileTypes="*.md"
DirectoryToIndex="~/Documentation"
IgnoreFiles=""
Recursive="true">
</FileIndexerConfig>
</DocumentationIndexConfig>
@@ -4,7 +4,7 @@ namespace our.Examine
{
public sealed class DocumentationIndexConfig : ConfigurationSection
{
private static DocumentationIndexConfig settings = ConfigurationManager.GetSection("FileIndexerConfig") as DocumentationIndexConfig;
private static DocumentationIndexConfig settings = ConfigurationManager.GetSection("DocumentationIndexConfig") as DocumentationIndexConfig;
public static DocumentationIndexConfig Settings { get { return settings; } }
+1 -11
View File
@@ -25,16 +25,6 @@ namespace our.Examine
new Exception(e.Message, e.InnerException));
}
public static string SerializeForLucene(this DateTime dateTime)
{
return dateTime.ToString("yyyyMMddHHmmss", CultureInfo.InvariantCulture);
}
public static DateTime DeserializeFromLucene(this string str)
{
return DateTime.ParseExact(str, "yyyyMMddHHmmss", CultureInfo.InvariantCulture);
}
/// <summary>
/// get dataset for single item reindex via event
/// </summary>
@@ -67,7 +57,7 @@ namespace our.Examine
simpleDataSet.RowData.Add("body", body);
simpleDataSet.RowData.Add("nodeName", headLine);
simpleDataSet.RowData.Add("updateDate", file.CreationTime.SerializeForLucene());
simpleDataSet.RowData.Add("updateDate", file.CreationTime.ToString("yyyy-MM-dd HH:mm:ss"));
simpleDataSet.RowData.Add("nodeTypeAlias", "documentation");
simpleDataSet.RowData.Add("dateCreated", file.CreationTime.ToString("yyyy-MM-dd HH:mm:ss"));
+11 -11
View File
@@ -16,9 +16,9 @@ namespace our.Examine
/// </summary>
public class ForumDataService : ISimpleDataService
{
private static int m_CurrentId = 0;
private static int _currentId = 0;
private static readonly object m_Locker = new object();
private static readonly object _locker = new object();
#region ISimpleDataService Members
@@ -62,12 +62,12 @@ namespace our.Examine
{
{ "nodeName", SanitizeXmlString(currentTopic.Title.Replace("<![CDATA[", string.Empty).Replace("]]>",string.Empty))},
{ "body", SanitizeXmlString(umbraco.library.StripHtml(body.Replace("<![CDATA[", string.Empty).Replace("]]>",string.Empty)))},
{ "updateDate", currentTopic.Updated.SerializeForLucene()},
{ "updateDate", currentTopic.Updated.ToString("yyyy-MM-dd HH:mm:ss")},
{ "url", currentTopic.Url},
{ "nodeTypeAlias","forum"},
{ "Created", currentTopic.Created.ToString()},
{ "Created", currentTopic.Created.ToString("yyyy-MM-dd HH:mm:ss")},
{ "LatestComment", currentTopic.LatestComment.ToString()},
{ "LatestReplyAuthor", currentTopic.LatestReplyAuthor.ToString()},
{ "Locked", currentTopic.Locked.ToString()},
@@ -89,7 +89,7 @@ namespace our.Examine
public SimpleDataSet CreateNewDocument()
{
lock (m_Locker)
lock (_locker)
{
//JobDetailItem jobDetails = new JobDetailItem();
Topic forumTopic = new Topic();
@@ -98,12 +98,12 @@ namespace our.Examine
string commentText = String.Empty;
return new SimpleDataSet()
{
NodeDefinition = new IndexedNode() { NodeId = (++m_CurrentId), Type = "forum" },
NodeDefinition = new IndexedNode() { NodeId = (++_currentId), Type = "forum" },
RowData = new Dictionary<string, string>()
{
{ "Title", SanitizeXmlString(forumTopic.Title.Replace("<![CDATA[", string.Empty).Replace("]]>",string.Empty))},
{ "Body", SanitizeXmlString(umbraco.library.StripHtml(forumTopic.Body.Replace("<![CDATA[", string.Empty).Replace("]]>",string.Empty)))},
{ "Created", forumTopic.Created.ToString()},
{ "Created", forumTopic.Created.ToString("yyyy-MM-dd HH:mm:ss")},
{ "LatestComment", forumTopic.LatestComment.ToString()},
{ "LatestReplyAuthor", forumTopic.LatestReplyAuthor.ToString()},
{ "Locked", forumTopic.Locked.ToString()},
@@ -112,7 +112,7 @@ namespace our.Examine
{ "Replies", forumTopic.Replies.ToString()},
{ "UrlName", forumTopic.UrlName.ToString()},
{"nodeTypeAlias","forum"},
{ "updateDate", forumTopic.Updated.SerializeForLucene()},
{ "updateDate", forumTopic.Updated.ToString("yyyy-MM-dd HH:mm:ss")},
{ "CommentsContent", SanitizeXmlString(commentText.Replace("<![CDATA[", string.Empty).Replace("]]>",string.Empty))}
}
};
@@ -121,7 +121,7 @@ namespace our.Examine
public SimpleDataSet CreateNewDocument(int id)
{
lock (m_Locker)
lock (_locker)
{
//JobDetailItem jobDetails = new JobDetailItem();
using(var ts = new TopicService())
@@ -143,7 +143,7 @@ namespace our.Examine
{
{ "Title", SanitizeXmlString(forumTopic.Title.Replace("<![CDATA[", string.Empty).Replace("]]>",string.Empty))},
{ "Body", SanitizeXmlString(umbraco.library.StripHtml(forumTopic.Body.Replace("<![CDATA[", string.Empty).Replace("]]>",string.Empty)))},
{ "Created", forumTopic.Created.ToString()},
{ "Created", forumTopic.Created.ToString("yyyy-MM-dd HH:mm:ss")},
{ "LatestComment", forumTopic.LatestComment.ToString()},
{ "LatestReplyAuthor", forumTopic.LatestReplyAuthor.ToString()},
{ "Locked", forumTopic.Locked.ToString()},
@@ -152,7 +152,7 @@ namespace our.Examine
{ "Replies", forumTopic.Replies.ToString()},
{ "UrlName", forumTopic.UrlName.ToString()},
{"nodeTypeAlias","forum"},
{ "updateDate", forumTopic.Updated.SerializeForLucene()},
{ "updateDate", forumTopic.Updated.ToString("yyyy-MM-dd HH:mm:ss")},
{ "CommentsContent", SanitizeXmlString(commentText.Replace("<![CDATA[", string.Empty).Replace("]]>",string.Empty))}
}
};
@@ -26,7 +26,7 @@ namespace our.Examine
simpleDataSet.RowData.Add("body", umbraco.library.StripHtml( project.GetProperty("description").Value.ToString() )) ;
simpleDataSet.RowData.Add("nodeName", project.Name);
simpleDataSet.RowData.Add("updateDate", project.UpdateDate.SerializeForLucene());
simpleDataSet.RowData.Add("updateDate", project.UpdateDate.ToString("yyyy-MM-dd HH:mm:ss"));
simpleDataSet.RowData.Add("nodeTypeAlias", "project");
simpleDataSet.RowData.Add("url", project.Url );