tsearch2 problems

  • Keith Bawden

    Keith Bawden - 2005-08-15


    When trying to add a new MailManager2 product I recieve the follwo error message:
    Error Type: ProgrammingError
    Error Value: ERROR: type "tsvector" does not exist ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- -- -- Create Functionality -- ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- -- -- Aggregation function (used internally) -- -- This function combines the tsvector values of the messages in a ticket, -- gives back a tsvector which can be used to search all of the messages at -- once. The resulting tsvector preserves the releative distances between -- search terms, so the the scoring of results is not changed. -- -- Alternatively, we could use postgresql's CREATE AGGREGATE here, which may -- improve both the performance and the semantics of the database. For now, -- this shall suffice. -- -- Function: ts_aggregate(ticket_id integer) -- Description: Returns the aggregated message indicies from all of the -- messages under the ticket with the given id -- CREATE OR REPLACE FUNCTION ts_aggregate(integer) RETURNS tsvector AS ' DECLARE ticket_id ALIAS FOR $1; summation TSVECTOR := ''''::tsvector; msg RECORD; BEGIN FOR msg IN SELECT * FROM mm_message WHERE mm_message.ticket_id = ticket_id LOOP summation = summation || msg.idxFTI; END LOOP; RETURN summation; END; ' LANGUAGE plpgsql


    The system is Debian Etch with Zope2.7 and all 3rd party apps installed.

    DB connection is established and working.

    Postgres-8.0 and postgresql-contrib-8.0 are installed.

    To me it looks like tsearch2 is not working. Is this a know issues?

    Also, how do I test and confirm tsearch2 is working?

    Regards, Bawdo2001

    • Kevin Campbell

      Kevin Campbell - 2005-08-15


      The problem you are having appears to be due to not having run the
      setupdb.py script. You need to run this script to configure the postgres
      server before trying to create a MailManager instance. The setupdb.py
      script will load in the tsearch2.sql file which comes with
      postgres-contrib, in order to add the tsvector and other datatypes. Did
      you run this script? If not, could you see if that solves the problem
      for you?


      Kevin Campbell             
      GPG Key: F480EC23
      Software Engineer                           
      Logical Progression Ltd              

    • Keith Bawden

      Keith Bawden - 2005-08-15


      I solved the problem.

      I had run the script as per the instructions in the README.txt file.

      ./setupdb.py -z tsearch2.sql mailmanager_db

      However, on looking into the DB the four pg_ts* tables were not created.

      After dropping the mailmanager_db and user I then slighlty altered the example of how to run the setupdb.py script that I found in the online "Windows" installation howto:

      ./setupdb.py --user=mailmanager --password=password --tsearch-sql=/usr/share/postgresql/8.0/contrib/tsearch2.sql --schema=mmdata mailmanager_db

      All is working roughly as it should.

      Diskusage is kicking up an error now. So I will run of and find out why. If I can't I will be back :-)

      Regards, Bawdo2001

      • Graeme Mathieson


        Hmm, maybe it should provide a more informative error if it can't find tsearch2.sql...

        The diskusage error might be a known one (though I thought I'd fixed it!).  It doesn't work correctly if you have no tickets in the database.  Do you have some data in MailManager?  What error  is it returning?



    • Keith Bawden

      Keith Bawden - 2005-08-15


      Yes there are ten test tickets. And here is the error message:

      Site Error

      An error was encountered while publishing this resource.

      Error Type: TypeError
      Error Value: int() argument must be a string or a number

      Regards, Bawdo2001


Log in to post a comment.