Skip to content

Commit

Permalink
Merge branch 'develop' into release/4.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeelia authored Jun 13, 2023
2 parents d1da750 + c3d3801 commit 12fb582
Show file tree
Hide file tree
Showing 17 changed files with 122 additions and 1,397 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Support Level](https://img.shields.io/badge/support-active-green.svg)](#support-level) [![Tests Status](https://github.com/10up/ElasticPress/actions/workflows/test.yml/badge.svg?branch=develop)](https://github.com/10up/ElasticPress) [![Release Version](https://img.shields.io/github/release/10up/ElasticPress.svg)](https://github.com/10up/ElasticPress/releases/latest) ![WordPress tested up to version](https://img.shields.io/wordpress/plugin/tested/elasticpress?label=WordPress) [![MIT License](https://img.shields.io/github/license/10up/ElasticPress.svg)](https://github.com/10up/ElasticPress/blob/develop/LICENSE.md)

* Check out the [ElasticPress Docs](https://10up.github.io/ElasticPress/)
* Check out the [ElasticPress Docs](https://elasticpress.zendesk.com/hc/en-us/sections/16550523637901-Developer-Documentation)

**Please note:** as of ElasticPress 4.0.0 `trunk` is the stable branch, built assets were removed from the `develop` branch, a ZIP with the plugin and its built assets are available on the [GitHub Releases page](https://github.com/10up/ElasticPress/releases), and will include a build script should you want to build assets from a branch. As such, please ensure you have updated any references you have from `master` to `trunk` or to GitHub releases depending on whether you require built assets or not.

Expand All @@ -14,7 +14,7 @@ ElasticPress, a fast and flexible search and query engine for WordPress, enables

## Documentation

* [Docs website ☞](https://10up.github.io/ElasticPress/)
* [Docs website ☞](https://elasticpress.zendesk.com/hc/en-us/sections/16550523637901-Developer-Documentation)
* [Support site with FAQs and tutorials ☞](https://elasticpress.zendesk.com/hc/en-us)
* [Security Policy ☞](https://github.com/10up/ElasticPress/blob/develop/SECURITY.md)

Expand Down
21 changes: 1 addition & 20 deletions docs/compatibility.md
Original file line number Diff line number Diff line change
@@ -1,20 +1 @@
ElasticPress requirements can be found in the [Requirements section](https://github.com/10up/ElasticPress#requirements) in our README. If your solution relies on a different server or version, you may find additional information in this document.

## Elasticsearch (Unsupported Versions)

The ElasticPress team updates minimum and maximum required versions for Elasticsearch when required to implement new features and ensure security. ElasticPress will warn you if the version detected is newer than the latest tested version, but all plugin functionality will continue to work. If you are succesfully using a more recent version of Elasticsearch than ElasticPress currently supports, please share your findings with us via a [Github issue](https://github.com/10up/ElasticPress/issues).

## OpenSearch

ElasticPress does not officially support OpenSearch in this version of the plugin, but our initial testing indicates basic ElasticPress functionality may be possible using OpenSearch. We do not recommend using OpenSearch in production at this time. Please provide any feedback about compability issues via a [Github issue](https://github.com/10up/ElasticPress/issues) and we will include it in a future OpenSearch compatibility release, should one occur.

Currently, if you want to run ElasticPress with any version of OpenSearch, you need to use a snippet like the following to set the compatible Elasticsearch mapping version for the version of OpenSearch you're running. Otherwise, ElasticPress will detect the version of OpenSearch and attempt to set the oldest possible Elasticsearch mapping, due to version number differences between Elasticsearch and OpenSearch.

```
add_filter(
'ep_elasticsearch_version',
function() {
return '7.10';
}
);
```
This content was moved and is currently available at https://elasticpress.zendesk.com/hc/en-us/articles/16677288265741-Compatibility
12 changes: 1 addition & 11 deletions docs/debugging.md
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
ElasticPress uses third party software (Elasticsearch) and touches critical WordPress functionality that many other plugins interact with e.g. WP_Query. As such, instances arise where ElasticPress conflicts with another plugin, Elasticsearch setups aren't compatible with ElasticPress, and bugs are discovered. Use this guide to debug ElasticPress issues.

## ElasticPress Debug Bar Plugin

The first thing to do when any ElasticPress issue occurs, is install the [ElasticPress Debug Bar Plugin](https://github.com/10up/debug-bar-elasticpress). This tool allows you to examine all the ElasticPress queries on each page load. It extends the standard [Debug Bar Plugin](https://wordpress.org/plugins/debug-bar/) so you'll need that too.

Navigate to the page that isn't behaving as expected. For example, if a search page is returning no results, go to that page and open the debug bar. It will show the ElasticPress query.

To examine indexing, enable querying logging in the ElasticPress Debug Bar admin settings page. This will keep a log of all queries that result in an error. Make sure not to leave this on too long as it can cause performance issues.

For a more in depth guide on debugging, check out this [blog post](https://www.elasticpress.io/blog/2017/05/debugging/).
This content was moved and is currently available at https://elasticpress.zendesk.com/hc/en-us/articles/16670678802189-Debugging
48 changes: 1 addition & 47 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -1,47 +1 @@
Developing for ElasticPress is easy. We provide tools that give you everything you need to test ElasticPress features and create Pull Requests. First thing you'll want to do is setup a local development environment.

## Local Development Environment
We highly recommend using [WP Local Docker V2](https://github.com/10up/wp-local-docker-v2) to develop for ElasticPress. This docker-based environment can be installed and setup via NPM. It comes with Elasticsearch out of the box.

After installing WP Local Docker V2, just run `10updocker create`. Use `elasticpress.test` as the hostname. Make sure to answer yes when it asks if you need Elasticsearch. After the site is created, follow the plugin install instructions.

In your `wp-config.php` file, insert the following to tell ElasticPress where Elasticsearch is located:

```
define( 'EP_HOST', 'http://elasticpress.test/__elasticsearch' );
```

Finally, run `composer install` in the root of the plugin.

Unit Testing
ElasticPress uses unit tests via the WordPress core unit testing library as well as acceptance tests with [WP Acceptance](https://github.com/10up/wpacceptance).

To run unit tests, assuming you are using WP Local Docker V2 and Elasticsearch is running, SSH into your docker container by running `10updocker shell`. Navigate to the root of the ElasticPress directory, first setup the test database:

```
composer run-script setup-local-tests
```

Now run the tests:

```
EP_HOST="http://elasticsearch:9200" phpunit
```

To run a specific test, pass the `--filter` parameter:

```
EP_HOST="http://elasticsearch:9200" phpunit --filter=testSanitizeCredentials
```

To verify all of the code paths are being tested, you can generate an HTML code coverage report for your tests. Pass `--coverage-html test-coverage-html` as a parameter and a report will be generated in that directory.

```
EP_HOST="http://elasticsearch:9200" phpunit --filter=testSanitizeCredentials --coverage-html test-coverage-html
```

To run WP Acceptance, navigate to the root of the plugin and run:

```
./vendor/bin/wpacceptance
```
This content was moved and is currently available at https://elasticpress.zendesk.com/hc/en-us/articles/16670964167309-Development
116 changes: 1 addition & 115 deletions docs/feature-api.md
Original file line number Diff line number Diff line change
@@ -1,115 +1 @@
Since ElasticPress 3.0, to register a feature you will need to extend the Feature class. Here is a code example:

```php
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}

/**
* Your feature class.
*/
class My_ElasticPress_Feature extends \ElasticPress\Feature {

/**
* Initialize feature settings.
*/
public function __construct() {
$this->slug = 'feature_slug';

$this->title = esc_html__( 'Feature Name', 'plugin-text-domain' );

$this->requires_install_reindex = true;
$this->default_settings = [
'my_feature_setting' => '',
];

parent::__construct();
}

/**
* Output feature box summary.
*/
public function output_feature_box_summary() {
?>
<p><?php esc_html_e( 'Your feature short description.', 'plugin-text-domain' ); ?></p>
<?php
}

/**
* Output feature box long
*/
public function output_feature_box_long() {
?>
<p><?php esc_html_e( 'Your feature long description.', 'plugin-text-domain' ); ?></p>
<?php
}

/**
* Setup your feature functionality.
* Use this method to hook your feature functionality to ElasticPress or WordPress.
*/
public function setup() {
add_filter( 'ep_post_sync_args', [ $this, 'method_example' ] );
}

/**
* Display field settings on the Dashboard.
*/
public function output_feature_box_settings() {
$settings = $this->get_settings();

if ( ! $settings ) {
$settings = [];
}

$settings = wp_parse_args( $settings, $this->default_settings );

?>
<div class="field js-toggle-feature" data-feature="<?php echo esc_attr( $this->slug ); ?>">
<div class="field-name status">
<label for="feature_my_feature_setting">
<?php esc_html_e( 'Your custom field', 'plugin-text-domain' ); ?>
</label>
</div>
<div class="input-wrap">
<input
type="text"
class="setting-field"
id="feature_my_feature_setting"
value="<?php echo empty( $settings['my_feature_setting'] ) ? '' : esc_attr( $settings['my_feature_setting'] ); ?>"
data-field-name="my_feature_setting">
<p class="field-description">
<?php esc_html_e( 'Your custom field description.', 'plugin-text-domain' ); ?>
</p>
</div>
</div>
<?php
}
}
```

The Feature class is an abstract class, which means it is **required** to implement some methods:
- `setup()`
- `output_feature_box_summary()`
- `output_feature_box_long()`

Optionally, you can implement some other methods, like `output_feature_box_settings()` to display additional setting fields, or `requirements_status()` to change the feature availability based on custom checks.

Don't forget to register your new feature:

```php
function load_my_elasticpress_feature() {
if ( class_exists( '\ElasticPress\Features' ) ) {
// Include your class file.
require 'class-my-elasticpress-feature.php';
// Register your feature in ElasticPress.
\ElasticPress\Features::factory()->register_feature(
new My_ElasticPress_Feature()
);
}
}
add_action( 'plugins_loaded', 'load_my_elasticpress_feature', 11 );
```

If you build an open source custom feature, let us know! We'd be happy to list the feature within ElasticPress documentation.
This content was moved and is currently available at https://elasticpress.zendesk.com/hc/en-us/articles/16671209163277-Feature-API
70 changes: 1 addition & 69 deletions docs/features.md
Original file line number Diff line number Diff line change
@@ -1,69 +1 @@
Much of ElasticPress's functionality is bundled into features. Here are the features:

## Search

Instantly find the content you’re looking for. The first time.

### Weighting Engine

The weighting engine lets you shift the search weighting of post fields across different post types.

__Note:__ This feature will NOT work if the plugin is network activated.

### Synonyms

Create synonym groups for your searches e.g. New York City and NYC.

__Note:__ This feature will NOT work if the plugin is network activated.

### Search Term Highlighting

Search terms will automatically be highlighted in search results. This can be disabled if unnecessary.

## WooCommerce

“I want a cotton, woman’s t-shirt, for under $15 that’s in stock.” Faceted product browsing strains servers and increases load times. Your buyers can find the perfect product quickly, and buy it quickly.

## Related Posts

ElasticPress understands data in real time, so it can instantly deliver engaging and precise related content with no impact on site performance.

Available API functions:

* `\ElasticPress\Features::factory()->get_registered_feature( 'related_posts' )->find_related( $post_id, $return = 5 )`

Get related posts for a given `$post_id`. Use this in a theme or plugin to get related content.

* `\ElasticPress\Features::factory()->get_registered_feature( 'related_posts' )->get_related_query( $post_id, $return = 5 )`

Get a `WP_Query` object with the related posts for a given `$post_id`.

## Protected Content

Optionally index all of your content, including private and unpublished content, to speed up searches and queries in places like the administrative dashboard.

## Documents (requires [Ingest Attachment plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest-attachment.html))

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.

## Custom Search Results

This feature lets you insert posts into specific searches. For example, "insert this post as the third result when someone searches ...".

__Note:__ This feature will NOT work if the plugin is network activated.

## Facets

Add controls to your website to filter content by one or more taxonomies.

## Users (requires WordPress 5.1+)

Improve user search relevancy and query performance.

## Terms (requires WordPress 5.3+)

Improve term search relevancy and query performance.
This content was moved and is currently available at https://elasticpress.zendesk.com/hc/en-us/articles/16671825423501-Features
Loading

0 comments on commit 12fb582

Please sign in to comment.