Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
tlovett1 committed Dec 11, 2015
2 parents f8d94a4 + 479db06 commit 8632f86
Show file tree
Hide file tree
Showing 11 changed files with 1,146 additions and 149 deletions.
18 changes: 14 additions & 4 deletions Dockunit.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"containers": [
{
"prettyName": "PHP 5.6 FPM WordPress Latest",
"image": "dockunit/prebuilt-images:php-mysql-phpunit-elasticsearch-5.6-fpm",
"prettyName": "PHP 7.0 RC 6 FPM WordPress Latest with Elasticsearch 2.0",
"image": "dockunit/prebuilt-images:php-7.0-rc-6-fpm-mysql-phpunit-elasticsearch-2.0",
"beforeScripts": [
"service mysql start",
"service elasticsearch start",
Expand All @@ -11,8 +11,18 @@
"testCommand": "phpunit"
},
{
"prettyName": "PHP 5.2 FPM WordPress Latest",
"image": "dockunit/prebuilt-images:php-mysql-phpunit-elasticsearch-5.2-fpm",
"prettyName": "PHP 5.6 FPM WordPress Latest with Elasticsearch 2.0",
"image": "dockunit/prebuilt-images:php-5.6-fpm-mysql-phpunit-elasticsearch-2.0",
"beforeScripts": [
"service mysql start",
"service elasticsearch start",
"bash bin/install-wp-tests.sh wordpress_test root '' localhost latest"
],
"testCommand": "phpunit"
},
{
"prettyName": "PHP 5.2 FPM WordPress Latest with Elasticsearch 1.7",
"image": "dockunit/prebuilt-images:php-5.2-fpm-mysql-phpunit-elasticsearch-1.7",
"beforeScripts": [
"service mysql start",
"service elasticsearch start",
Expand Down
44 changes: 37 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
ElasticPress [![Build Status](https://travis-ci.org/10up/ElasticPress.svg?branch=master)](https://travis-ci.org/10up/ElasticPress) [![Code Climate](https://img.shields.io/codeclimate/coverage/github/10up/ElasticPress.svg?style=flat)](https://codeclimate.com/github/10up/ElasticPress) [![Dockunit Status](http://dockunit.io/svg/10up/ElasticPress?master)](http://dockunit.io/projects/10up/ElasticPress#master)
ElasticPress [![Build Status](https://travis-ci.org/10up/ElasticPress.svg?branch=master)](https://travis-ci.org/10up/ElasticPress) [![Dockunit Status](http://dockunit.io/svg/10up/ElasticPress?master)](http://dockunit.io/projects/10up/ElasticPress#master)
=============

Integrate [Elasticsearch](http://www.elasticsearch.org/) with [WordPress](http://wordpress.org/).

**Please note:** the master branch is the stable branch
**Please note:** the master branch is the stable

**Upgrade Notice:** Versions 1.6.1, 1.6.2, and 1.7 require re-indexing.

## Background

Expand Down Expand Up @@ -227,7 +229,7 @@ After running an index, ElasticPress integrates with `WP_Query` if and only if t

* ```meta_query``` (*array*)

Filter posts by post meta conditions. Takes an array of form:
Filter posts by post meta conditions. Meta arrays and objects are serialized due to limitations of Elasticsearch. Takes an array of form:

```php
new WP_Query( array(
Expand All @@ -242,7 +244,8 @@ After running an index, ElasticPress integrates with `WP_Query` if and only if t
) );
```

```meta_query``` accepts an array of arrays where each inner array *only* supports ```key``` (string), ```value``` (string|array|int), and ```compare``` (string) parameters. ```compare``` supports the following:
```meta_query``` accepts an array of arrays where each inner array *only* supports ```key``` (string),
```type``` (string), ```value``` (string|array|int), and ```compare``` (string) parameters. ```compare``` supports the following:

* ```=``` - Posts will be returned that have a post meta key corresponding to ```key``` and a value that equals the value passed to ```value```.
* ```!=``` - Posts will be returned that have a post meta key corresponding to ```key``` and a value that does NOT equal the value passed to ```value```.
Expand Down Expand Up @@ -275,6 +278,25 @@ After running an index, ElasticPress integrates with `WP_Query` if and only if t

Possible values for ```relation``` are ```OR``` and ```AND```. If ```relation``` is set to ```AND```, all inner queries must be true for a post to be returned. If ```relation``` is set to ```OR```, only one of the inner meta queries must be true for the post to be returned.

```type``` supports the following values: 'NUMERIC', 'BINARY', 'CHAR', 'DATE', 'DATETIME',
'DECIMAL', 'SIGNED', 'TIME', and 'UNSIGNED'. By default WordPress casts meta values to these types
in MySQL so some of these don't make sense in the context of Elasticsearch. ElasticPress does no "runtime"
casting but instead compares the value to a different type compiled during indexing

* `NUMERIC` - Compares query `value` to integer version of stored meta value.
* `SIGNED` - Compares query `value` to integer version of stored meta value.
* `UNSIGNED` - Compares query `value` to integer version of stored meta value.
* `BINARY` - Compares query `value` to raw, unanalyzed version of stored meta value. For actual attachment searches, check out [this](https://github.com/elastic/elasticsearch-mapper-attachments).
* `CHAR` - Compares query `value` to raw, unanalyzed version of stored meta value.
* `DECIMAL` - Compares query `value` to float version of stored meta value.
* `DATE` - Compares query `value` to date version of stored meta value. Query `value` must be formated like `2015-11-14`
* `DATETIME` - Compares query `value` to date/time version of stored meta value. Query `value` must be formated like `2012-01-02 05:00:00` or `yyyy:mm:dd hh:mm:ss`.
* `TIME` - Compares query `value` to time version of stored meta value. Query `value` must be formated like `17:00:00` or `hh:mm:ss`.

If no type is specified, ElasticPress will just deduce the type from the comparator used. ```type```
is very rarely needed to be used.


* ```post_type``` (*string*/*array*)

Filter posts by post type. ```any``` wil search all public post types. `WP_Query` defaults to either `post` or `any` if no `post_type` is provided depending on the context of the query. This is confusing. ElasticPress will ALWAYS default to `any` if no `post_type` is provided. If you want to search for `post` posts, you MUST specify `post` as the `post_type`.
Expand Down Expand Up @@ -467,9 +489,17 @@ The following are special parameters that are only supported by ElasticPress.

The following commands are supported by ElasticPress:

* `wp elasticpress index [--setup] [--network-wide] [--posts-per-page] [--no-bulk] [--offset]`
* `wp elasticpress index [--setup] [--network-wide] [--posts-per-page] [--no-bulk] [--offset] [--show-bulk-errors] [--post-type]`

Index all posts in the current blog.

Index all posts in the current blog. `--network-wide` will force indexing on all the blogs in the network. `--network-wide` takes an optional argument to limit the number of blogs to be indexed across where 0 is no limit. For example, `--network-wide=5` would limit indexing to only 5 blogs on the network. `--setup` will clear the index first and re-send the put mapping. `--posts-per-page` let's you determine the amount of posts to be indexed per bulk index (or cycle). `--no-bulk` let's you disable bulk indexing. `--offset` let's you skip the first n posts (don't forget to remove the `--setup` flag when resuming or the index will be emptied before starting again).
* `--network-wide` will force indexing on all the blogs in the network. `--network-wide` takes an optional argument to limit the number of blogs to be indexed across where 0 is no limit. For example, `--network-wide=5` would limit indexing to only 5 blogs on the network.
* `--setup` will clear the index first and re-send the put mapping.
* `--posts-per-page` let's you determine the amount of posts to be indexed per bulk index (or cycle).
* `--no-bulk` let's you disable bulk indexing.
* `--offset` let's you skip the first n posts (don't forget to remove the `--setup` flag when resuming or the index will be emptied before starting again).
* `--show-bulk-errors` displays the error message returned from Elasticsearch when a post fails to index (as opposed to just the title and ID of the post).
* `--post-type` let's you specify which post types will be indexed (by default: all indexable post types are indexed). For example, `--post-type="my_custom_post_type"` would limit indexing to only posts from the post type "my_custom_post_type". Accepts multiple post types separated by comma.

* `wp elasticpress activate`

Expand Down Expand Up @@ -553,4 +583,4 @@ If you identify any errors or have an idea for improving the plugin, please [ope

## License

ElasticPress is free software; you can redistribute it and/or modify it under the terms of the [GNU General Public License](http://www.gnu.org/licenses/gpl-2.0.html) as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
ElasticPress is free software; you can redistribute it and/or modify it under the terms of the [GNU General Public License](http://www.gnu.org/licenses/gpl-2.0.html) as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Loading

0 comments on commit 8632f86

Please sign in to comment.