##// END OF EJS Templates
#453 added ID field in whoosh SCHEMA that solves the issue of reindexing modified files
marcink -
r2388:a0ef98f2 beta
parent child Browse files
Show More
@@ -57,6 +57,7 b' ANALYZER = RegexTokenizer(expression=r"\\'
57 57
58 58 #INDEX SCHEMA DEFINITION
59 59 SCHEMA = Schema(
60 fileid=ID(unique=True),
60 61 owner=TEXT(),
61 62 repository=TEXT(stored=True),
62 63 path=TEXT(stored=True),
@@ -146,10 +146,12 b' class WhooshIndexingDaemon(object):'
146 146 u_content = u''
147 147 indexed += 1
148 148
149 p = safe_unicode(path)
149 150 writer.add_document(
151 fileid=p,
150 152 owner=unicode(repo.contact),
151 153 repository=safe_unicode(repo_name),
152 path=safe_unicode(path),
154 path=p,
153 155 content=u_content,
154 156 modtime=self.get_node_mtime(node),
155 157 extension=node.extension
@@ -214,8 +216,11 b' class WhooshIndexingDaemon(object):'
214 216 if mtime > indexed_time:
215 217 # The file has changed, delete it and add it to the list of
216 218 # files to reindex
217 log.debug('adding to reindex list %s' % indexed_path)
218 writer.delete_by_term('path', indexed_path)
219 log.debug('adding to reindex list %s mtime: %s vs %s' % (
220 indexed_path, mtime, indexed_time)
221 )
222 writer.delete_by_term('fileid', indexed_path)
223
219 224 to_index.add(indexed_path)
220 225 except (ChangesetError, NodeDoesNotExistError):
221 226 # This file was deleted since it was indexed
@@ -230,6 +235,7 b' class WhooshIndexingDaemon(object):'
230 235 for path in self.get_paths(repo):
231 236 path = safe_unicode(path)
232 237 if path in to_index or path not in indexed_paths:
238
233 239 # This is either a file that's changed, or a new file
234 240 # that wasn't indexed before. So index it!
235 241 i, iwc = self.add_doc(writer, path, repo, repo_name)
General Comments 0
You need to be logged in to leave comments. Login now