You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
+
32
62
Changelog
33
63
---------
34
64
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
0 commit comments