Skip to content

Commit

Permalink
Merge pull request #31 from alleyinteractive/29-meta-query-updates
Browse files Browse the repository at this point in the history
Improve congruity between ES_WP_Meta_Query and WP_Meta_Query
  • Loading branch information
mboynes committed Mar 8, 2016
2 parents a0e3e12 + 8a243a3 commit 917f868
Show file tree
Hide file tree
Showing 4 changed files with 1,996 additions and 419 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A drop-in replacement for WP_Query to leverage Elasticsearch for complex queries

## Warning!

This plugin is currently in pre-alpha development, and as such, no part of it is guaranteed. It works (the unit tests prove that), but we won't be concerned about backwards compatibility until the first release. If you choose to use this, please pay close attention to the commit log to make sure we don't break anything you've implemented.
This plugin is currently in beta development, and as such, no part of it is guaranteed. It works (the unit tests prove that), but we won't be concerned about backwards compatibility until the first release. If you choose to use this, please pay close attention to the commit log to make sure we don't break anything you've implemented.


## Instructions for use
Expand Down Expand Up @@ -45,6 +45,15 @@ In one regard, this is a safer way to use this library, because it will fall bac

Regardless of which way you use the library, everything else about the object should work as per usual.

## Differences with WP_Query and Unsupported Features

### Meta Queries

* **Regexp comparisons are not supported.** The regular expression syntax is slightly different in Elasticsearch vs. PHP, so even if we tried to support them, it would result in a lot of unexpected behaviors. Furthermore, regular expressions are very resource-intensive in Elasticsearch, so you're probably better off just using WP_Query for these queries regardless.
* If you try to use a regexp query, ES_WP_Query will throw a `_doing_it_wrong()` notice.
* **LIKE comparisons are incongruous with MySQL.** In ES_WP_Query, LIKE-comparison meta queries will run a `match` query against the analyzed meta values. This will behave similar to a keyword search and will generally be more useful than a LIKE query in MySQL. However, there are notably differences with the MySQL implementation and ES_WP_Query will very likely produce different search results, so don't expect it to be a drop-in replacement.


## A note about WP_Query filters

Since this library removes MySQL from most of the equation, the typical WP_Query filters (`posts_where`, `posts_join`, etc.) become irrelevant or -- in some extreme situations -- conflicting.
Expand Down
Loading

0 comments on commit 917f868

Please sign in to comment.