integrating custom search function to additional database table

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

integrating custom search function to additional database table

Stefan Hartweg
Hi,
I'm still looking for answers on how to interface my own search function
with the wordpress loop to display the results. I don't think I have really
explained what I'm trying to do:

I'm working on a plugin that is supposed to make queries to a table I
created in addition to the existing Wordpress tables.
I created the table because I needed to add extra data to posts and the meta
value table would not have an efficient way to store the data.
The table contains the post ID as well as the additional data fields. The
queries results will be a list of post ID's that match a certain set of data
fields.

With the list of post ID's I then want to query the posts database and
display the search results, like the existing search function displays them.

My problem is, I don't know how I can make my search function talk Wordpress
so that the results (i.e. the posts that match certain values from my own
table) get displayed on a page, using the loop?
I don't think I can use any use filters such as posts_where, as this uses
Wordpress' own query and not my own, or can I?

I've been stewing over this for a few days now and any help would be greatly
appreciated.

Thanks.
Steve

 

_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|

Re: integrating custom search function to additional database table

Andy Skelton
On 5/3/06, Stefan Hartweg <[hidden email]> wrote:
> My problem is, I don't know how I can make my search function talk Wordpress
> so that the results (i.e. the posts that match certain values from my own
> table) get displayed on a page, using the loop?
> I don't think I can use any use filters such as posts_where, as this uses
> Wordpress' own query and not my own, or can I?

Two more filters to consider:
posts_join (along with posts_where, you can accomplish your search in one query)
posts_request (total control over the query, if you're daring)

Andy
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|

RE: integrating custom search function to additionaldatabase table

Stefan Hartweg
Thanks Andy.

The query is one issue, the bigger problem I have at the moment is how to
execute my own query first and then use these results to CALL the actual
Wordpress search, since I'm not using the Wordpress search form.
In non programming terms: how do I get Wordpress to "execute the stuff it
would normally execute when someone pushes the Search button" i.e. find the
posts, display the results in the template doing the loop, etc...

Steve

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Andy Skelton
Sent: Thursday, 4 May 2006 9:38 AM
To: [hidden email]
Subject: Re: [wp-hackers] integrating custom search function to
additionaldatabase table

On 5/3/06, Stefan Hartweg <[hidden email]> wrote:
> My problem is, I don't know how I can make my search function talk
Wordpress
> so that the results (i.e. the posts that match certain values from my own
> table) get displayed on a page, using the loop?
> I don't think I can use any use filters such as posts_where, as this uses
> Wordpress' own query and not my own, or can I?

Two more filters to consider:
posts_join (along with posts_where, you can accomplish your search in one
query)
posts_request (total control over the query, if you're daring)

Andy
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers

_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|

Re: integrating custom search function to additionaldatabase table

Andy Skelton
On 5/3/06, Stefan Hartweg <[hidden email]> wrote:
> In non programming terms: how do I get Wordpress to "execute the stuff it
> would normally execute when someone pushes the Search button" i.e. find the
> posts, display the results in the template doing the loop, etc...

Let's put some specs on this. Do you already know exactly which post
IDs you want to display? If that's the ticket, just add something like
" ID in (1, 2, 3)" with the posts_where filter.

Bring a spec.

Andy
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|

RE: integrating custom search function toadditionaldatabase table

Stefan Hartweg
Thank you for your help guys, I think Andy pointed me to just the right
resource. I can't believe that didn't come up when I was search the
Wordpress site.
Thank you again for your assistance and responsiveness, I really appreciate
it.

Steve


-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Andy Skelton
Sent: Thursday, 4 May 2006 10:22 AM
To: [hidden email]
Subject: Re: [wp-hackers] integrating custom search function
toadditionaldatabase table

On 5/3/06, Stefan Hartweg <[hidden email]> wrote:
> In non programming terms: how do I get Wordpress to "execute the stuff it
> would normally execute when someone pushes the Search button" i.e. find
the
> posts, display the results in the template doing the loop, etc...

Let's put some specs on this. Do you already know exactly which post
IDs you want to display? If that's the ticket, just add something like
" ID in (1, 2, 3)" with the posts_where filter.

Bring a spec.

Andy
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers



_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers