Skip to content

Commit

Permalink
Merge branch 'develop' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeelia committed Aug 10, 2023
2 parents 4dc189c + 47027dd commit fcc0d0e
Show file tree
Hide file tree
Showing 159 changed files with 9,109 additions and 4,698 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
/gulp-tasks export-ignore
/lang export-ignore
/tests export-ignore
/vendor/ export-ignore
/node_modules export-ignore

/.babelrc export-ignore
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/build-and-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.0' # Minimum required version
coverage: none

- name: composer install
run: composer install --no-dev -o

- name: install node v18
uses: actions/setup-node@v3
with:
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/cypress-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: E2E Test

env:
COMPOSER_VERSION: "2"
COMPOSER_CACHE: "${{ github.workspace }}/.composer-cache"
NODE_VERSION: "18"
NODE_CACHE: "${{ github.workspace }}/node_modules_cache"

Expand Down Expand Up @@ -37,6 +39,24 @@ jobs:
restore-keys: |
npm-${{ env.NODE_VERSION }}-
- name: Prepare composer cache
uses: actions/cache@v3
with:
path: ${{ env.COMPOSER_CACHE }}
key: composer-${{ env.COMPOSER_VERSION }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer-${{ env.COMPOSER_VERSION }}-
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.0'
tools: cs2pr
coverage: none

- name: composer install
run: composer install --no-dev -o

- name: "Install node v${{ env.NODE_VERSION }}"
uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -101,6 +121,24 @@ jobs:
restore-keys: |
npm-${{ env.NODE_VERSION }}-
- name: Prepare composer cache
uses: actions/cache@v3
with:
path: ${{ env.COMPOSER_CACHE }}
key: composer-${{ env.COMPOSER_VERSION }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer-${{ env.COMPOSER_VERSION }}-
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.0'
tools: cs2pr
coverage: none

- name: composer install
run: composer install --no-dev -o

- name: "Install node v${{ env.NODE_VERSION }}"
uses: actions/setup-node@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ jobs:
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.2'
tools: cs2pr
coverage: none

- name: composer install
run: composer install
run: composer install --ignore-platform-reqs

- name: PHPCS check
run: './vendor/bin/phpcs . -q --report=checkstyle --runtime-set testVersion 7.0- | cs2pr'
49 changes: 49 additions & 0 deletions .github/workflows/test-build-with-vendor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build with vendor (test)

on:
pull_request:
branches:
- develop
- '[0-9].[0-9x]*' # Version branches: 4.x.x, 4.1.x, 5.x

jobs:
wordpress:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.0' # Minimum required version
coverage: none

- name: composer install
run: composer install --no-dev -o

- name: install node v18
uses: actions/setup-node@v3
with:
node-version: 18

- name: Build
run: |
npm ci
npm run build
- name: Setup
run: 'echo "VERSION=$(grep -Po ''\"version\": \"[0-9\\.]+\"'' package.json | grep -Po ''[0-9\\.]+'')" >> $GITHUB_ENV'

- name: Zip
run: npm run build:zip

- name: Make artifacts available
uses: actions/upload-artifact@v3
with:
name: cypress-artifact
retention-days: 2
path: |
${{ github.workspace }}/elasticpress.zip
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Setup Elasticsearch
uses: getong/[email protected]
with:
elasticsearch version: '7.5.0'
elasticsearch version: '7.10.1'

- name: Set standard 10up cache directories
run: |
Expand All @@ -55,11 +55,11 @@ jobs:
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.2'
coverage: none

- name: Install dependencies
run: composer install
run: composer install --ignore-platform-reqs

- name: Setup WP Tests
run: |
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
- name: Setup Elasticsearch
uses: getong/[email protected]
with:
elasticsearch version: '7.5.0'
elasticsearch version: '7.10.1'

- name: Set standard 10up cache directories
run: |
Expand All @@ -108,11 +108,11 @@ jobs:
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.2'
coverage: none

- name: Install dependencies
run: composer install
run: composer install --ignore-platform-reqs

- name: Setup WP Tests
run: |
Expand Down
60 changes: 60 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,65 @@ All notable changes to this project will be documented in this file, per [the Ke
### Security
-->

## [4.7.0] - 2023-08-10

**Note that starting from the ElasticPress 5.0.0 release the `Users` feature will be moved to the [ElasticPress Labs](https://github.com/10up/ElasticPressLabs) plugin. The `Terms` and `Comments` features will remain in ElasticPress but will be available only if enabled via code. Check [our blog post](https://www.elasticpress.io/blog/2023/03/enabling-comments-and-terms-in-elasticpress-5-0) for more info.**

### Added
* Exclude Media Attachments from search results. Props [@burhandodhy](https://github.com/burhandodhy) via [#3539](https://github.com/10up/ElasticPress/pull/3539).
* New `Default to Site Language` option in the language dropdown in ElasticPress' settings page. Props [@felipeelia](https://github.com/felipeelia) via [#3550](https://github.com/10up/ElasticPress/pull/3550).
* Compatibility with block themes for the Facet meta blocks. Props [@felipeelia](https://github.com/felipeelia) via [#3498](https://github.com/10up/ElasticPress/pull/3498).
* Integrate Did You Mean feature in the Instant Results. Props [@burhandodhy](https://github.com/burhandodhy) and [@JakePT](https://github.com/JakePT) via [#3564](https://github.com/10up/ElasticPress/pull/3564).
* All blocks now support styling features in themes that support them. Props [@JakePT](https://github.com/JakePT) via [#3403](https://github.com/10up/ElasticPress/pull/3403) and [#3584](https://github.com/10up/ElasticPress/pull/3584).
* Descriptions and keywords have been added to all blocks. Props [@JakePT](https://github.com/JakePT) via [#3403](https://github.com/10up/ElasticPress/pull/3403).
* New `ep_stop` filter, that changes the stop words used according to the language set. Props [@felipeelia](https://github.com/felipeelia) via [#3549](https://github.com/10up/ElasticPress/pull/3549).
* New `get-index-settings` WP-CLI command. Props [@felipeelia](https://github.com/felipeelia) via [#3547](https://github.com/10up/ElasticPress/pull/3547).
* New `ep_facet_tax_special_slug_taxonomies` filter. Props [@oscarssanchez](https://github.com/oscarssanchez) via [#3506](https://github.com/10up/ElasticPress/pull/3506).
* New `--stop-on-error` flag to the `sync` command. Props [@oscarssanchez](https://github.com/oscarssanchez) via [#3500](https://github.com/10up/ElasticPress/pull/3500).
* New `get` WP-CLI command. Props [@felipeelia](https://github.com/felipeelia) via [#3567](https://github.com/10up/ElasticPress/pull/3567).
* Transient utility functions. Props [@felipeelia](https://github.com/felipeelia) via [#3551](https://github.com/10up/ElasticPress/pull/3551).
* Indices' language settings in status reports. Props [@felipeelia](https://github.com/felipeelia) via [#3552](https://github.com/10up/ElasticPress/pull/3552).
* Initial changes to implement a DI Container. Props [@felipeelia](https://github.com/felipeelia) and [@tott](https://github.com/tott) via [#3559](https://github.com/10up/ElasticPress/pull/3559).
* New `$only_indexable` parameter to the `Utils\get_sites()` function. Props [@felipeelia](https://github.com/felipeelia) via [#3577](https://github.com/10up/ElasticPress/pull/3577).

### Changed
* WooCommerce feature only integrates with queries that are the main query, a search, or have ep_integrate set as true. Props [@felipeelia](https://github.com/felipeelia) via [#3546](https://github.com/10up/ElasticPress/pull/3546).
* Miscellaneous changes to all blocks, including their category, names, and code structure. Props [@JakePT](https://github.com/JakePT), [@oscarssanchez](https://github.com/oscarssanchez), and [@felipeelia](https://github.com/felipeelia) via [#3403](https://github.com/10up/ElasticPress/pull/3403).
* The Facets feature was renamed to Filters. Props [@JakePT](https://github.com/JakePT) and [@felipeelia](https://github.com/felipeelia) via [#3403](https://github.com/10up/ElasticPress/pull/3403), [#3581](https://github.com/10up/ElasticPress/pull/3581), and [#3597](https://github.com/10up/ElasticPress/pull/3597).
* The WooCommerce feature was refactored, separating code related to products and orders. Props [@felipeelia](https://github.com/felipeelia) via [#3502](https://github.com/10up/ElasticPress/pull/3502).
* Transients deletion during uninstall. Props [@felipeelia](https://github.com/felipeelia) via [#3548](https://github.com/10up/ElasticPress/pull/3548).
* Bump Elasticsearch version to 7.10.2 for E2E tests. Props [@burhandodhy](https://github.com/burhandodhy) via [#3556](https://github.com/10up/ElasticPress/pull/3556) and [#3561](https://github.com/10up/ElasticPress/pull/3561).
* Refactor `get_settings()` usage inside ElasticPress features. Props [@oscarssanchez](https://github.com/oscarssanchez) and [@felipeelia](https://github.com/felipeelia) via [#3558](https://github.com/10up/ElasticPress/pull/3558).
* In a multisite, if a site is indexable or not is now stored in site meta, instead of a blog option. Props [@felipeelia](https://github.com/felipeelia) via [#3571](https://github.com/10up/ElasticPress/pull/3571).
* Autosuggest authenticated requests are not cached anymore and are only sent during the sync process or when the weighting dashboard is saved. Props [@felipeelia](https://github.com/felipeelia) and [@kovshenin](https://github.com/kovshenin) via [#3566](https://github.com/10up/ElasticPress/pull/3566).
* Use `createRoot` instead of `render` to render elements. Props [@oscarssanchez](https://github.com/oscarssanchez), [@burhandodhy](https://github.com/burhandodhy), [@JakePT](https://github.com/JakePT), and [@felipeelia](https://github.com/felipeelia) via [#3573](https://github.com/10up/ElasticPress/pull/3573) and [#3595](https://github.com/10up/ElasticPress/pull/3595).
* Moved methods to abstract Facet classes. Props [@oscarssanchez](https://github.com/oscarssanchez) and [@felipeelia](https://github.com/felipeelia) via [#3499](https://github.com/10up/ElasticPress/pull/3499).
* Only display available languages in the Settings screen. Props [@felipeelia](https://github.com/felipeelia) and [@JakePT](https://github.com/JakePT) via [#3587](https://github.com/10up/ElasticPress/pull/3587).
* WooCommerce feature description. Props [@brandwaffle](https://github.com/brandwaffle), [@felipeelia](https://github.com/felipeelia), and [@JakePT](https://github.com/JakePT) via [#3592](https://github.com/10up/ElasticPress/pull/3592).

### Deprecated
* `Autosuggest::delete_cached_query()` was deprecated without a replacement. See [#3566](https://github.com/10up/ElasticPress/pull/3566).
* `EP_Uninstaller::delete_related_posts_transients()` and `EP_Uninstaller::delete_total_fields_limit_transients()` was merged into `EP_Uninstaller::delete_transients_by_name`. See [#3548](https://github.com/10up/ElasticPress/pull/3548).
* The `ep_woocommerce_default_supported_post_types` filter was split into `ep_woocommerce_orders_supported_post_types` and `ep_woocommerce_products_supported_post_types`. See [#3502](https://github.com/10up/ElasticPress/pull/3502).
* The `ep_woocommerce_supported_taxonomies` filter is now `ep_woocommerce_products_supported_taxonomies`. See [#3502](https://github.com/10up/ElasticPress/pull/3502).
* All old `WooCommerce\Orders` methods were migrated to the new `WooCommerce\OrdersAutosuggest` class. See [#3502](https://github.com/10up/ElasticPress/pull/3502).
* The `Elasticsearch::clear_total_fields_limit_cache()` method was replaced by `Elasticsearch::clear_index_settings_cache()`. See [#3552](https://github.com/10up/ElasticPress/pull/3552).
* Several methods that were previously part of the `WooCommerce\WooCommerce` class were moved to the new `WooCommerce\Product` class. See [#3502](https://github.com/10up/ElasticPress/pull/3502).
* Several methods that were specific to Facet types were moved to the new `Block` and `Renderer` abstract classes. See [#3499](https://github.com/10up/ElasticPress/pull/3499).

### Fixed
* Same error message being displayed more than once on the Dashboard sync. Props [@felipeelia](https://github.com/felipeelia), [@MARQAS](https://github.com/MARQAS), [@tott](https://github.com/tott), and [@wildberrylillet](https://github.com/wildberrylillet) via [#3557](https://github.com/10up/ElasticPress/pull/3557).
* Sync media item when attaching or detaching media. Props [@MARQAS](https://github.com/MARQAS) and [@felipeelia](https://github.com/felipeelia) via [#3562](https://github.com/10up/ElasticPress/pull/3562).
* Display "Loading results" instead of "0 results" on first search using Instant Results. Props [@oscarssanchez](https://github.com/oscarssanchez) and [@JakePT](https://github.com/JakePT) via [#3568](https://github.com/10up/ElasticPress/pull/3568).
* Highlighting returning inaccurate post title when partial/no term match on Instant Results. Props [@oscarssanchez](https://github.com/oscarssanchez), [@JakePT](https://github.com/JakePT), and [@tomi10up](https://github.com/tomi10up) via [#3575](https://github.com/10up/ElasticPress/pull/3575).
* Warning in Orders Autosuggest: `"Creation of dynamic property $search_template is deprecated"`. Props [@burhandodhy](https://github.com/burhandodhy) via [#3591](https://github.com/10up/ElasticPress/pull/3591).
* Warning while using PHP 8.1+: `Deprecated: version_compare(): Passing null to parameter #1 ($version1) of type string is deprecated`. Props [@felipeelia](https://github.com/felipeelia) and [@burhandodhy](https://github.com/burhandodhy) via [#3593](https://github.com/10up/ElasticPress/pull/3593).
* Warning in the metadata range facet renderer: `Undefined array key "is_preview"`. Props [@felipeelia](https://github.com/felipeelia) and [@burhandodhy](https://github.com/burhandodhy) via [#3594](https://github.com/10up/ElasticPress/pull/3594).

### Security
* Bumped `word-wrap` from 1.2.3 to 1.2.4. Props [@dependabot](https://github.com/dependabot) via [#3543](https://github.com/10up/ElasticPress/pull/3543).
* Bumped `tough-cookie` from 4.1.2 to 4.1.3 and `@cypress/request` from 2.88.10 to 2.88.12. Props [@dependabot](https://github.com/dependabot) via [#3583](https://github.com/10up/ElasticPress/pull/3583).

## [4.6.1] - 2023-07-05

**Note that starting from the ElasticPress 5.0.0 release the `Users` feature will be moved to the [ElasticPress Labs](https://github.com/10up/ElasticPressLabs) plugin. The `Terms` and `Comments` features will remain in ElasticPress but will be available only if enabled via code. Check [our blog post](https://www.elasticpress.io/blog/2023/03/enabling-comments-and-terms-in-elasticpress-5-0) for more info.**
Expand Down Expand Up @@ -1852,6 +1911,7 @@ This is a bug fix release with some filter additions.
- Initial plugin release

[Unreleased]: https://github.com/10up/ElasticPress/compare/trunk...develop
[4.7.0]: https://github.com/10up/ElasticPress/compare/4.6.1...4.7.0
[4.6.1]: https://github.com/10up/ElasticPress/compare/4.6.0...4.6.1
[4.6.0]: https://github.com/10up/ElasticPress/compare/4.5.2...4.6.0
[4.5.2]: https://github.com/10up/ElasticPress/compare/4.5.1...4.5.2
Expand Down
2 changes: 2 additions & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ Thank you to all the people who have already contributed to this repository via
[Nabi (@navidabdi)](https://github.com/navidabdi)
[Dmitry Seleznyov (@selim13)](https://github.com/selim13)
[Martin Widmann (@mwidmann)](https://github.com/mwidmann)
[xxx (@wildberrylillet)](https://github.com/wildberrylillet)
[@tomi10up](https://github.com/tomi10up)
and
[@qazaqstan2025](https://github.com/qazaqstan2025).

Expand Down
3 changes: 0 additions & 3 deletions assets/css/facets-admin.css

This file was deleted.

23 changes: 18 additions & 5 deletions assets/js/api-search/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@ export const ApiSearchProvider = ({
isOn: defaultIsOn,
isPoppingState: false,
searchResults: [],
searchedTerm: '',
totalResults: 0,
suggestedTerms: [],
isFirstSearch: true,
searchTerm: '',
});

/**
Expand All @@ -119,7 +121,7 @@ export const ApiSearchProvider = ({
stateRef.current = state;

/**
* Clear facet contraints.
* Clear facet constraints.
*
* @returns {void}
*/
Expand All @@ -128,7 +130,7 @@ export const ApiSearchProvider = ({
}, []);

/**
* Clear search resu;ts.
* Clear search results.
*
* @returns {void}
*/
Expand Down Expand Up @@ -325,8 +327,17 @@ export const ApiSearchProvider = ({
/**
* Provide state to context.
*/
const { aggregations, args, isLoading, isOn, searchResults, searchTerm, totalResults } =
stateRef.current;
const {
aggregations,
args,
isLoading,
isOn,
searchResults,
searchTerm,
totalResults,
suggestedTerms,
isFirstSearch,
} = stateRef.current;

// eslint-disable-next-line react/jsx-no-constructed-context-values
const contextValue = {
Expand All @@ -347,6 +358,8 @@ export const ApiSearchProvider = ({
previousPage,
totalResults,
turnOff,
suggestedTerms,
isFirstSearch,
};

return <Context.Provider value={contextValue}>{children}</Context.Provider>;
Expand Down
4 changes: 4 additions & 0 deletions assets/js/api-search/src/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ export default (state, action) => {
const {
hits: { hits, total },
aggregations,
suggest,
} = action.response;

newState.isFirstSearch = false;

/**
* Total number of items.
*/
Expand All @@ -67,6 +70,7 @@ export default (state, action) => {
newState.searchResults = hits;
newState.searchTerm = newState.args.search;
newState.totalResults = totalNumber;
newState.suggestedTerms = suggest?.ep_suggestion?.[0]?.options || [];

break;
}
Expand Down
Loading

0 comments on commit fcc0d0e

Please sign in to comment.