Commits

Indra Talip committed 88b0e82

rename changeset index key to match raw_id rather than path for greater consistency

  • Participants
  • Parent commits cfcd981

Comments (0)

Files changed (3)

rhodecode/lib/indexers/__init__.py

 FRAGMENTER = ContextFragmenter(200)
 
 CHGSETS_SCHEMA = Schema(
-    path=ID(unique=True, stored=True),
+    raw_id=ID(unique=True, stored=True),
     revision=NUMERIC(unique=True, stored=True),
     last=BOOLEAN(),
     owner=TEXT(),
     def get_full_content(self, docid):
         res = self.searcher.stored_fields(docid[0])
         log.debug('result: %s' % res)
-        full_repo_path = jn(self.repo_location, res['repository'])
-        f_path = res['path'].split(full_repo_path)[-1]
-        f_path = f_path.lstrip(os.sep)
-        res.update({'f_path': f_path})
-
         if self.search_type == 'content':
+            full_repo_path = jn(self.repo_location, res['repository'])
+            f_path = res['path'].split(full_repo_path)[-1]
+            f_path = f_path.lstrip(os.sep)
             content_short = self.get_short_content(res, docid[1])
             res.update({'content_short': content_short,
-                        'content_short_hl': self.highlight(content_short)})
+                        'content_short_hl': self.highlight(content_short),
+                        'f_path': f_path
+                      })
         elif self.search_type == 'message':
             res.update({'message_hl': self.highlight(res['message'])})
 

rhodecode/lib/indexers/daemon.py

         indexed=0
         for cs in repo[start_rev:]:
             writer.add_document(
-                path=unicode(cs.raw_id),
+                raw_id=unicode(cs.raw_id),
                 owner=unicode(repo.contact),
                 repository=safe_unicode(repo_name),
                 author=cs.author,
                     if last_rev == 0 or len(revs) > last_rev + 1:
                         # delete the docs in the index for the previous last changeset(s)
                         for hit in results:
-                            q = qp.parse(u"last:t AND %s AND path:%s" % 
-                                            (repo_name, hit['path']))
+                            q = qp.parse(u"last:t AND %s AND raw_id:%s" % 
+                                            (repo_name, hit['raw_id']))
                             writer.delete_by_query(q)
 
                         # index from the previous last changeset + all new ones

rhodecode/templates/search/search_commit.html

     <div class="table">
         <div id="body${cnt}" class="codeblock">
             <div class="code-header">
-                <div class="search-path">${h.link_to(h.literal('%s &raquo; %s' % (sr['repository'],sr['f_path'])),
-                h.url('changeset_home',repo_name=sr['repository'],revision=sr['path']))}
+                <div class="search-path">${h.link_to(h.literal('%s &raquo; %s' % (sr['repository'],sr['raw_id'])),
+                h.url('changeset_home',repo_name=sr['repository'],revision=sr['raw_id']))}
                 </div>
             </div>
             <div class="left">