0
1

Is there any documentation anywhere on how to implement full-text search? We've implemented a module that does it and we have it working, but it's rather slow because the generated SQL is not always correct. We are trying to clean up the generated SQL but it seems to be used in more than one database query, and I'm not sure how to guarantee that the SQL includes what we need it to. In some cases, there are subqueries that are generated, and we need the predicate we add to the where clause to match the correlation name, but there's no way to know what that is.

Our modules returns self.extra() with an extra column, an extra table, a join condition, and an order by clause but the join condition is sometimes wrong. When we execute a search, at least three queries are actually executed and for the slowest one, the SQL looks something like:

select count(*) from forum_node
where ... 
   and forum_node.parent_id in (
   select distinct u0.id from forum_node u0, <our table>
   where ...
   and <our table>.node_id=forum_node.id  -- wrong!
...

In this case, we want forum_node.id in the predicate to be u0.id but there are other queries that don't use u0 as the correlation name. Is there a way to modify the query to do the right thing?

asked 21 Mar '11, 09:17

gperrow's gravatar image

gperrow
24651523
accept rate: 25%

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×62
×56
×11
×2

Asked: 21 Mar '11, 09:17

Seen: 454 times

Last updated: 21 Mar '11, 09:17

powered by OSQA