]> git.openstreetmap.org Git - osqa.git/commitdiff
Small tweaks.
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 21 Oct 2010 14:29:28 +0000 (14:29 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 21 Oct 2010 14:29:28 +0000 (14:29 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@611 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/views/readers.py
forum_modules/pgfulltext/pg_fts_install.sql
forum_modules/pgfulltext/startup.py

index b61e3e9cf6f9303abe5ac80404c3b0a9f67a817b..38c3c9fdc82bebc957f71daf756f1a3ca08b58a4 100644 (file)
@@ -243,7 +243,7 @@ def update_question_view_times(request, question):
 
     request.session['last_seen_in_question'][question.id] = datetime.datetime.now()
 
-def match_question_slug(slug):
+def match_question_slug(id, slug):
     slug_words = slug.split('-')
     qs = Question.objects.filter(title__istartswith=slug_words[0])
 
@@ -287,7 +287,7 @@ def question(request, id, slug='', answer=None):
         question = Question.objects.get(id=id)
     except:
         if slug:
-            question = match_question_slug(slug)
+            question = match_question_slug(id, slug)
             if question is not None:
                 return HttpResponseRedirect(question.get_absolute_url())
 
index e08e22b72a6567d3a2df466afa4e7901c3bcac68..c0468706bb5abd9707c8745fd77da20f4faa8e85 100644 (file)
@@ -116,5 +116,14 @@ begin
 end
 $$ LANGUAGE plpgsql;
 
-ALTER table forum_rootnode_doc DISABLE TRIGGER ALL;
-UPDATE forum_noderevision SET id = id WHERE TRUE;
+CREATE OR REPLACE FUNCTION public.rebuild_index() RETURNS VOID as $$
+       DECLARE
+               r integer;
+       BEGIN
+               FOR r IN SELECT active_revision_id FROM forum_node WHERE node_type = 'question' LOOP
+                       UPDATE forum_noderevision SET id = id WHERE id = r;
+               END LOOP;
+       END
+$$ LANGUAGE 'plpgsql';
+
+SELECT rebuild_index();
index cbb4138eadde1adc5d48d317e5d34a8efd177abe..d45019fc83e5ac984e9bb306ee704ba9cfdaf8bd 100644 (file)
@@ -3,7 +3,7 @@ from forum.models import KeyValue
 from django.db import connection, transaction\r
 import settings\r
 \r
-VERSION = 10\r
+VERSION = 11\r
 \r
 if int(settings.PG_FTSTRIGGERS_VERSION) < VERSION:\r
     f = open(os.path.join(os.path.dirname(__file__), 'pg_fts_install.sql'), 'r')\r