Use integer time for the index
This commit is contained in:
+10
-10
@@ -176,7 +176,7 @@ class NWIndex():
|
|||||||
if "textCounts" in theData.keys():
|
if "textCounts" in theData.keys():
|
||||||
self.textCounts = theData["textCounts"]
|
self.textCounts = theData["textCounts"]
|
||||||
|
|
||||||
nowTime = time()
|
nowTime = round(time())
|
||||||
self.timeNovel = nowTime
|
self.timeNovel = nowTime
|
||||||
self.timeNote = nowTime
|
self.timeNote = nowTime
|
||||||
self.timeIndex = nowTime
|
self.timeIndex = nowTime
|
||||||
@@ -282,7 +282,7 @@ class NWIndex():
|
|||||||
logger.error("Not indexing homeless item %s" % tHandle)
|
logger.error("Not indexing homeless item %s" % tHandle)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Run word counter for whole text
|
# Run word counter for the whole text
|
||||||
cC, wC, pC = countWords(theText)
|
cC, wC, pC = countWords(theText)
|
||||||
self.textCounts[tHandle] = [cC, wC, pC]
|
self.textCounts[tHandle] = [cC, wC, pC]
|
||||||
|
|
||||||
@@ -304,7 +304,7 @@ class NWIndex():
|
|||||||
self.refIndex[tHandle] = {}
|
self.refIndex[tHandle] = {}
|
||||||
self.refIndex[tHandle]["T000000"] = {
|
self.refIndex[tHandle]["T000000"] = {
|
||||||
"tags" : [],
|
"tags" : [],
|
||||||
"updated" : time(),
|
"updated" : round(time()),
|
||||||
}
|
}
|
||||||
if itemLayout == nwItemLayout.NOTE:
|
if itemLayout == nwItemLayout.NOTE:
|
||||||
self.noteIndex[tHandle] = {}
|
self.noteIndex[tHandle] = {}
|
||||||
@@ -359,7 +359,7 @@ class NWIndex():
|
|||||||
self._indexWordCounts(tHandle, isNovel, lastText, nTitle)
|
self._indexWordCounts(tHandle, isNovel, lastText, nTitle)
|
||||||
|
|
||||||
# Update timestamps for index changes
|
# Update timestamps for index changes
|
||||||
nowTime = time()
|
nowTime = round(time())
|
||||||
self.timeIndex = nowTime
|
self.timeIndex = nowTime
|
||||||
if isNovel:
|
if isNovel:
|
||||||
self.timeNovel = nowTime
|
self.timeNovel = nowTime
|
||||||
@@ -394,7 +394,7 @@ class NWIndex():
|
|||||||
sTitle = "T%06d" % nLine
|
sTitle = "T%06d" % nLine
|
||||||
self.refIndex[tHandle][sTitle] = {
|
self.refIndex[tHandle][sTitle] = {
|
||||||
"tags" : [],
|
"tags" : [],
|
||||||
"updated" : time(),
|
"updated" : round(time()),
|
||||||
}
|
}
|
||||||
theData = {
|
theData = {
|
||||||
"level" : hDepth,
|
"level" : hDepth,
|
||||||
@@ -404,7 +404,7 @@ class NWIndex():
|
|||||||
"cCount" : 0,
|
"cCount" : 0,
|
||||||
"wCount" : 0,
|
"wCount" : 0,
|
||||||
"pCount" : 0,
|
"pCount" : 0,
|
||||||
"updated" : time(),
|
"updated" : round(time()),
|
||||||
}
|
}
|
||||||
|
|
||||||
if hText != "":
|
if hText != "":
|
||||||
@@ -428,14 +428,14 @@ class NWIndex():
|
|||||||
self.novelIndex[tHandle][sTitle]["cCount"] = cC
|
self.novelIndex[tHandle][sTitle]["cCount"] = cC
|
||||||
self.novelIndex[tHandle][sTitle]["wCount"] = wC
|
self.novelIndex[tHandle][sTitle]["wCount"] = wC
|
||||||
self.novelIndex[tHandle][sTitle]["pCount"] = pC
|
self.novelIndex[tHandle][sTitle]["pCount"] = pC
|
||||||
self.novelIndex[tHandle][sTitle]["updated"] = time()
|
self.novelIndex[tHandle][sTitle]["updated"] = round(time())
|
||||||
else:
|
else:
|
||||||
if tHandle in self.noteIndex:
|
if tHandle in self.noteIndex:
|
||||||
if sTitle in self.noteIndex[tHandle]:
|
if sTitle in self.noteIndex[tHandle]:
|
||||||
self.noteIndex[tHandle][sTitle]["cCount"] = cC
|
self.noteIndex[tHandle][sTitle]["cCount"] = cC
|
||||||
self.noteIndex[tHandle][sTitle]["wCount"] = wC
|
self.noteIndex[tHandle][sTitle]["wCount"] = wC
|
||||||
self.noteIndex[tHandle][sTitle]["pCount"] = pC
|
self.noteIndex[tHandle][sTitle]["pCount"] = pC
|
||||||
self.noteIndex[tHandle][sTitle]["updated"] = time()
|
self.noteIndex[tHandle][sTitle]["updated"] = round(time())
|
||||||
return
|
return
|
||||||
|
|
||||||
def _indexSynopsis(self, tHandle, isNovel, theText, nTitle):
|
def _indexSynopsis(self, tHandle, isNovel, theText, nTitle):
|
||||||
@@ -446,12 +446,12 @@ class NWIndex():
|
|||||||
if tHandle in self.novelIndex:
|
if tHandle in self.novelIndex:
|
||||||
if sTitle in self.novelIndex[tHandle]:
|
if sTitle in self.novelIndex[tHandle]:
|
||||||
self.novelIndex[tHandle][sTitle]["synopsis"] = theText
|
self.novelIndex[tHandle][sTitle]["synopsis"] = theText
|
||||||
self.novelIndex[tHandle][sTitle]["updated"] = time()
|
self.novelIndex[tHandle][sTitle]["updated"] = round(time())
|
||||||
else:
|
else:
|
||||||
if tHandle in self.noteIndex:
|
if tHandle in self.noteIndex:
|
||||||
if sTitle in self.noteIndex[tHandle]:
|
if sTitle in self.noteIndex[tHandle]:
|
||||||
self.noteIndex[tHandle][sTitle]["synopsis"] = theText
|
self.noteIndex[tHandle][sTitle]["synopsis"] = theText
|
||||||
self.noteIndex[tHandle][sTitle]["updated"] = time()
|
self.noteIndex[tHandle][sTitle]["updated"] = round(time())
|
||||||
return
|
return
|
||||||
|
|
||||||
def _indexNoteRef(self, tHandle, aLine, nLine, nTitle):
|
def _indexNoteRef(self, tHandle, aLine, nLine, nTitle):
|
||||||
|
|||||||
Reference in New Issue
Block a user