On 05-07-2012 05:07, Roberto Rosario wrote:
Wow! Awesome! I will include this in the next maintenance release
for the 0.12 series. Thanks a lot!
On Wednesday, July 4, 2012 5:47:22 PM UTC-4, vfigueiro wrote:
Roberto Rosario Gonzalez <roberto.rosario.gonzalez@...> writes:
>
>
> Yes, Postgresql complains about some parts of the search code
whereas MySQL
and SQLite work Ok. This one of the reasons I'm switching Mayan
to a dedicated
engine like Haystack, it is planned to be done during this
development cycle
right when I finish the inital workflow app.
>
> On Mar 16, 2012 2:40 AM, "Сергей Глита"
<[email protected]> wrote:
> Hi, Roberto!
> Search does not work for the field "comment"
> Maybe it's because pgsql
> Django sends the following query
> 'SELECT "documents_document"."id" FROM "documents_document" LEFT
OUTER
> JOIN "documents_documenttype" ON
> ("documents_document"."document_type_id" =
> "documents_documenttype"."id") LEFT OUTER JOIN
> "documents_documentversion" ON ("documents_document"."id" =
> "documents_documentversion"."document_id") LEFT OUTER JOIN
> "metadata_documentmetadata" ON ("documents_document"."id" =
> "metadata_documentmetadata"."document_id") LEFT OUTER JOIN
> "documents_documentpage" ON ("documents_documentversion"."id" =
> "documents_documentpage"."document_version_id") LEFT OUTER JOIN
> "taggit_taggeditem" ON ("documents_document"."id" =
> "taggit_taggeditem"."object_id") LEFT OUTER JOIN "taggit_tag" ON
> ("taggit_taggeditem"."tag_id" = "taggit_tag"."id") LEFT OUTER JOIN
> "django_comments" ON ("documents_document"."id" =
> "django_comments"."object_pk") WHERE
> (UPPER("documents_documenttype"."name"::text) LIKE UPPER(%s) OR
> UPPER("documents_documentversion"."mimetype"::text) LIKE
UPPER(%s) OR
> UPPER("documents_documentversion"."filename"::text) LIKE
UPPER(%s) OR
> UPPER("metadata_documentmetadata"."value"::text) LIKE UPPER(%s) OR
> UPPER("documents_documentpage"."content"::text) LIKE UPPER(%s) OR
> UPPER("documents_document"."description"::text) LIKE UPPER(%s) OR
> (UPPER("taggit_tag"."name"::text) LIKE UPPER(%s) AND
> "taggit_taggeditem"."content_type_id" = %s ) OR
> (UPPER("django_comments"."comment"::text) LIKE UPPER(%s) AND
> "django_comments"."content_type_id" = %s )) ORDER BY
> "documents_document"."date_added" DESC'
> and scolds me for
> ERROR: operator does not exist: integer = text
> LEFT OUTER JOIN "django_comments" ON ("documents_document"."id" =
> "django_comments"."object_pk")
> No operator matches the given name and argument type(s). You might
> need to add explicit type casts.
>
>
Hi!
just had the same problem... it seems the only issue regarding
search with
postgresql is that the comments contrib app uses object_pk instead
of object_id
for the GenericForeignKey.
If someone really wants to use postgresql before a permanent fix
or new search
engine is available, it works if you paste the following hack at
the end of
apps/dynamic_search/models.py:
from django.db import connection
if connection.vendor == 'postgresql':
from django.db.models.sql.compiler import SQLCompiler
orig_get_from_clause = SQLCompiler.get_from_clause
def get_from_clause(self):
result, extra = orig_get_from_clause(self)
result = map(lambda s:
s.replace('"django_comments"."object_pk"',
'"django_comments"."object_pk"::integer'),
result)
return result, extra
SQLCompiler.get_from_clause = get_from_clause
Welcome :) congrats and thank you for sharing Mayan!