# HG changeset patch # User ymh # Date 1276002646 -7200 # Node ID 651f67b66c51afacd5a7c53244bdf7099ad2865f # Parent 252f2e87cdc33bfef88a921ceab80938e809f467 upgrade lucene diff -r 252f2e87cdc3 -r 651f67b66c51 .pydevproject --- a/.pydevproject Tue Jun 08 13:39:41 2010 +0200 +++ b/.pydevproject Tue Jun 08 15:10:46 2010 +0200 @@ -2,6 +2,6 @@ -Default +python_eulalie python 2.6 diff -r 252f2e87cdc3 -r 651f67b66c51 web/eulalie/config.py.tmpl --- a/web/eulalie/config.py.tmpl Tue Jun 08 13:39:41 2010 +0200 +++ b/web/eulalie/config.py.tmpl Tue Jun 08 15:10:46 2010 +0200 @@ -60,3 +60,4 @@ ACCOUNT_ACTIVATION_DAYS = 7 REGISTRATION_OPEN = False +LDT_MAX_SEARCH_NUMBER = 50 diff -r 252f2e87cdc3 -r 651f67b66c51 web/eulalie/settings.py --- a/web/eulalie/settings.py Tue Jun 08 13:39:41 2010 +0200 +++ b/web/eulalie/settings.py Tue Jun 08 15:10:46 2010 +0200 @@ -132,6 +132,6 @@ LOGOUT_URL = BASE_URL + 'eulalie' ACCOUNT_ACTIVATION_DAYS = 7 +LDT_MAX_SEARCH_NUMBER = 50 - diff -r 252f2e87cdc3 -r 651f67b66c51 web/ldt/ldt/__init__.py --- a/web/ldt/ldt/__init__.py Tue Jun 08 13:39:41 2010 +0200 +++ b/web/ldt/ldt/__init__.py Tue Jun 08 15:10:46 2010 +0200 @@ -3,12 +3,13 @@ lucene.initVM(lucene.CLASSPATH) -STORE = lucene.FSDirectory.getDirectory(settings.INDEX_PATH, False) -ANALYZER = lucene.PerFieldAnalyzerWrapper(lucene.StandardAnalyzer()) -ANALYZER.addAnalyzer("tags",lucene.FrenchAnalyzer()) -ANALYZER.addAnalyzer("title",lucene.FrenchAnalyzer()) -ANALYZER.addAnalyzer("abstract",lucene.FrenchAnalyzer()) -ANALYZER.addAnalyzer("all",lucene.FrenchAnalyzer()) +STORE = lucene.SimpleFSDirectory(lucene.File(settings.INDEX_PATH)) +ANALYZER = lucene.PerFieldAnalyzerWrapper(lucene.StandardAnalyzer(lucene.Version.LUCENE_CURRENT)) +ANALYZER.addAnalyzer("tags",lucene.FrenchAnalyzer(lucene.Version.LUCENE_CURRENT)) +ANALYZER.addAnalyzer("title",lucene.FrenchAnalyzer(lucene.Version.LUCENE_CURRENT)) +ANALYZER.addAnalyzer("abstract",lucene.FrenchAnalyzer(lucene.Version.LUCENE_CURRENT)) +ANALYZER.addAnalyzer("all",lucene.FrenchAnalyzer(lucene.Version.LUCENE_CURRENT)) + VERSION = (0,1) VERSION_STR = unicode(".".join(map(lambda i:"%02d" % (i,), VERSION))) diff -r 252f2e87cdc3 -r 651f67b66c51 web/ldt/ldt/admin.py --- a/web/ldt/ldt/admin.py Tue Jun 08 13:39:41 2010 +0200 +++ b/web/ldt/ldt/admin.py Tue Jun 08 15:10:46 2010 +0200 @@ -49,8 +49,7 @@ form = ReindexForm(request.POST) if form.is_valid(): # try: - writer = lucene.IndexWriter(STORE, ANALYZER, True) - writer.setMaxFieldLength(1048576) + writer = lucene.IndexWriter(STORE, ANALYZER, True, lucene.IndexWriter.MaxFieldLength.UNLIMITED) contentList = form.cleaned_data["contents"] indexer = ContentIndexer(contentList,writer) indexer.index_all() diff -r 252f2e87cdc3 -r 651f67b66c51 web/ldt/ldt/contentindexer.py --- a/web/ldt/ldt/contentindexer.py Tue Jun 08 13:39:41 2010 +0200 +++ b/web/ldt/ldt/contentindexer.py Tue Jun 08 15:10:46 2010 +0200 @@ -14,6 +14,7 @@ import xml.dom.ext import xml.xpath import fnmatch +import Ft import uuid import shutil import lucene @@ -56,25 +57,26 @@ url =content.iri_url() filepath = urllib.urlopen(url) doc = xml.dom.minidom.parse(filepath) - + doc = Ft.Xml.Domlette.ConvertDocument(doc) + self.__writer.deleteDocuments(lucene.Term("iri_id", content.iri_id)) con = xml.xpath.Context.Context(doc, 1, 1, None) res = xml.xpath.Evaluate("/iri/body/ensembles/ensemble", context=con) for ensemble in res: - ensembleId = ensemble.getAttribute("id") + ensembleId = ensemble.getAttributeNS("id",None) for decoupageNode in ensemble.childNodes: - if decoupageNode.nodeType != xml.dom.Node.ELEMENT_NODE or decoupageNode.tagName != "decoupage" or decoupageNode.getAttribute("id") in self.decoupage_blacklist: + if decoupageNode.nodeType != xml.dom.Node.ELEMENT_NODE or decoupageNode.tagName != "decoupage" or decoupageNode.getAttributeNS("id",None) in self.decoupage_blacklist: continue - decoupId = decoupageNode.getAttribute("id") + decoupId = decoupageNode.getAttributeNS("id",None) res = xml.xpath.Evaluate("elements/element", decoupageNode) for elementNode in res: doc = lucene.Document() - elementId = elementNode.getAttribute("id") - tags = elementNode.getAttribute("tags") + elementId = elementNode.getAttributeNS("id",None) + tags = elementNode.getAttributeNS("tags",None) if tags is not None: tags.replace(",", ";") @@ -99,18 +101,33 @@ for txtRes in xml.xpath.Evaluate("abstract/text()", elementNode): abstract = abstract + txtRes.data - doc.add(lucene.Field("iri_id", content.iri_id, lucene.Field.Store.YES, lucene.Field.Index.UN_TOKENIZED)) + doc.add(lucene.Field("iri_id", content.iri_id, lucene.Field.Store.YES, lucene.Field.Index.NOT_ANALYZED)) doc.add(lucene.Field("ensemble_id", ensembleId, lucene.Field.Store.YES, lucene.Field.Index.NO)) doc.add(lucene.Field("decoupage_id", decoupId, lucene.Field.Store.YES, lucene.Field.Index.NO)) - doc.add(lucene.Field("element_id", elementId, lucene.Field.Store.YES, lucene.Field.Index.NO)) - doc.add(lucene.Field("tags", tags, lucene.Field.Store.NO, lucene.Field.Index.TOKENIZED)) - doc.add(lucene.Field("title", title, lucene.Field.Store.NO, lucene.Field.Index.TOKENIZED)) - doc.add(lucene.Field("abstract", abstract, lucene.Field.Store.NO, lucene.Field.Index.TOKENIZED)) - doc.add(lucene.Field("all", " ".join([tags, title, abstract]), lucene.Field.Store.NO, lucene.Field.Index.TOKENIZED)) + doc.add(lucene.Field("element_id", elementId, lucene.Field.Store.YES, lucene.Field.Index.NO)) + doc.add(lucene.Field("tags", tags, lucene.Field.Store.NO, lucene.Field.Index.ANALYZED)) + doc.add(lucene.Field("title", title, lucene.Field.Store.NO, lucene.Field.Index.ANALYZED)) + doc.add(lucene.Field("abstract", abstract, lucene.Field.Store.NO, lucene.Field.Index.ANALYZED)) + doc.add(lucene.Field("all", " ".join([tags, title, abstract]), lucene.Field.Store.NO, lucene.Field.Index.ANALYZED)) + + seg = Segment(content=content, + iri_id=content.iri_id, + ensemble_id=ensembleId, + cutting_id=decoupId, + element_id=elementId, + tags=tags, + title=title, + abstract=abstract, + duration=duration, + author=author, + start_ts=start_ts, + date=date_str) + seg.save() + self.__writer.addDocument(doc) - self.__writer.flush() + self.__writer.commit() class ProjectIndexer(object): @@ -145,6 +162,7 @@ # pocketfilms.utils.log.debug("Indexing project : "+str(project.iri_id)) doc = xml.dom.minidom.parseString(project.ldt) + doc = Ft.Xml.Domlette.ConvertDocument(doc) self.__writer.deleteDocuments(lucene.Term("iri_id", project.iri_id)) @@ -152,21 +170,21 @@ res = xml.xpath.Evaluate("/iri/annotations/content", context=con) for content in res: - contentId = content.getAttribute("id") + contentId = content.getAttributeNS("id",None) ensembleId = "ens_perso" for decoupageNode in content.childNodes: # pocketfilms.utils.log.debug("Indexing content 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: + if decoupageNode.nodeType != xml.dom.Node.ELEMENT_NODE or decoupageNode.tagName != "decoupage" or decoupageNode.getAttributeNS("id",None) in self.decoupage_blacklist: continue - decoupId = decoupageNode.getAttribute("id") + decoupId = decoupageNode.getAttributeNS("id",None) res = xml.xpath.Evaluate("elements/element", decoupageNode) for elementNode in res: doc = lucene.Document() - elementId = elementNode.getAttribute("id") - tags = elementNode.getAttribute("tags") + elementId = elementNode.getAttributeNS("id",None) + tags = elementNode.getAttributeNS("tags",None) if tags is not None: tags.replace(",", ";") @@ -191,16 +209,30 @@ for txtRes in xml.xpath.Evaluate("abstract/text()", elementNode): abstract = abstract + txtRes.data - doc.add(lucene.Field("project_id", project.iri_id, lucene.Field.Store.YES, lucene.Field.Index.UN_TOKENIZED)) - doc.add(lucene.Field("iri_id", contentId, lucene.Field.Store.YES, lucene.Field.Index.UN_TOKENIZED)) + doc.add(lucene.Field("project_id", project.iri_id, lucene.Field.Store.YES, lucene.Field.Index.NOT_ANALYZED)) + doc.add(lucene.Field("iri_id", contentId, lucene.Field.Store.YES, lucene.Field.Index.NOT_ANALYZED)) doc.add(lucene.Field("ensemble_id", ensembleId, lucene.Field.Store.YES, lucene.Field.Index.NO)) doc.add(lucene.Field("decoupage_id", decoupId, lucene.Field.Store.YES, lucene.Field.Index.NO)) doc.add(lucene.Field("element_id", elementId, lucene.Field.Store.YES, lucene.Field.Index.NO)) - doc.add(lucene.Field("tags", tags, lucene.Field.Store.NO, lucene.Field.Index.TOKENIZED)) - doc.add(lucene.Field("title", title, lucene.Field.Store.NO, lucene.Field.Index.TOKENIZED)) - doc.add(lucene.Field("abstract", abstract, lucene.Field.Store.NO, lucene.Field.Index.TOKENIZED)) - doc.add(lucene.Field("all", " ".join([tags, title, abstract]), lucene.Field.Store.NO, lucene.Field.Index.TOKENIZED)) - + doc.add(lucene.Field("tags", tags, lucene.Field.Store.NO, lucene.Field.Index.ANALYZED)) + doc.add(lucene.Field("title", title, lucene.Field.Store.NO, lucene.Field.Index.ANALYZED)) + doc.add(lucene.Field("abstract", abstract, lucene.Field.Store.NO, lucene.Field.Index.ANALYZED)) + doc.add(lucene.Field("all", " ".join([tags, title, abstract]), lucene.Field.Store.NO, lucene.Field.Index.ANALYZED)) + + seg = Segment(content=content, + iri_id=content.iri_id, + ensemble_id=ensembleId, + cutting_id=decoupId, + element_id=elementId, + tags=tags, + title=title, + abstract=abstract, + duration=duration, + author=author, + start_ts=start_ts, + date=date_str) + seg.save() + self.__writer.addDocument(doc) - self.__writer.flush() + self.__writer.commit() diff -r 252f2e87cdc3 -r 651f67b66c51 web/ldt/ldt/fileimport.py --- a/web/ldt/ldt/fileimport.py Tue Jun 08 13:39:41 2010 +0200 +++ b/web/ldt/ldt/fileimport.py Tue Jun 08 15:10:46 2010 +0200 @@ -35,6 +35,7 @@ self.videourl = "" self.title = None self.desc = None + self.duration = None self.created = False self.content = None self.decoupage_blacklist = decoupage_blacklist @@ -48,7 +49,8 @@ # for just import a file ldt and get the title for every media if 'http' in self.src: url = urllib.urlopen(self.src) - doc = xml.dom.minidom.parse(url) + doc = xml.dom.minidom.parse(url) + doc = Ft.Xml.Domlette.ConvertDocument(doc) con = xml.xpath.Context.Context(doc, 1, 1, None) #open .iri and get the title res = xml.xpath.Evaluate("/iri/head/meta[@name='title']/@content", context=con) @@ -71,7 +73,7 @@ for node in ensemblesnode.childNodes: if node.nodeType == xml.dom.Node.ELEMENT_NODE and node.tagName == "ensemble": - id = node.getAttribute("id") + id = node.getAttributeNS("id",None) if id not in ensembleids: ensembleids.append(id) @@ -82,12 +84,12 @@ if newEnsemble is None: newensemble = doc.createElement('ensemble') ensembleid = self.id+"_"+str(uuid.uuid1()) - newensemble.setAttribute('id',ensembleid) + newensemble.setAttributeNS(None,'id',ensembleid) - newensemble.setAttribute('title', self.annotations.getAttribute('title')) - newensemble.setAttribute('author', self.annotations.getAttribute('author')) - newensemble.setAttribute('date', self.annotations.getAttribute('date')) - newensemble.setAttribute('abstract', self.annotations.getAttribute('abstract')) + newensemble.setAttributeNS(None,'title', self.annotations.getAttribute('title')) + newensemble.setAttributeNS(None,'author', self.annotations.getAttribute('author')) + newensemble.setAttributeNS(None,'date', self.annotations.getAttribute('date')) + newensemble.setAttributeNS(None,'abstract', self.annotations.getAttribute('abstract')) ensemblesnode.appendChild(newensemble) ensembleids.append(ensembleid) newDecoupageNode = cnode.cloneNode(True) @@ -101,11 +103,12 @@ ensembleids.append(ensembleid) ensemblesnode.appendChild(cloneNode) + res = xml.xpath.Evaluate("/iri/body/medias/media[@id='video']/video", context=con) if self.flatten: - res = xml.xpath.Evaluate("/iri/body/medias/media[@id='video']/video", context=con) src_video = res[0].getAttribute('src') self.videourl = os.path.basename(src_video) - res[0].setAttribute('src', self.videourl) + res[0].setAttributeNS(None,'src', self.videourl) + self.duration = res[0].getAttributeNS(None, 'dur') f = open(path, "w") try: @@ -140,6 +143,7 @@ content.iri = self.id + u"/" + os.path.basename(self.src) content.title = self.title content.description = self.desc + content.duration = int(self.duration) content.save() self.content = content @@ -262,7 +266,7 @@ #get author from file ldt result = xml.xpath.Evaluate("/iri/project", context=con) for pnode in result: - author = pnode.getAttribute("user") + author = pnode.getAttributeNS("user",None) if author: self.author = unicode(author) break @@ -305,7 +309,7 @@ # pocketfilms.utils.log.debug("ID : " + str(id)) if contents.has_key(id): if self.author: - contentnode.setAttribute("author", unicode(self.author)) + contentnode.setAttributeNS(None,"author", unicode(self.author)) contents[id].annotations = contentnode #go throught values diff -r 252f2e87cdc3 -r 651f67b66c51 web/ldt/ldt/models.py --- a/web/ldt/ldt/models.py Tue Jun 08 13:39:41 2010 +0200 +++ b/web/ldt/ldt/models.py Tue Jun 08 15:10:46 2010 +0200 @@ -5,6 +5,17 @@ from utils import create_ldt, copy_ldt import uuid +class Author(models.Model): + + handle = models.CharField(max_length=512, unique=True, blank=True, null=True) + email = models.EmailField(unique=False, blank=True, null=True) + firstname = models.CharField(max_length=512, blank=True, null=True) + lastname = models.CharField(max_length=512, blank=True, null=True) + + def __unicode__(self): + return unicode(self.id) + " - " + self.handle + ", " + self.email + ", " + self.firstname + " " + self.lastname + + class Content(models.Model): iri_id = models.CharField(max_length=1024, unique=True) iriurl = models.URLField() @@ -14,7 +25,24 @@ title = models.CharField(max_length=1024, null=True, blank=True) description = models.TextField(null=True, blank=True) external_id = models.CharField(max_length=1024, null=True, blank=True) - # authors = models.ManyToManyField(Author) + authors = models.ManyToManyField(Author) + duration = models.IntegerField(null=True, blank=True) + + def get_duration(self): + if self.duration is None: + doc = xml.dom.minidom.parse(self.iri_file_path()) + doc = Ft.Xml.Domlette.ConvertDocument(doc) + con = xml.xpath.Context.Context(doc, 1, 1, None) + res = xml.xpath.Evaluate("/iri/body/medias/media[@id='video']/video", context=con) + self.duration = int(res[0].getAttributeNS(None, 'dur')) + self.save() + return self.duration + + def delete(self): + super(Content, self).delete() + writer = lucene.IndexWriter(STORE, ANALYZER, True, lucene.IndexWriter.MaxFieldLength.UNLIMITED) + writer.deleteDocuments(lucene.Term("iri_id", self.iri_id)) + writer.commit() def __unicode__(self): return str(self.id) + ": " + self.iri_id @@ -71,3 +99,26 @@ project.save() return project +class Segment(models.Model): + + project_obj = models.ForeignKey(Project, null=True) + content = models.ForeignKey(Content) + project_id = models.CharField(max_length=1024, unique=False, blank=True, null=True) + iri_id = models.CharField(max_length=1024, unique=False) + ensemble_id = models.CharField(max_length=1024, unique=False) + cutting_id = models.CharField(max_length=1024, unique=False) + element_id = models.CharField(max_length=1024, unique=False) + tags = models.CharField(max_length=2048, unique=False, null=True, blank=True) + title = models.CharField(max_length=2048, unique=False, null=True, blank=True) + duration = models.IntegerField(null=True) + start_ts = models.IntegerField(null=True) + author = models.CharField(max_length=1024, unique=False, null=True, blank=True) + date = models.CharField(max_length=128, unique=False, null=True, blank=True) + abstract = models.TextField(null=True, blank=True) + + def __unicode__(self): + return "/".join((unicode(self.project_id), unicode(self.iri_id), unicode(self.ensemble_id), unicode(self.cutting_id), unicode(self.element_id))) + + class Meta: + unique_together = (('project_id', 'iri_id', 'ensemble_id', 'cutting_id', 'element_id'),) + diff -r 252f2e87cdc3 -r 651f67b66c51 web/ldt/ldt/templates/admin/ldt/app_action.html --- a/web/ldt/ldt/templates/admin/ldt/app_action.html Tue Jun 08 13:39:41 2010 +0200 +++ b/web/ldt/ldt/templates/admin/ldt/app_action.html Tue Jun 08 15:10:46 2010 +0200 @@ -1,11 +1,7 @@ -{% extends "admin/base_site.html" %} -{% load i18n %} +{% extends "admin/base_site.html" %} {% load i18n %} {% block +breadcrumbs %} + +{% endblock %} -{% block breadcrumbs %} -{% endblock %} - diff -r 252f2e87cdc3 -r 651f67b66c51 web/ldt/ldt/templates/admin/ldt/app_index.html --- a/web/ldt/ldt/templates/admin/ldt/app_index.html Tue Jun 08 13:39:41 2010 +0200 +++ b/web/ldt/ldt/templates/admin/ldt/app_index.html Tue Jun 08 15:10:46 2010 +0200 @@ -1,30 +1,25 @@ -{% extends "admin/app_index.html" %} -{% load i18n %} - -{% block content %} +{% extends "admin/app_index.html" %} {% load i18n %} {% block content %} {{ block.super }} -
- - - - - - - - - - -
Import
- Import an ldt -  
- Reindex -  
-
+ + Reindex + +   + + + {% endblock %} diff -r 252f2e87cdc3 -r 651f67b66c51 web/ldt/ldt/templates/admin/ldt/content/reindex_form.html --- a/web/ldt/ldt/templates/admin/ldt/content/reindex_form.html Tue Jun 08 13:39:41 2010 +0200 +++ b/web/ldt/ldt/templates/admin/ldt/content/reindex_form.html Tue Jun 08 15:10:46 2010 +0200 @@ -1,30 +1,22 @@ -{% extends "admin/ldt/app_action.html" %} -{% load i18n %} -{# reindex contents #} - -{% block content %} - -{% if message %} +{% extends "admin/ldt/app_action.html" %} {% load i18n %} {# reindex +contents #} {% block content %} {% if message %}
-

-{{ message }} -

+

{{ message }}

-{% endif %} -{% if form. %} -
-
+{% endif %} {% if form. %} +
{% endif %}
-
- {% csrf_token %} - +{% +csrf_token %} +
{{ form.as_table }} -
- -
+ +
-Back to administration page +Back to +administration page {% endblock %} diff -r 252f2e87cdc3 -r 651f67b66c51 web/ldt/ldt/templates/admin/ldt/content/search_form.html --- a/web/ldt/ldt/templates/admin/ldt/content/search_form.html Tue Jun 08 13:39:41 2010 +0200 +++ b/web/ldt/ldt/templates/admin/ldt/content/search_form.html Tue Jun 08 15:10:46 2010 +0200 @@ -1,14 +1,13 @@ -{% extends "base.html" %} - -{% block content %} - -
+{% extends "base.html" %} {% block content %} - + + +
{{ form.as_table }} -
- -
+ + {% endblock %} diff -r 252f2e87cdc3 -r 651f67b66c51 web/ldt/ldt/templates/admin/ldt/content/upload_form.html --- a/web/ldt/ldt/templates/admin/ldt/content/upload_form.html Tue Jun 08 13:39:41 2010 +0200 +++ b/web/ldt/ldt/templates/admin/ldt/content/upload_form.html Tue Jun 08 15:10:46 2010 +0200 @@ -1,28 +1,26 @@ -{% extends "admin/ldt/app_action.html" %} -{# import an ldt #} -{% block content %} -

Vous pouvez importer un fichier ldt ou un zip qui compresse un fichier .ldt et plusieurs fichiers .iri.

-

Bien verifiez vous que le chemin de source est absolute pour un fichier ldt lors qu'il est tout seul, alors qu'il est relatif s'il est dans le zip

+{% extends "admin/ldt/app_action.html" %} {# import an ldt #} {% block +content %} +

Vous pouvez importer un fichier ldt ou un zip qui compresse un +fichier .ldt et plusieurs fichiers .iri.

+

Bien verifiez vous que le chemin de source est absolute pour un +fichier ldt lors qu'il est tout seul, alors qu'il est relatif s'il est +dans le zip

Vous pouvez indiquer le chemin de video si vous avez besoin

{% if message %}
-

-{{ message }} -

+

{{ message }}

+{% endif %} {% if form %} + +
{% +csrf_token %} + + {{ form.as_table }} +
+
{% endif %} -{% if form %} - -
- {% csrf_token %} - - {{ form.as_table }} -
- -
-{% endif %} - -Back to administration page +Back to administration +page {% endblock %} diff -r 252f2e87cdc3 -r 651f67b66c51 web/ldt/ldt/templates/iriuser/ldt/copy_ldt.html --- a/web/ldt/ldt/templates/iriuser/ldt/copy_ldt.html Tue Jun 08 13:39:41 2010 +0200 +++ b/web/ldt/ldt/templates/iriuser/ldt/copy_ldt.html Tue Jun 08 15:10:46 2010 +0200 @@ -1,5 +1,4 @@ -{% load i18n %} -{# form of copy of project ldt #} +{% load i18n %} {# form of copy of project ldt #} @@ -9,14 +8,11 @@
-
{% trans "Copy your project" %}
-
- {% csrf_token %} - - - - -
+
{% trans "Copy your project" %}
+
{% csrf_token %}
diff -r 252f2e87cdc3 -r 651f67b66c51 web/ldt/ldt/templates/iriuser/ldt/create_ldt.html --- a/web/ldt/ldt/templates/iriuser/ldt/create_ldt.html Tue Jun 08 13:39:41 2010 +0200 +++ b/web/ldt/ldt/templates/iriuser/ldt/create_ldt.html Tue Jun 08 15:10:46 2010 +0200 @@ -1,5 +1,4 @@ -{% load i18n %} -{# form of creation of project ldt #} +{% load i18n %} {# form of creation of project ldt #} @@ -9,21 +8,22 @@
-
{% trans "Create your project" %}
-
- {% csrf_token %} - - - -
{% trans "List of contents" %}
-
    - {% for content in contents %} -
  • {{content.iri_id}}
  • - {% endfor %} -
- - -
+
{% trans "Create your project" %}
+
{% +csrf_token %} + +
{% trans "List of contents" %}
+
    + {% for content in contents %} +
  • {{content.iri_id}}
  • + {% endfor %} +
+ +
diff -r 252f2e87cdc3 -r 651f67b66c51 web/ldt/ldt/templates/iriuser/ldt/init_ldt.html --- a/web/ldt/ldt/templates/iriuser/ldt/init_ldt.html Tue Jun 08 13:39:41 2010 +0200 +++ b/web/ldt/ldt/templates/iriuser/ldt/init_ldt.html Tue Jun 08 15:10:46 2010 +0200 @@ -1,22 +1,21 @@ - - - - - - - Ligne de Temps - IRI - - + - + -
  -
- +{% extends "ldt/user/user_base.html" %} {# list of projects ldt #} {% +load i18n %} {% block js_import %}{{ block.super }} + -{% endblock %} -{% block css_import %} -{{ block.super }} - -{% endblock %} - -{% block breadcrumb %} -
  • -
  • {% trans "Space" %}
  • -
  • {% trans "Ldt Project" %}
  • -{% endblock %} -{% block content_title %}{% trans "Ldt Project" %}{% endblock %} - -{% block iricontent %} -
    -{% trans 'Create new project'%} - - - - - - - - - - {% for ldt in ldtProjects %} - - - {% ifequal ldt.state 2%} - - {% else %} - - {% endifequal %} - - {% endfor %} - -
    {% trans "Project" %}
    {% trans "title" %}{% trans " published" %}
    {{ ldt.title }}TrueFalse
    +{% endblock %} {% block css_import %} {{ block.super }} + +{% endblock %} {% block breadcrumb %} +
  • +
  • {% trans +"Space" %}
  • +
  • {% trans "Ldt Project" %}
  • +{% endblock %} {% block content_title %}{% trans "Ldt Project" %}{% +endblock %} {% block iricontent %} +
    {% +trans 'Create new project'%} + + + + + + + + + + {% for ldt in ldtProjects %} + + + {% ifequal ldt.state 2%} + + {% else %} + + {% endifequal %} + + {% endfor %} + +
    {% trans "Project" %}
    {% trans "title" %}{% trans " published" %}
    {{ ldt.title }}TrueFalse
    {% endblock %} diff -r 252f2e87cdc3 -r 651f67b66c51 web/ldt/ldt/templates/iriuser/ldt/loading.html --- a/web/ldt/ldt/templates/iriuser/ldt/loading.html Tue Jun 08 13:39:41 2010 +0200 +++ b/web/ldt/ldt/templates/iriuser/ldt/loading.html Tue Jun 08 15:10:46 2010 +0200 @@ -4,24 +4,23 @@
    -
    -loading -
    +
    loading
    diff -r 252f2e87cdc3 -r 651f67b66c51 web/ldt/ldt/templates/iriuser/ldt/save_done.html --- a/web/ldt/ldt/templates/iriuser/ldt/save_done.html Tue Jun 08 13:39:41 2010 +0200 +++ b/web/ldt/ldt/templates/iriuser/ldt/save_done.html Tue Jun 08 15:10:46 2010 +0200 @@ -1,4 +1,5 @@

    done

    -

    {{ldt}}

    +

    {{ldt}} +

    {{id}}

    title:{{title}}

    \ No newline at end of file diff -r 252f2e87cdc3 -r 651f67b66c51 web/ldt/ldt/utils.py --- a/web/ldt/ldt/utils.py Tue Jun 08 13:39:41 2010 +0200 +++ b/web/ldt/ldt/utils.py Tue Jun 08 15:10:46 2010 +0200 @@ -17,15 +17,16 @@ def query(self, field, query): indexSearcher = lucene.IndexSearcher(STORE) - queryParser = lucene.QueryParser(field, lucene.FrenchAnalyzer()) + queryParser = lucene.QueryParser(lucene.Version.LUCENE_30, field, lucene.FrenchAnalyzer(lucene.Version.LUCENE_30)) queryParser.setDefaultOperator(lucene.QueryParser.Operator.AND) queryObj = queryParser.parse(query) - hits = indexSearcher.search(queryObj) + hits = indexSearcher.search(queryObj, settings.LDT_MAX_SEARCH_NUMBER) res = [] - for hit in hits: - doc = lucene.Hit.cast_(hit).getDocument() - res.append({"iri_id":doc.get("iri_id"),"ensemble_id":doc.get("ensemble_id"),"decoupage_id":doc.get("decoupage_id"), "element_id":doc.get("element_id")}) + for hit in hits.scoreDocs: + doc = indexSearcher.doc(hit.doc) + res.append({"iri_id":doc.get("iri_id"),"ensemble_id":doc.get("ensemble_id"),"decoupage_id":doc.get("decoupage_id"), "element_id":doc.get("element_id")}) + indexSearcher.close() return res def queryAll(self, query): diff -r 252f2e87cdc3 -r 651f67b66c51 web/ldt/settings.py --- a/web/ldt/settings.py Tue Jun 08 13:39:41 2010 +0200 +++ b/web/ldt/settings.py Tue Jun 08 15:10:46 2010 +0200 @@ -26,6 +26,7 @@ ACCOUNT_ACTIVATION_DAYS = getattr(settings, 'ACCOUNT_ACTIVATION_DAYS', 7) LDT_MEDIA_PREFIX = getattr(settings, 'LDT_MEDIA_PREFIX', MEDIA_URL + 'ldt/') +LDT_MAX_SEARCH_NUMBER = 50