Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
tlovett1 committed Nov 1, 2017
2 parents 49f1a4e + 0a73371 commit 2575230
Show file tree
Hide file tree
Showing 39 changed files with 3,635 additions and 644 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ root = true
[*]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[*.{php,js,css,scss}]
end_of_line = lf
Expand Down
14 changes: 9 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
language: php

addons:
apt:
packages:
- oracle-java8-set-default

notifications:
email:
on_success: never
Expand All @@ -10,13 +15,12 @@ php:
- "5.5"

env:
- WP_VERSION=latest WP_MULTISITE=1

services:
- elasticsearch
- WP_VERSION=latest WP_MULTISITE=1 ES_VERSION="5.0.2"
- WP_VERSION=latest WP_MULTISITE=1 ES_VERSION="5.2.2"
- WP_VERSION=latest WP_MULTISITE=1 ES_VERSION="5.5.1"

before_install:
- curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.2.2.deb && sudo dpkg -i --force-confnew elasticsearch-5.2.2.deb && sudo service elasticsearch restart
- curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ES_VERSION.deb && sudo dpkg -i --force-confnew elasticsearch-$ES_VERSION.deb && sudo service elasticsearch restart

before_script:
- composer install --dev
Expand Down
39 changes: 16 additions & 23 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,15 @@ module.exports = function ( grunt ) {
uglify : {

production : {
options : {
beautify : false,
preserveComments : false,
mangle : {
except : ['jQuery']
}
},

files : {
'assets/js/dashboard.min.js' : [
'assets/js/src/dashboard.js'
],
'assets/js/admin.min.js' : [
'assets/js/src/admin.js'
],
'features/autosuggest/assets/js/autosuggest.min.js': [
'features/autosuggest/assets/js/src/autosuggest.js'
]
}
}
Expand All @@ -36,11 +31,9 @@ module.exports = function ( grunt ) {
map : true
},

files : {
expand : true,
flatten : true,
src : ['assets/css/admin.css'],
dest : 'assets/css'
files: {
'assets/css/admin.css': ['assets/css/admin.css'],
'features/autosuggest/assets/css/autosuggest.min.css': ['features/autosuggest/assets/css/autosuggest.css']
}

},
Expand All @@ -49,13 +42,10 @@ module.exports = function ( grunt ) {

target : {

files : [{
expand : true,
cwd : 'assets/css',
src : ['admin.css'],
dest : 'assets/css',
ext : '.min.css'
}]
files: {
'assets/css/admin.min.css': ['assets/css/admin.css'],
'features/autosuggest/assets/css/autosuggest.min.css': ['features/autosuggest/assets/css/autosuggest.css']
}

}

Expand All @@ -72,7 +62,8 @@ module.exports = function ( grunt ) {
},

files : {
'assets/css/admin.css' : 'assets/css/admin.scss',
'assets/css/admin.css': 'assets/css/admin.scss',
'features/autosuggest/assets/css/autosuggest.css': 'features/autosuggest/assets/css/autosuggest.scss'
}

}
Expand Down Expand Up @@ -100,15 +91,17 @@ module.exports = function ( grunt ) {

scripts : {
files : [
'assets/js/src/*.js'
'assets/js/src/*.js',
'features/autosuggest/assets/js/src/*.js'
],
tasks : ['uglify:production']

},

styles : {
files : [
'assets/css/*.scss'
'assets/css/*.scss',
'features/autosuggest/assets/css/*.scss'
],
tasks : ['sass', 'autoprefixer', 'cssmin']
}
Expand Down
40 changes: 23 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ElasticPress integrates with the [WP_Query](http://codex.wordpress.org/Class_Ref

## Requirements

* [Elasticsearch](https://www.elastic.co) 1.7 - 5.2 (2.0+ highly recommended)
* [Elasticsearch](https://www.elastic.co) 1.7+ (5.0+ highly recommended)
* [WordPress](http://wordpress.org) 3.7.1+

## Installation
Expand Down Expand Up @@ -60,6 +60,10 @@ Optionally index all of your content, including private and unpublished content,

Indexes text inside of popular file types, and adds those files types to search results.

### Autosuggest

Suggest relevant content as text is entered into the search field.

## `WP_Query` and the ElasticPress Query Integration

ElasticPress integrates with `WP_Query` if the `ep_integrate` parameter is passed (see below) to the query object. If the search feature is activated (which it is by default), all queries with the `s` parameter will be integrated with as well. ElasticPress converts `WP_Query` arguments to Elasticsearch readable queries. Supported `WP_Query` parameters are listed and explained below. ElasticPress also adds some extra `WP_query` arguments for extra functionality.
Expand All @@ -78,7 +82,7 @@ ElasticPress integrates with `WP_Query` if the `ep_integrate` parameter is passe
'posts_per_page' => 20,
) );
```

Get all posts with a specific category slug
```php
new WP_Query( array(
Expand Down Expand Up @@ -122,8 +126,10 @@ ElasticPress integrates with `WP_Query` if the `ep_integrate` parameter is passe
) );
```

```tax_query``` accepts an array of arrays where each inner array *only* supports ```taxonomy``` (string), ```field``` (string), and
```terms``` (string|array) parameters. ```field``` must be set to `slug`, `name`, or `term_id`. The default value for `field` is `term_id`. ```terms``` must be a string or an array of term slug(s), name(s), or id(s).
```tax_query``` accepts an array of arrays where each inner array *only* supports ```taxonomy``` (string), ```field``` (string), `operator` (string), and
```terms``` (string|array) parameters. ```field``` must be set to `slug`, `name`, or `term_id`. The default value for `field` is `term_id`. ```terms``` must be a string or an array of term slug(s), name(s), or id(s). `operator` defaults to `in` and also supports `not in` and `and`.

The outer array supports the `relation` parameter. Acceptable values are `and` and `or`. The default is `and`.

* The following shorthand parameters can be used for querying posts by specific dates:

Expand Down Expand Up @@ -157,7 +163,7 @@ ElasticPress integrates with `WP_Query` if the `ep_integrate` parameter is passe
containing the following parameters ```after```, ```before```, ```inclusive```, ```compare```, ```column```, and
```relation```. ```column``` is used to query specific columns from the ```wp_posts``` table. This will return posts
which are created after January 1st 2012 and January 3rd 2012 8AM GMT:

```php
new WP_Query( array(
's' => 'search phrase',
Expand All @@ -173,7 +179,7 @@ ElasticPress integrates with `WP_Query` if the `ep_integrate` parameter is passe
),
) );
```

Currently only the ```AND``` value is supported for the ```relation``` parameter.

```inclusive``` is used on after/before options to determine whether exact value should be matched or not. If inclusive is used
Expand Down Expand Up @@ -254,9 +260,9 @@ ElasticPress integrates with `WP_Query` if the `ep_integrate` parameter is passe
) );
```

```meta_query``` accepts an array of arrays where each inner array *only* supports ```key``` (string),
```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```.
* ```>``` - Posts will be returned that have a post meta key corresponding to ```key``` and a value that is greater than the value passed to ```value```.
Expand Down Expand Up @@ -288,9 +294,9 @@ ElasticPress integrates with `WP_Query` if the `ep_integrate` parameter is passe

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"
```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.
Expand All @@ -303,7 +309,7 @@ ElasticPress integrates with `WP_Query` if the `ep_integrate` parameter is passe
* `DATETIME` - Compares query `value` to date/time version of stored meta value. Query `value` must be formatted 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 formatted like `17:00:00` or `hh:mm:ss`.

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

* ```meta_key``` (*string*)
Expand Down Expand Up @@ -341,23 +347,23 @@ ElasticPress integrates with `WP_Query` if the `ep_integrate` parameter is passe
* ```author``` (*int*)

Show posts associated with certain author ID.

* ```author_name``` (*string*)

Show posts associated with certain author. Use ```user_nicename``` (NOT name).

* ```orderby``` (*string*)

Order results by field name instead of relevance. Supports: ```title```, ```modified```, `meta_value`, `meta_value_num`, ```type```, ```name```, ```date```, and ```relevance```; anything else will be interpretted as a document path i.e. `meta.my_key.long` or `meta.my_key.raw`. You can sort by multiple fields as well i.e. `title meta.my_key.raw`

* ```order``` (*string*)

Which direction to order results in. Accepts ```ASC``` and ```DESC```. Default is ```DESC```.

* ```post_parent``` (*int*)

Show posts that have the specified post parent.


The following are special parameters that are only supported by ElasticPress.

Expand Down Expand Up @@ -428,7 +434,7 @@ The following are special parameters that are only supported by ElasticPress.
* ```aggs``` (*array*)

Add aggregation results to your search result. For example:

```php
new WP_Query( array(
's' => 'search phrase',
Expand Down
25 changes: 21 additions & 4 deletions assets/css/admin.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2575230

Please sign in to comment.