Skip to content

Commit 1b3b5ae

Browse files
authored
Merge pull request #122 from alleyinteractive/release-0.4
0.4 Release
2 parents 4aa9387 + 4e3bda5 commit 1b3b5ae

35 files changed

+1889
-909
lines changed

.travis.yml

Lines changed: 67 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,98 @@
1-
sudo: false
2-
dist: trusty
1+
# Travis CI (MIT License) configuration file for SearchPress
2+
# @link https://travis-ci.org/
33

4-
language: php
4+
# Xenial does not start mysql by default
5+
services:
6+
- mysql
57

6-
notifications:
7-
email:
8-
on_success: never
9-
on_failure: change
8+
# Declare project language.
9+
# @link http://about.travis-ci.org/docs/user/languages/php/
10+
language: php
1011

12+
# Specify when Travis should build.
1113
branches:
1214
only:
1315
- master
16+
- /^release-.*$/
1417

1518
cache:
1619
directories:
1720
- $HOME/.composer/cache
1821
- $HOME/.config/composer/cache
1922

23+
# Git clone depth.
24+
git:
25+
depth: 1
26+
2027
matrix:
2128
include:
22-
- php: 5.4
23-
env: WP_VERSION=4.9.10 PHP_LINT=1 ES_VERSION=1.3.0
2429
- php: 5.6
25-
env: WP_VERSION=latest PHP_LINT=1 ES_VERSION=1.7.6
30+
env: WP_VERSION=4.9.10 PHP_LINT=1 ES_VERSION=1.7.6
31+
dist: trusty
2632
- php: 7.0
27-
env: WP_VERSION=nightly WP_PHPCS=1 ES_VERSION=5.6.0
28-
- php: 7.1
2933
env: WP_VERSION=latest PHP_LINT=1 ES_VERSION=2.4.6
34+
dist: trusty
35+
- php: 7.1
36+
env: WP_VERSION=latest PHP_LINT=1 ES_VERSION=5.6.16
37+
dist: xenial
3038
- php: 7.2
31-
env: WP_VERSION=nightly PHP_LINT=1 ES_VERSION=6.4.1
39+
env: WP_VERSION=latest PHP_LINT=1 ES_VERSION=6.8.8
40+
dist: xenial
41+
- php: 7.3
42+
env: WP_VERSION=nightly PHP_LINT=1 WP_PHPCS=1 ES_VERSION=7.6.2
43+
dist: xenial
3244

3345
install:
3446
- bash bin/install-es.sh $ES_VERSION
3547

48+
# Prepare your build for testing.
49+
# Failures in this section will result in build status 'errored'.
3650
before_script:
3751
- export PATH="$HOME/.config/composer/vendor/bin:$HOME/.composer/vendor/bin:$PATH"
38-
- |
39-
if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then
40-
phpenv config-rm xdebug.ini
41-
else
42-
echo "xdebug.ini does not exist"
43-
fi
52+
53+
# Turn off Xdebug. See https://core.trac.wordpress.org/changeset/40138.
54+
- phpenv config-rm xdebug.ini || echo "Xdebug not available"
55+
4456
- |
4557
if [[ ! -z "$WP_VERSION" ]] ; then
4658
bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
47-
composer global require "phpunit/phpunit=4.8.*|5.7.*"
4859
fi
60+
61+
# Couple the PHPUnit version to the PHP version.
62+
- |
63+
case "$TRAVIS_PHP_VERSION" in
64+
5.6)
65+
echo "Using PHPUnit 4.8"
66+
composer global require "phpunit/phpunit=4.8.*"
67+
;;
68+
*)
69+
echo "Using PHPUnit 6.1"
70+
composer global require "phpunit/phpunit=6.1.*"
71+
;;
72+
esac
73+
4974
- |
5075
if [[ "$WP_PHPCS" == "1" ]]; then
5176
composer global require automattic/vipwpcs
5277
phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs,$HOME/.composer/vendor/automattic/vipwpcs
5378
fi
54-
- sleep 5
55-
- curl localhost:9200 && echo "ES is up" || (cat /tmp/elasticsearch.log && exit 1)
56-
- phpunit --version
57-
- which phpunit
79+
80+
# Wait up to 60 seconds until ES is up, or die if it never comes up.
81+
- |
82+
failures=0
83+
curl localhost:9200;
84+
while [[ $? -ne 0 && $failures -lt 60 ]]; do
85+
sleep 1
86+
((failures++))
87+
curl localhost:9200
88+
done
89+
90+
if [ $? -ne 0 ]; then
91+
echo "Elasticsearch is unavailable."
92+
cat /tmp/elasticsearch.log
93+
exit 1
94+
fi
95+
5896
5997
script:
6098
- if [[ "$PHP_LINT" == "1" ]]; then find . -type "f" -iname "*.php" | xargs -L "1" php -l; fi
@@ -64,3 +102,8 @@ script:
64102

65103
after_script:
66104
- cat /tmp/elasticsearch.log
105+
106+
# Receive notifications for build results.
107+
# @link http://docs.travis-ci.com/user/notifications/#Email-notifications
108+
notifications:
109+
email: false

README.md

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Each stable release will be tagged and you'll be able to [download that release
1616
Prerequisites
1717
-------------
1818

19-
* [elasticsearch](https://www.elastic.co/products/elasticsearch) 1.3+; 5.0 recommended.
19+
* [elasticsearch](https://www.elastic.co/products/elasticsearch) 1.7+; 5.0+ recommended.
2020
* PHP 5.3+; PHP 7 recommended.
2121

2222

@@ -29,9 +29,72 @@ Setup
2929
4. Once indexing is complete, you're good to go!
3030

3131

32+
Indexing Post Meta
33+
------------------
34+
35+
In early versions of SearchPress, SearchPress would index almost all post meta with the post. Starting in the 0.4 release, SearchPress only indexes the post meta that it is explicitly told to index. Further, it only indexes post meta in the _data types_ that a site's developer plans to use. The principal reason behind this change is performance, and to prevent ["mappings explosion"](https://www.elastic.co/guide/en/elasticsearch/reference/master/mapping.html#mapping-limit-settings).
36+
37+
Data type casting will only be attempted for a key if the opt-in callback specifies that type for the key in question (see example below for the full list of possible types). However, the data type will still only be indexed if the type casting is successful. For example, attempting to index the meta value `"WordPress"` as a `long` would fail, since it is not a numeric value. This failure is silent, for better or worse, but type casting is overall quite forgiving.
38+
39+
If a meta key is allowed to be indexed, the meta value will _always_ be indexed as an unanalyzed string (`post_meta.*.raw`) and that type need not be specified. This is primarily for compatibility with [ES_WP_Query](https://github.com/alleyinteractive/es-wp-query), which depends on that key in `EXISTS` queries, among others.
40+
41+
### How to index post meta
42+
43+
```php
44+
add_filter(
45+
'sp_post_allowed_meta',
46+
function( $allowed_meta ) {
47+
// Tell SearchPress to index 'some_meta_key' post meta when encountered.
48+
$allowed_meta['some_meta_key'] = [
49+
'value', // Index as an analyzed string.
50+
'boolean', // Index as a boolean value.
51+
'long', // Index as a "long" (integer).
52+
'double', // Index as a "double" (floating point number).
53+
'date', // Index as a GMT date-only value in the format Y-m-d.
54+
'datetime', // Index as a GMT datetime value in the format Y-m-d H:i:s.
55+
'time', // Index as a GMT time-only value in the format H:i:s.
56+
];
57+
return $allowed_meta;
58+
}
59+
);
60+
```
61+
3262
Changelog
3363
---------
3464

65+
### 0.4
66+
67+
* **CRITICAL BREAKING CHANGE:** Post meta indexing is now opt-in. See README for more information.
68+
* Adds support for ES 5.x, 6.x, 7.x
69+
* Fixes indexing bug with parentless attachments
70+
* Fixes a bug with bulk syncing attachments
71+
* Improves flexibility for custom indexing of posts
72+
* Improves facet lists to exclude current selections
73+
* Adds option in the admin to index content without flushing
74+
* Fixes bug with cached list of post types to sync
75+
* Fixes conflicts with Advanced Post Cache and CLI-based cron runners
76+
* Adds completion suggester API for search-as-you-type functionality
77+
* Fixes bug with SSL cert verification
78+
* Overhaul of phpunit testing environment for performance
79+
* General coding standards cleanup
80+
81+
82+
### 0.3
83+
84+
* Adds heartbeat to monitor Elasticsearch
85+
* Improves capabilities handling for admin settings
86+
* Adds a status tab to admin page
87+
* Improves test coverage for heartbeat and admin settings
88+
* Fixes bug with post type facet field
89+
* Allows multiple post IDs to be passed to cli index command
90+
* Locally cache API host to improve external referencing to it
91+
* Fixes edge case bugs with indexing, e.g. with long meta strings
92+
* Improves indexed/searched post types and statuses handling
93+
* Tests across a wider range of ES versions using CI
94+
* Stores/checks mapping version
95+
* General code improvements
96+
97+
3598
### 0.2
3699

37100
* Adds unit testing

README.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
Contributors: mboynes, alleyinteractive
33
Tags: search, elasticsearch, faceted search, performance
44
Requires at least: 4.8.0
5-
Tested up to: 5.2
6-
Stable tag: 0.3
5+
Tested up to: 5.4
6+
Stable tag: 0.4
77
License: GPLv2 or later
88
License URI: http://www.gnu.org/licenses/gpl-2.0.html
99

@@ -17,7 +17,7 @@ server.
1717

1818
== Prerequisites ==
1919

20-
* PHP 5.3+
20+
* PHP 5.6+
2121
* Elasticsearch
2222

2323
== Installation ==

assets/admin.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@
3333
width: 500px;
3434
max-width: 100%;
3535
}
36+
.tools_page_searchpress span.explanation {
37+
display:block;
38+
font-size: 90%;
39+
padding-left: 24px;
40+
font-style: italic;
41+
}
3642
#searchpress-stats {
3743
margin: 20px 0;
3844
}

bin/install-es.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ if [ $# -lt 1 ]; then
66
fi
77

88
ES_VERSION=$1
9-
echo $JAVA_HOME
109

1110
setup_es() {
1211
download_url=$1
@@ -24,13 +23,14 @@ if [[ "$ES_VERSION" == 1.* ]]; then
2423
setup_es https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz
2524
elif [[ "$ES_VERSION" == 2.* ]]; then
2625
setup_es https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/${ES_VERSION}/elasticsearch-${ES_VERSION}.tar.gz
27-
else
26+
elif [[ "$ES_VERSION" == [56].* ]]; then
2827
setup_es https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz
28+
else
29+
setup_es https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ES_VERSION}-linux-x86_64.tar.gz
2930
fi
3031

31-
# java_home='/usr/lib/jvm/java-8-oracle'
32-
if [[ "$ES_VERSION" == [56].* ]]; then
33-
start_es '-Epath.repo=/tmp -Enetwork.host=_local_'
34-
else
32+
if [[ "$ES_VERSION" == [12].* ]]; then
3533
start_es '-Des.path.repo=/tmp'
34+
else
35+
start_es '-Epath.repo=/tmp -Enetwork.host=_local_'
3636
fi

0 commit comments

Comments
 (0)