wp-orm icon indicating copy to clipboard operation
wp-orm copied to clipboard

Method to add meta clause to the search query

Open antongorodezkiy opened this issue 10 years ago • 7 comments

Method to add meta clause to the search query

antongorodezkiy avatar Aug 07 '14 17:08 antongorodezkiy

same here...

josegonzalez avatar Sep 09 '14 19:09 josegonzalez

@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.

josegonzalez avatar Sep 11 '14 14:09 josegonzalez

@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).

brandonwamboldt avatar Sep 11 '14 15:09 brandonwamboldt

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

I would therefore close these two PRs

josegonzalez avatar Sep 11 '14 15:09 josegonzalez

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.

antongorodezkiy avatar Sep 11 '14 15:09 antongorodezkiy

@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:

brandonwamboldt avatar Sep 11 '14 16:09 brandonwamboldt

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

antongorodezkiy avatar Sep 11 '14 16:09 antongorodezkiy