Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql General > Re: Text search...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 15433 of 16941
Post > Topic >>

Re: Text search with multiple tables

by mont.rothstein@[EMAIL PROTECTED] ("Mont Rothstein") May 1, 2008 at 09:51 AM

------=_Part_89_6084440.1209660673308
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I found a way to do this but I don't know if there is a better way.
What I did was to create a separate index on each table and construct a
query like:

SELECT * FROM a WHERE (to_tsvector(...) @[EMAIL PROTECTED]
 to_tsquery(...)) OR primaryKey
IN
(SELECT distinct(foreign_key) FROM b WHERE to_tsvector(...) @[EMAIL PROTECTED]
(...))

Is there a better way to do this?

Thanks,
-Mont


On Thu, May 1, 2008 at 8:48 AM, Mont Rothstein <mont.rothstein@[EMAIL PROTECTED]
>
wrote:

> Is it possible to perform a text search with tables A-->>B returning A
for
> matches in B?
> What I want to do is to be able take columns from both A and B and
perform
> a search based on the keywords entered by the user that matches A, B, or
> both but always returns A.
>
> Can this be done?
>
> Thanks,
> -Mont
>
>

------=_Part_89_6084440.1209660673308
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I found a way to do this but I don&#39;t know if there is a better
way.<div><br></div><div>What I did was to create a separate index on each
table and construct a query like:</div><div><br></div><div>SELECT * FROM a
WHERE (to_tsvector(...) @[EMAIL PROTECTED]
 to_tsquery(...)) OR primaryKey IN (SELECT
distinct(foreign_key) FROM b WHERE to_tsvector(...) @[EMAIL PROTECTED]
(...))</div>
<div><br></div><div>Is there a better way to do
this?</div><div><br></div><div>Thanks,</div><div>-Mont</div><div><br><br><div
class="gmail_quote">On Thu, May 1, 2008 at 8:48 AM, Mont Rothstein &lt;<a
href="mailto:mont.rothstein@[EMAIL PROTECTED]
">mont.rothstein@[EMAIL PROTECTED]
>&gt;
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px
#ccc solid;padding-left:1ex;">Is it possible to perform a text search with
tables A--&gt;&gt;B returning A for matches in B?<div><br></div><div>What I
want to do is to be able take columns from both A and B and perform a
search based on the keywords entered by the user that matches A, B, or
both but always returns A.</div>

<div><br></div><div>Can this be
done?</div><div><br></div><div>Thanks,</div><div>-Mont</div><font
color="#888888"><div><br></div>
</font></blockquote></div><br></div>

------=_Part_89_6084440.1209660673308--
 




 2 Posts in Topic:
Text search with multiple tables
mont.rothstein@[EMAIL PRO  2008-05-01 08:48:36 
Re: Text search with multiple tables
mont.rothstein@[EMAIL PRO  2008-05-01 09:51:13 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 12:18:51 CDT 2008.