--- a/web/ldt/ldt_utils/projectindexer.py Tue Sep 28 18:24:14 2010 +0200
+++ b/web/ldt/ldt_utils/projectindexer.py Tue Oct 05 18:19:44 2010 +0200
@@ -13,6 +13,7 @@
from ldt.ldt_utils import STORE
from ldt.ldt_utils import ANALYZER
+
def Property(func):
return property(**func())
@@ -44,27 +45,32 @@
self.index_project(project)
def index_project(self, project):
- ldt=project.ldt
+ # ldt.utils.log.debug("Indexing project : "+str(project.ldt_id))
+
+ ldt=project.ldt
doc = xml.dom.minidom.parseString(ldt.encode( "utf-8" ))
-
+
self.__writer.deleteDocuments(lucene.Term("ldt_id", project.ldt_id))
con = xml.xpath.Context.Context(doc, 1, 1, None)
res = xml.xpath.Evaluate("/iri/annotations/content", context=con)
+ project.ldt.encode( "utf-8 " )
for content in res:
contentId = content.getAttribute("id")
-
+
res =xml.xpath.Evaluate("ensemble", content)
for ensemble in res:
ensembleId = ensemble.getAttribute("id")
-
+
for decoupageNode in ensemble.childNodes:
+ # ldt.utils.log.debug("Indexing project decoupage : "+ repr(decoupageNode.nodeType) + " in " + repr(self.decoupage_blacklist))
if decoupageNode.nodeType != xml.dom.Node.ELEMENT_NODE or decoupageNode.tagName != "decoupage" or decoupageNode.getAttribute("id") in self.decoupage_blacklist:
continue
decoupId = decoupageNode.getAttribute("id")
res = xml.xpath.Evaluate("elements/element", decoupageNode)
+
for elementNode in res:
doc = lucene.Document()
elementId = elementNode.getAttribute("id")
@@ -105,4 +111,4 @@
self.__writer.addDocument(doc)
- self.__writer.flush()
\ No newline at end of file
+ self.__writer.flush()