Skip to content

Commit

Permalink
Docs and fixing highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
tlovett1 committed Sep 9, 2020
1 parent 1f7c0b9 commit 9d66437
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

**Upgrade Notice:** Versions 1.6.1, 1.6.2, 1.7, 1.8, 2.1, 2.1.2, 2.2, 2.7, 3.0, 3.1, and 3.3 require re-syncing.

*Check out the [ElasticPress Docs](http://10up.github.io/ElasticPress/)
* Check out the [ElasticPress Docs](http://10up.github.io/ElasticPress/)

## Overview

Expand Down
22 changes: 22 additions & 0 deletions docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ Much of ElasticPress's functionality is bundled into features. Here are the feat

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 synomym 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.
Expand All @@ -30,6 +46,12 @@ Indexes text inside of popular file types, and adds those files types to search

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.
Expand Down
2 changes: 1 addition & 1 deletion docs/install.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Requirements

* [Elasticsearch](https://www.elastic.co) 5.0+ **ElasticSearch max version supported: 7.5**
* [Elasticsearch](https://www.elastic.co) 5.0+ **ElasticSearch max version supported: 7.9**
* [WordPress](http://wordpress.org) 3.7.1+
* [PHP](https://php.net/) 5.4+
* A properly configured web server with object caching is highly recommended.
Expand Down
8 changes: 4 additions & 4 deletions includes/classes/Feature/Search/Highlighting.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Highlighting {
*
* @var array
*/
public $default_tags = [
public static $default_tags = [
'mark',
'span',
'strong',
Expand All @@ -34,7 +34,7 @@ class Highlighting {
*
* @var array
*/
public $default_settings = [
public static $default_settings = [
'highlight_enabled' => true,
'highlight_excerpt' => false,
'highlight_tag' => 'mark',
Expand Down Expand Up @@ -76,7 +76,7 @@ public function add_search_highlight_tags( $formatted_args, $args ) {

// get current config
$settings = $this->get_highlighting_configuration();
$settings = wp_parse_args( $settings, $this->default_settings );
$settings = wp_parse_args( $settings, self::default_settings );

if ( true !== $settings['highlight_enabled'] ) {
return $formatted_args;
Expand Down Expand Up @@ -214,7 +214,7 @@ public function ep_highlight_excerpt( $text ) {
* @return string
*/
public function get_highlighting_tag( $tag ) {
if ( ! in_array( $tag, $this->default_tags, true ) ) {
if ( ! in_array( $tag, self::default_tags, true ) ) {
$tag = 'mark';
}

Expand Down
4 changes: 2 additions & 2 deletions includes/classes/Feature/Search/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ public function output_feature_box_settings() {
}

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

?>
<div class="field js-toggle-feature" data-feature="<?php echo esc_attr( $this->slug ); ?>">
Expand All @@ -360,7 +360,7 @@ public function output_feature_box_settings() {
<div class="input-wrap">
<select id="highlight-tag" name="highlight-tag" class="setting-field" data-field-name="highlight_tag">
<?php
foreach ( $this->highlighting->default_tags as $option ) :
foreach ( Highlighting::$default_tags as $option ) :
echo '<option value="' . esc_attr( $option ) . '" ' . selected( $option, $settings['highlight_tag'] ) . '>' . esc_html( $option ) . '</option>';
endforeach;
?>
Expand Down

0 comments on commit 9d66437

Please sign in to comment.