| 开发者 | jtgraham38 |
|---|---|
| 更新时间 | 2026年9月4日 21:17 |
| PHP版本: | 8.1 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv3 or later |
| 版权网址: | 版权信息 |
window.scrySearch JS API. Same file ships in the plugin zip.
You get over 40 PHP hooks (scry_ms_*) covering indexing, documents, index settings, federated search, autosuggest, analytics, logs, and the front-end runtime. Call sites are marked in source. If you can install a plugin and paste API keys, you can run it without writing code. If you ship WordPress for a living, you can bend it without forking.
No theme changes. Not glued to a results UI.
This is the important bit:
search.php (or whatever your theme / builder uses) still renders the results.searchform.php, Elementor/Divi/Beaver search widgets — they still POST to WordPress; we intercept the query.posts_pre_query, run the search in Meilisearch, and hand WordPress normal WP_Post objects. Same loop, same template tags, same pagination assumptions your theme already has.
Need native WP search for one query? scry_ms_should_search.
Built-in semantic / hybrid search
Keyword search is the baseline. Hybrid search is built into the core plugin (not a separate SKU): Meilisearch blends full-text ranking with vector similarity so "fuzzy intent" queries still hit the right posts/products.
Per index, under Index Settings → Configure Index → Hybrid Search:
WP_Query path as keyword search. No second endpoint, no alternate results page. Reindex after embedder changes so vectors exist. Analytics can record hybrid usage in search_metadata.
What you configure in wp-admin
Most of Meilisearch’s knobs are in WordPress — you don’t need to curl the instance for day-to-day tuning.
Connection — URL, admin key, optional search-only key, connection test.
Index Settings (tabbed dialog per post type):
post_date_unix, taxonomy IDs (taxonomies.<name>.id), and more for facets / advanced filtersattribute:asc / attribute:desc.scry-ms-highlight).
Ops — task pane, Logs, Search Analytics (see For developers).
You can go live from these screens alone. Hooks kick in when a project needs something the UI doesn’t cover.
Autosuggest + highlighting (optional front-end extras)
These are the only front-end UI pieces the plugin ships, and both are off by default. Your theme’s results page stays yours either way.
Autosuggest — Search Settings toggle. The front-end runtime finds forms via CSS selectors (defaults: #adminbarsearch, form[role="search"], including the core Search block). Debounced AJAX, same indexes as full search. Optional form class if you only want typeahead on specific forms. Thumbnails when a featured image exists. Extend discovery selectors with scry_ms_window_localized — details in DOCS.md. Shape data with scry_ms_autosuggest_results or markup with scry_ms_autosuggest_results_rendered.
Highlighting — optional matched-term markup in results / autosuggest (class .scry-ms-highlight). Style it in your theme; we don’t force a look.
Indexes and federation
Each registered post type can get its own Meilisearch index (posts, pages, product, CPTs). Federated multi-search merges them with your Search Settings weights — not a home-rolled PHP merge.
WooCommerce: select product, pick product fields/meta, set weights if you also search posts/pages. Catalog search upgrades; theme and checkout stay as they are.
Ops: indexing
//@HOOK: scry_ms_… in source.
Task pane — drawer on plugin admin screens for Meilisearch tasks on indexes this plugin owns: status, duration, errors, paginated history. Shared Meilisearch instances won’t dump unrelated tasks. Useful when bulk indexing stalls or a settings update fails silently.
Error / debug logs — Scry Search → Logs. Debug and Error levels, filterable viewer, DB-backed newest-first with load-more, API keys/tokens redacted before storage, retention + daily cleanup (or clean on demand). Hook scry_ms_log_message if you need to divert or annotate lines.
Search analytics — Scry Search → Search Analytics. Dashboard with summary metrics, charts, and recent searches; optional IP anonymization / omit identifying fields; retention with WP-Cron cleanup; CSV export (admin-only, nonce-protected). Extend rows with scry_ms_analytics_event_to_insert (non-column keys go into search_metadata, including hybrid usage when enabled).
Filters — indexing / documents:
scry_ms_should_index, scry_ms_should_delete, scry_ms_index_prepare_documentscry_ms_index_names, scry_ms_index_searchable_attributes, scry_ms_index_filterable_attributes, scry_ms_index_filterable_fieldsscry_ms_index_typo_tolerance, scry_ms_index_ranking_rules, scry_ms_index_fields, scry_ms_index_meta_keysscry_ms_bulk_index_query_args, scry_ms_bulk_index_batch_sizescry_ms_index_settings_ajax, scry_ms_index_settings_backupscry_ms_index_ranking_rules_before_update, scry_ms_index_searchable_attributes_before_updatescry_ms_index_synonyms_before_update, scry_ms_index_stop_words_before_updatescry_ms_index_filterable_attributes_before_update, scry_ms_index_dictionary_before_update, scry_ms_index_typo_tolerance_before_updatescry_ms_should_search, scry_ms_meilisearch_clientscry_ms_multi_search_index_names, scry_ms_multi_search_query_params, scry_ms_multi_search_query, scry_ms_multi_search_queriesscry_ms_multi_search_federation, scry_ms_multi_search_raw_results, scry_ms_multi_search_final_resultsscry_ms_autosuggest_query, scry_ms_autosuggest_results, scry_ms_autosuggest_results_rendered, scry_ms_autosuggest_localizedscry_ms_admin_pages, scry_ms_analytics_event_to_insert, scry_ms_analytics_recent_searches_columns, scry_ms_analytics_recent_searches_column, scry_ms_log_message, scry_ms_window_localizedscry_ms_after_index_document, scry_ms_after_delete_document, scry_ms_after_bulk_index, scry_ms_after_create_indexscry_ms_index_settings_restore, scry_ms_index_update_settings, scry_ms_index_settings_sections_uiwindow.scrySearch (handle scry_ms_window-script). Wait for scrySearchReady. Forms from windowLocalized.searchFormSelectors; filter scry_ms_window_localized to add selectors (e.g. form.my-search). Per-form pre/post submit + AJAX hooks for custom front-end behavior.
Code lives under features/<name>/. Prefer a search-only key on the front; the client factory supports admin vs search.
Managed hosting (ScryWP)
Self-hosting is first-class. Paste any Meilisearch URL and keys into Connection Settings — Docker, bare metal, VPS, or local dev all work the same way. Pick post types, index, ship.
When you'd rather not run the search engine itself, ScryWP is managed hosting built for WordPress. What you get upfront:
scry_ms_* hooks behave the same as self-host.search.php / results markup — unchangedsearchform.php, core search block/widget, page-builder search boxesWP_Query or REST if you build onewp-content/plugins/ or via Plugins → Add New).add_filter( 'scry_ms_…' ).Deactivating clears the plugin's daily cron jobs (analytics and log cleanup) so they stop running while the plugin is inactive. Your settings, API keys, custom tables, and Meilisearch indexes are left in place — reactivating restores normal operation and re-schedules cron.
Deleting the plugin (uninstall) removes the two custom database tables (scry_ms_search_analytics, scry_ms_logs), all scry_ms_* options (connection keys, embedder secrets, index backups, etc.), and any remaining scheduled cron events. It does not delete indexes or documents on your Meilisearch server.
No for live saves — published posts with a password are skipped before indexing. Use scry_ms_should_index on bulk reindex (or always) if you need the same rule there. Already-indexed protected posts stay in Meilisearch until you reindex/wipe.
45 documented scry_ms_* hooks, call sites marked in source, shared client filter, and a real docs file — not a marketing PDF. Plus the tooling you’d actually use on a site: task pane for Meilisearch jobs, error/debug logs, and search analytics (dashboard + CSV). Start here: DOCS.md. Optional window.scrySearch if you need front-end glue. No forced search results UI.
Yes. Connect Meilisearch, pick post types, index, tune ranking/synonyms/weights/hybrid/autosuggest from wp-admin. Bring a developer when you need behavior the screens don't cover.
Optional. Keyword search works without it. Hybrid is in core when you want vector similarity alongside full-text — configure embedders per index, reindex, same results templates.
No. We don’t own your results page — your theme (or builder) still displays posts from WP_Query. Ranking, fields, synonyms, typo tolerance, hybrid, weights, etc. are configured in wp-admin. Autosuggest and highlighting are the optional front-end extras; leave them off and you’re indexing + query routing only.
No. Forms and search.php (or equivalent) keep working. We swap the query engine, not the markup. Page-builder search boxes that hit WordPress search work the same way.
Open-source, typo-tolerant search engine: meilisearch.com. This plugin assumes you already chose it (or will via ScryWP); we focus on the WordPress integration.
Self-host (or local dev) when you want full control, compliance boundaries, or you already run Meilisearch elsewhere. ScryWP when you'd rather not operate the engine — Meilisearch kept patched and monitored on the hosting side, same plugin integration (paste URL + keys like any instance). Federation, hybrid, and hooks work identically either way.
Yes. Each selected post type gets its own index. Meta shows up in searchable fields; tweak via admin or scry_ms_index_fields / scry_ms_index_meta_keys / scry_ms_index_prepare_document.
Meilisearch multi-search with federation across your indexes, using the weights you set in Search Settings. Adjust the request with scry_ms_multi_search_*.
Yes. Index product, choose fields/meta, set weights if you federate with other types. Theme and checkout stay unchanged.
Yes — per index in the Index Settings dialog (dedicated tabs), no Meilisearch config files required. Also filterable from code when you need that.
Yes. The Filterable Fields tab lets you pick core fields, taxonomy IDs, and related attributes. Defaults and the field tree are adjustable with scry_ms_index_filterable_attributes / scry_ms_index_filterable_fields.
Hook list is under For developers above. Common starters: scry_ms_should_index, scry_ms_index_prepare_document, scry_ms_meilisearch_client, scry_ms_autosuggest_results / scry_ms_autosuggest_results_rendered, scry_ms_admin_pages. Full signatures: DOCS.md.
Optional. Wait for scrySearchReady, then window.scrySearch + per-form pre/post (and AJAX) hooks. Skip it if you're not doing front-end work. Examples in DOCS.md.
Task pane for Meilisearch tasks on managed indexes; Scry Search → Logs for plugin debug/error lines (secrets redacted, retention available). See For developers.
Yes — Search Analytics includes CSV export, retention/cleanup, privacy options, and scry_ms_analytics_event_to_insert for extra fields. Covered under For developers.
AJAX nonces, capability checks, sanitized/escaped I/O. Prefer a search-only API key for front-end paths; the client factory supports admin vs search keys.
register_deactivation_hook clears daily analytics/log cron events; uninstall.php drops custom tables and deletes all scry_ms_* optionsscry_ms_should_index)estimatedTotalHits for found_posts / max_num_pages (no longer overwritten by the current page size)=, +, -, @, tab, or CR to prevent spreadsheet formula injectionscry_ms_analytics_recent_searches_columns, scry_ms_analytics_recent_searches_column, and optional scry_ms_analytics_recent_searches_sortable_columns; rows expose decoded search_metadatascry_ms_autosuggest_localized filter; remove hidden return_type input after AJAX so it does not leak into normal form submits#adminbarsearch, form[role="search"] by default), including Gutenberg Search block formsscry_ms_window_localized (searchFormSelectors)<form>search_metadata (scry_search_hybrid) when hybrid is activesearchableAttributes order)["*"] searchable attributes as all fields selectedtaxonomies.<name>.id) and post_date_unixattribute:asc / attribute:desc) with drag-and-drop ordering alongside built-in rulesscry_ms_index_filterable_attributes, scry_ms_index_filterable_fields, scry_ms_index_filterable_attributes_before_update, scry_ms_index_dictionary_before_update, scry_ms_index_typo_tolerance, scry_ms_index_typo_tolerance_before_update, scry_ms_bulk_index_batch_sizeshould_index, should_delete, should_search, after_index_document, after_delete_document, after_bulk_index, index_names, index_searchable_attributes, bulk_index_query_args, meilisearch_client, autosuggest_results, autosuggest_results_rendered, admin_pagesautosuggest_results_rendered hookindex_prepare_document gets WP_Post as second argdelete_post and untrash_post.scry-ms-highlight)scry_ms_analytics_event_to_insert stored in search_metadata (CSV too)scry_ms_* hooks; documented in DOCS.mdwindow.scrySearch JS API