diff -r 20c41a7e2173 -r 1a061f244254 web/ldt/text/views.py --- a/web/ldt/text/views.py Fri Nov 19 18:14:02 2010 +0100 +++ b/web/ldt/text/views.py Tue Nov 23 17:54:36 2010 +0100 @@ -44,11 +44,15 @@ query &= Q(uri=request.GET.get('uri')) if request.GET.get('creator'): query &= Q(creator=request.GET.get('creator')) - if request.GET.get('filter') and len(request.GET.get('filter')) > 0: - query &= Q(text__icontains=request.GET.get('filter')) annotlist = Annotation.objects.filter(query) + if request.GET.get('filter') and len(request.GET.get('filter')) > 0: + search = LdtSearch() + res = search.query("all",request.GET.get('filter')) + for r in res: + annotlist.append(r) + if request.GET.get('limit'): nb = request.GET.get('limit') #offset = request.GET.get('limit')[1] @@ -66,7 +70,6 @@ ## Creates an annotation from a urlencoded xml content ## Returns an xml-structured annotation -@oauth_required @csrf_exempt def create_annotation(request): cont = request.POST["content"] @@ -145,7 +148,6 @@ ## Deletes an annotation (from its id) ## Returns an empty xml-structured annotation -@oauth_required @csrf_exempt def delete_annotation(request): try: @@ -160,7 +162,6 @@ ## Updates the content of an annotation ## Returns the xml-structured updated annotation -@oauth_required @csrf_exempt def update_annotation(request): try: @@ -184,10 +185,7 @@ if len(tags) == 1: tags_str += "," annot.tags = tags_str - - - - + title = doc.xpath("/iri/text-annotation/content/title/text()") if title and annot.title != title[0]: annot.title = unicode(title[0]) @@ -209,6 +207,7 @@ annot.update_date = unicode(update_date[0]) annot.save() + annot.update_index() return HttpResponse(lxml.etree.tostring(annot.serialize(), pretty_print=True), mimetype="text/xml;charset=utf-8")