=== PrismSearch ===
Contributors: wteam
Tags: search, ajax-search, site-search, fuzzy-search, frontend-search
Requires at least: 6.2
Tested up to: 7.1
Stable tag: 1.0.3
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Fast frontend AJAX search for WordPress posts, pages, public custom post types and taxonomies with an optimized inverted index.

== Description ==

PrismSearch builds a custom inverted index for fast frontend search and provides a live AJAX search box through a simple shortcode.

= Features =

* Fast inverted-index based search.
* Frontend AJAX search shortcode.
* Search indexing for posts, pages and public custom post types.
* Indexing for selected public taxonomy terms.
* Frontend metadata display in live search results.
* Configurable NLP language for tokenization.
* Fuzzy typo matching fallback.
* Optional replacement for the default WordPress search results page.
* Search rate limiting for live search requests (50 requests per IP address per minute by default; configurable or disable with 0).
* Live index updates when selected content is saved, updated, trashed or deleted.
* Optional frontend.css loading for theme authors who want to write their own CSS.
* Optional Enter key redirect to the full WordPress search results page.
* Template overrides from your theme.

= Supported NLP languages =

PrismSearch includes NLP processors for the following language codes. The selected language is used for tokenization and search processing.

* English: en
* German: de
* French: fr
* Spanish: es
* Portuguese: pt
* Italian: it
* Dutch: nl
* Danish: da
* Swedish: sv
* Norwegian: no
* Finnish: fi
* Polish: pl
* Czech: cs
* Slovak: sk
* Slovenian: sl
* Croatian: hr
* Serbian: sr
* Bulgarian: bg
* Romanian: ro
* Hungarian: hu
* Greek: el
* Turkish: tr
* Russian: ru
* Ukrainian: uk
* Lithuanian: lt
* Latvian: lv
* Estonian: et
* Indonesian: id
* Vietnamese: vi
* Japanese: ja
* Chinese: zh
* Korean: ko
* Arabic: ar
* Persian: fa
* Hebrew: he
* Thai: th

Some CJK and script-based languages use basic normalization and token support. Test the selected language processor with your own content before production use.

= Shortcode =

Add the live search box anywhere with:

`[prismsearch]`

Optional shortcode attributes:

`[prismsearch min_chars="3" limit="10" placeholder="Search..."]`

Enable or disable Enter key redirect per shortcode:

`[prismsearch enter_redirect="1"]`

`[prismsearch enter_redirect="0"]`


= Privacy and external services =

PrismSearch performs indexing, tokenization and search locally inside WordPress. It does not send site content, search queries or user data to external services, and it does not load remote frontend or admin assets.

= Included third-party libraries =

PrismSearch includes Select2 4.1.0 for enhanced admin multi-select fields. Select2 is MIT licensed; the license file is included at `assets/vendor/select2/LICENSE.md`. The Select2 source project is available at https://github.com/select2/select2.

= Templates and styling =

PrismSearch loads its default frontend stylesheet unless disabled in the settings.

Developers can also disable the default stylesheet with:

`add_filter( 'prismsearch_load_frontend_css', '__return_false' );`

Template files can be overridden in your theme by placing files in:

`template/prismsearch/`

For example:

`template/prismsearch/item.php`

== Installation ==

1. Upload the `prismsearch` folder to the `/wp-content/plugins/` directory, or install the plugin ZIP through the WordPress Plugins screen.
2. Activate the plugin through the Plugins screen in WordPress.
3. Go to Settings > PrismSearch.
4. Select posts, pages, public custom post types and any taxonomy terms you want PrismSearch to index.
5. Select frontend meta keys if you want to display metadata in live search results.
6. Click Build Index.
7. Add `[prismsearch]` to a page, post, widget, block, or theme template.

After changing indexed content, taxonomy or NLP language settings, build the index again.

== Frequently Asked Questions ==

= Does PrismSearch replace the default WordPress search? =

It can. Enable "Override default WordPress search" in the PrismSearch settings to use PrismSearch results on the regular WordPress `?s=` search results page.

= What content can PrismSearch index? =

PrismSearch indexes posts, pages, selected public custom post types and selected public taxonomy terms.

= Can I display custom meta fields in live search results? =

Yes. Select the fields under "Frontend meta keys" to include those values in frontend AJAX results. These fields are displayed only; they are not indexed for search.

= Does PrismSearch support typo tolerance? =

Yes. Enable fuzzy typo matching in the settings. Fuzzy matching runs as a fallback when normal search returns fewer results than the configured threshold.

= What is the default live-search rate limit? =

PrismSearch allows 50 frontend search requests per IP address per minute by default. Change this value in Settings > PrismSearch > Security, or set it to 0 to disable rate limiting.

= Why do I need to build the index? =

PrismSearch uses its own optimized search index. The index must be built after installation and rebuilt after changing indexed content or language settings.

= Does PrismSearch update the index automatically? =

Yes, if live index updates are enabled. The plugin can reindex selected content when it is saved, updated, trashed or deleted.

= Can I disable the plugin frontend CSS? =

Yes. Enable "Disable frontend.css" in the settings if you want to write your own CSS. Developers can also use the `prismsearch_load_frontend_css` filter.

= Can Enter open the full search results page? =

Yes. Enable "Redirect on Enter" in the settings, or use `enter_redirect="1"` in the shortcode.

= Can I customize result templates? =

Yes. Copy the plugin template files into your theme under `template/prismsearch/` and edit them there.

== Screenshots ==

1. PrismSearch settings screen with content, frontend, NLP language, fuzzy search, security and advanced sections.
2. Live AJAX search dropdown on the frontend.
3. Index management screen with progress indicator and rebuild controls.

== Changelog ==

= 1.0.3 =

* Enable indexing for all selected public post types, including public custom post types.
* Harden database table creation queries with prepared identifier placeholders and non-interpolated charset/collation handling.
* Improve attachment/inherit status handling for indexed content.

= 1.0.2 =

* Code cleanup and simplification.

= 1.0.1 =

* Review update.

= 1.0.0 =

* Initial release.

== Upgrade Notice ==

= 1.0.3 =
Public custom post types can now be selected for indexing. Rebuild the index after updating.

= 1.0.2 =
Code cleanup and simplification. No action is required after updating.
