brandonwamboldt / wp-orm

[Unmaintained] Light weight ORM for WordPress
MIT License
176 stars 35 forks source link

Method to add meta clause to the search query #9

Open antongorodezkiy opened 10 years ago

antongorodezkiy commented 10 years ago

Method to add meta clause to the search query

josegonzalez commented 10 years ago

same here...

josegonzalez commented 10 years ago

@brandonwamboldt this one seems like the better pr to try and merge, as it allows people to make their own find_one_by_meta implementation if they so chose.

brandonwamboldt commented 10 years ago

@josegonzalez It's not quite how I'd want to do it, so I'm working on a bit more flexible way of doing a where on a joined table, that way it's not restricted to custom post types/regular post types (I primarily work with custom tables).

josegonzalez commented 10 years ago

Gotcha, works for me. We also use custom tables at work, so that would be ideal :)

I would therefore close these two PRs

antongorodezkiy commented 10 years ago

Hello, @brandonwamboldt I used subqueries because I had negative exerience with JOINs for post meta before. You can try too if you have time. Try 6-7 meta conditions or more. In my case I used JOINs first and then had to rewrite all of them to subqueries, because 7 meta JOINs increased query time up to 30 seconds.

brandonwamboldt commented 10 years ago

@antongorodezkiy I'll evaluate both, though that wasn't the issue I was referring to. You've hard coded the table as $wpdb->postmeta. I may still add these functions in, but I'd like a more general purpose version as well :smile:

antongorodezkiy commented 10 years ago

@brandonwamboldt oh, sorry) I really missed that hardcode. :+1: