=== Smarter Search for Products & Posts ===
Contributors: crashguru
Donate link: https://ai-assist.co.za
Tags: wp-search, wc-search, woocommerce, ai-search, sku
Requires at least: 5.6
Tested up to: 6.9
Requires PHP: 7.4
Requires Plugins: woocommerce
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

AI‑powered smarter search for WordPress and WooCommerce — with natural language understanding, SKU support, and graceful fallback.

== Description ==
** Smarter Search for Products & Posts ** enhances the standard search in WordPress and WooCommerce by using AI, powered by the [Groq API](https://groq.com).  
Natural language queries are parsed into structured JSON filters (category, name, price, SKU), producing more relevant search results for products and content.  
If AI processing fails or times out, the plugin automatically falls back to the built‑in WooCommerce/WordPress search.

**Features**
* Extracts product name, category, min_price, and max_price from natural language queries.
* SKU-aware:  
  * Exact SKU → direct redirect to product page.  
  * Partial SKU → product search with SKU filter.  
* Mixed results template: display products + posts/pages together.  
* Customizable form styling: adjustable input width/height, aligned margins.  
* Multisite compatible with network activation.  
* Graceful fallback: if the AI API fails, plugin reverts to standard search.  

== External Service Disclosure ==
This plugin connects to the [Groq API](https://groq.com).  
The plugin sends only the **user's search query text** to Groq in order to compute structured search parameters.  
No personal or identifying user data is sent.  

The [Groq API Terms of Service](https://groq.com/terms) and [Privacy Policy](https://groq.com/privacy) apply to data transmitted through this plugin.

You must provide your own Groq API key, available free at <https://console.groq.com/keys>.

== Installation ==
1. Upload the plugin folder to `/wp-content/plugins/` or install via **Plugins → Add New → Upload Plugin**.
2. Activate the plugin via **Plugins → Installed Plugins**.
3. (Multisite) → Can be Network Activated.
4. Flush permalinks after activation: **Settings → Permalinks → Save Changes**.

== Configuration ==
1. Go to **Settings →  Smarter Search for WooCommerce and WordPress Posts**.  
2. Enter your **Groq API Key** (available at <https://console.groq.com/keys>).  
3. Choose your preferred LLM model and temperature.  
4. (Optional) Update the system prompt to customize JSON extraction. Example:

```json
{"category":"hiking-boots","name":"waterproof","min_price":50,"max_price":200}
```

5. Customize search input dimensions and styling options.
6. Use the shortcode `[crashguru_search]` to display the search form anywhere on your site.

== Usage ==
**Basic Search Examples:**
* "red shoes under $100" → Finds red shoes with max price $100
* "SKU12345" → Direct redirect to product with that exact SKU  
* "wireless headphones" → AI extracts relevant product attributes
* "hiking gear in outdoor category" → Searches outdoor category for hiking-related products

**Shortcode Usage:**
`[crashguru_search placeholder="Your Placeholder Text"]`

== Frequently Asked Questions ==

= Do I need a Groq API key? =
Yes, you need a free Groq API key from https://console.groq.com/keys. The plugin cannot function without it as it powers the AI search capabilities.

= Does this work without WooCommerce? =
The plugin works with WordPress search, but WooCommerce is required for product-specific features like SKU search, price filtering, and product categories.

= Is this plugin free? =
Yes, the plugin is completely free. You only need a free Groq API account, which provides generous usage limits for most websites.

= What happens if the AI API is down? =
The plugin includes graceful fallback functionality. If the Groq API fails or times out, it automatically reverts to the standard WordPress/WooCommerce search.

= Can I customize the search prompt? =
Yes! In the admin settings, you can modify the AI prompt to better suit your specific product catalog and search requirements.

= Does this work on multisite installations? =
Yes, the plugin is fully compatible with WordPress multisite and can be network activated.

= What data is sent to the Groq API? =
Only the user's search query text is sent to Groq for processing. No personal information, user data, or site content is transmitted.

== Screenshots ==

1. Admin settings page showing API configuration and customization options
2. Search form integrated into your website with customizable styling
3. AI-powered search results displaying both products and posts
4. Search form customization options for width, height, and appearance

== Changelog ==

= 1.0.0 =
* Initial release
* AI-powered search with Groq API integration
* Natural language query processing and JSON parameter extraction
* SKU search functionality with exact and partial matching
* Mixed search results template for products and posts
* Customizable search form styling and dimensions
* Multisite support with network activation
* Graceful fallback to standard WordPress search
* Comprehensive admin settings panel
* Internationalization support with translation files
* Security features including nonce verification and data sanitization

== Upgrade Notice ==

= 1.0.0 =
Initial release of Smarter WP & WC Search. Requires a free Groq API key for AI functionality.