Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id C956BB5DBCC for ; Tue, 14 Jun 2011 17:42:56 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 07243-02 for ; Tue, 14 Jun 2011 20:42:50 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pz0-f46.google.com (mail-pz0-f46.google.com [209.85.210.46]) by mail.postgresql.org (Postfix) with ESMTP id 3B7E8B5D80B for ; Tue, 14 Jun 2011 17:42:50 -0300 (ADT) Received: by pzk9 with SMTP id 9so2824765pzk.19 for ; Tue, 14 Jun 2011 13:42:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=o6G/BsrJ35GH5BY0mvjirkaznxdaYHvw7jcjcuMoaec=; b=CODcYMuF+a36WhIvrSFBqULtua1Whf7zlleAAEeVBO51My1eZfow57dskzliHsgj9r +kAAm0F5xc3fKfU7hE/dV5DOCVLRakko0m0kORJoGqITpBpvZyOV+iwlEKb4kwtk/B90 wJxnp6eYiK7IAkuFil6+5KoUcdrGV5yqyAGIc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=JhgF3u0leBKrtzTjw7fX8iH3roNDQDn1esTiLN3OHjzrIawvQKCAcADLC6wJHW/gTV 5BHLrBeI0cWzoe+0/w/cs/wHWm5zeOstrRyTGRTyQtm7VWvHH4DTgPZRIjMCef3CamYL /R55lWr7EzxlVgqW3MxkNO03VVsnhvnCCzE0w= MIME-Version: 1.0 Received: by 10.68.0.99 with SMTP id 3mr3403702pbd.375.1308084169586; Tue, 14 Jun 2011 13:42:49 -0700 (PDT) Received: by 10.68.50.40 with HTTP; Tue, 14 Jun 2011 13:42:49 -0700 (PDT) In-Reply-To: References: <4DF7275C020000250003E59F@gw.wicourts.gov> <4DF7399B020000250003E5AB@gw.wicourts.gov> Date: Tue, 14 Jun 2011 16:42:49 -0400 Message-ID: Subject: Re: tsvector limitations From: Tim To: pgsql-admin@postgresql.org Cc: Kevin Grittner Content-Type: multipart/alternative; boundary=bcaec521555343b97304a5b2148c X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.887 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RFC_ABUSE_POST=0.001, T_TO_NO_BRKTS_FREEMAIL=0.01 X-Spam-Level: X-Archive-Number: 201106/72 X-Sequence-Number: 37698 --bcaec521555343b97304a5b2148c Content-Type: text/plain; charset=ISO-8859-1 So I ran this test: unzip -p text.docx word/document.xml | perl -p -e 's/<.+?>/\n/g;s/[^a-z0-9\n]/\n/ig;'|grep ".." > text.txt ls -hal ./text.* #-rwxrwxrwx 1 postgres postgres 15M 2011-06-14 15:12 ./text.docx #-rwxrwxrwx 1 postgres postgres 29M 2011-06-14 15:17 ./text.txt mv /tmp/text.* /var/lib/postgresql/9.0/main/ cd ~/;psql -d postgres #psql (9.0.4) CREATE DATABASE test; \q cd ~/;psql -d test CREATE TABLE test(title VARCHAR(256), data OID, words TSVECTOR); INSERT INTO test VALUES ( 'text.docx', LO_IMPORT('text.docx'), TO_TSVECTOR(pg_read_file('text.txt' ,0, 100000000)) ); and I got this: #ERROR: string is too long for tsvector (30990860 bytes, max 1048575 bytes) doing the math echo "scale=3;29/(30990860/1048575)"|bc #==0.981 Indicates a (worst case) limit of searching only the first 1MB of a text file before you need to start building your own search maybe on top of tsvector. The year is 2011 I don't think searching a 2MB text file is to much to expect. So how am I to use the PGSQL FTS as a "full text search" when the above example can only handle a "small or partial text search"? If I'm not missing anything maybe the documentation should be adjusted accordingly. Any thoughts or alternatives are most welcome. --bcaec521555343b97304a5b2148c Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable So I ran this test:
unzip -p text.docx= word/document.xml | perl -p -e 's/<.+?>/\n/g;s/[^a-z0-9\n]/\n/ig= ;'|grep ".." > text.txt
ls -hal ./text.*
#-rwxrwxrwx 1 postgres postgres 15M 2011-06-14 15:12 ./= text.docx
#-rwxrwxrwx 1 postgres postgres 29M 2011-06-14 15:17 ./text.tx= t
mv /tmp/text.* /var/lib/postgresql/9.0/main/
cd ~/;psql -d postgres=
#psql (9.0.4)
CREATE DATABASE test;
\q
cd ~/;psql -d test
CREAT= E TABLE test(title VARCHAR(256), data OID, words TSVECTOR);
INSERT INTO = test VALUES (=A0 'text.docx',=A0 LO_IMPORT('text.docx'),=A0= TO_TSVECTOR(pg_read_file('text.txt' ,0, 100000000))=A0 );

and I got this:
#ERROR:=A0 string is too long for tsvector (30990860 bytes, max 1048575 byt= es)

doing the math
echo = "scale=3D3;29/(30990860/1048575)"|bc #=3D=3D0.981

In= dicates a (worst case) limit of searching only the first 1MB of a text file= before you need to start building your own search maybe on top of tsvector= .
The year is 2011 I don't think searching a 2MB text file is to much to = expect.
So how am I to use the PGSQL FTS as a "full text search&quo= t; when the above example can only handle a "small or partial text sea= rch"?
If I'm not missing anything maybe the documentation should be adjusted = accordingly.

Any thoughts or alternatives are most welcome.
--bcaec521555343b97304a5b2148c--