[Groonga-commit] nroonga/norema [master] Show path to the document entry

Zurück zum Archiv-Index

null+****@clear***** null+****@clear*****
2012年 8月 9日 (木) 15:08:36 JST


Yoji SHIDARA	2012-08-09 15:08:36 +0900 (Thu, 09 Aug 2012)

  New Revision: 8bdfef0a175d64a0e0a5172081fd3ca1ffbe4fb9
  https://github.com/nroonga/norema/commit/8bdfef0a175d64a0e0a5172081fd3ca1ffbe4fb9

  Log:
    Show path to the document entry

  Modified files:
    tools/convert.js
    views/search.jade

  Modified: tools/convert.js (+6 -0)
===================================================================
--- tools/convert.js    2012-08-09 11:56:40 +0900 (c809e1e)
+++ tools/convert.js    2012-08-09 15:08:36 +0900 (8745a74)
@@ -30,6 +30,7 @@ function parse(doc, context) {
   title = doc.textRaw;
   context = context || {};
   context.items = context.items || [];
+  context.path = context.path || [];
 
   if (title) {
     context.title = title;
@@ -38,9 +39,13 @@ function parse(doc, context) {
   if (doc.desc) {
     item.desc = doc.desc;
     item.title = context.title;
+    item.path = context.path.map(function(item) {
+      return item.title;
+    }).join(' \xbb ');
     context.items.push(item);
   }
 
+  context.path.push(item);
   for (var section in doc) {
     if (doc[section] instanceof Array) {
       doc[section].forEach(function(subdoc) {
@@ -48,6 +53,7 @@ function parse(doc, context) {
       });
     }
   }
+  context.path.pop(item);
 
   return context.items;
 }

  Modified: views/search.jade (+1 -0)
===================================================================
--- views/search.jade    2012-08-09 11:56:40 +0900 (dcd58d2)
+++ views/search.jade    2012-08-09 15:08:36 +0900 (5628375)
@@ -5,4 +5,5 @@ block content
     each record, index in records
       .record
         h2 #{record.data.title}
+        p= record.data.path
         !{record.data.desc}
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
Download 



Groonga-commit メーリングリストの案内
Zurück zum Archiv-Index