Changeset 3442785
- Timestamp:
- 01/19/2026 08:01:15 PM (2 months ago)
- Location:
- searchcraft/trunk
- Files:
-
- 3 edited
-
admin/class-searchcraft-admin.php (modified) (7 diffs)
-
readme.txt (modified) (2 diffs)
-
searchcraft.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
searchcraft/trunk/admin/class-searchcraft-admin.php
r3441163 r3442785 1415 1415 } 1416 1416 1417 // Get the current index ID from configuration instead of using the constant1418 // which may be outdated if configuration was just saved.1419 1417 $index_id = Searchcraft_Config::get_index_id(); 1420 1418 if ( empty( $index_id ) ) { … … 2086 2084 } 2087 2085 2086 $index_id = Searchcraft_Config::get_index_id(); 2087 if ( empty( $index_id ) ) { 2088 Searchcraft_Helper_Functions::searchcraft_error_log( 'Searchcraft: Index ID is not configured.' ); 2089 return; 2090 } 2091 2088 2092 try { 2089 $ingest_client->documents()->addDocuments( SEARCHCRAFT_INDEX_ID, $documents );2090 $ingest_client->documents()->commitTransaction( SEARCHCRAFT_INDEX_ID);2093 $ingest_client->documents()->addDocuments( $index_id, $documents ); 2094 $ingest_client->documents()->commitTransaction( $index_id ); 2091 2095 2092 2096 // Clear the index stats cache since document count has changed. … … 2130 2134 } 2131 2135 2136 // Get the current index ID from configuration instead of using the constant 2137 // which may be outdated if configuration was just saved. 2138 $index_id = Searchcraft_Config::get_index_id(); 2139 if ( empty( $index_id ) ) { 2140 Searchcraft_Helper_Functions::searchcraft_error_log( 'Searchcraft: Index ID is not configured.' ); 2141 return; 2142 } 2143 2132 2144 $deleted_any = false; 2133 2145 foreach ( $fields as $field ) { 2134 2146 try { 2135 2147 // Attempt to delete documents that match the field condition. 2136 $ingest_client->documents()->deleteDocumentsByField( SEARCHCRAFT_INDEX_ID, $field );2148 $ingest_client->documents()->deleteDocumentsByField( $index_id, $field ); 2137 2149 $deleted_any = true; 2138 2150 } catch ( \Exception $e ) { … … 2144 2156 if ( $deleted_any ) { 2145 2157 try { 2146 $ingest_client->documents()->commitTransaction( SEARCHCRAFT_INDEX_ID);2158 $ingest_client->documents()->commitTransaction( $index_id ); 2147 2159 2148 2160 // Clear the index stats cache since document count has changed. … … 2165 2177 } 2166 2178 2179 // Get the current index ID from configuration instead of using the constant 2180 // which may be outdated if configuration was just saved. 2181 $index_id = Searchcraft_Config::get_index_id(); 2182 if ( empty( $index_id ) ) { 2183 Searchcraft_Helper_Functions::searchcraft_error_log( 'Searchcraft: Index ID is not configured.' ); 2184 return; 2185 } 2186 2167 2187 try { 2168 2188 // Attempt to delete all documents in the index. 2169 $ingest_client->documents()->deleteAllDocuments( SEARCHCRAFT_INDEX_ID);2189 $ingest_client->documents()->deleteAllDocuments( $index_id ); 2170 2190 2171 2191 // Commit the transaction to make the changes visible. 2172 $ingest_client->documents()->commitTransaction( SEARCHCRAFT_INDEX_ID);2192 $ingest_client->documents()->commitTransaction( $index_id ); 2173 2193 2174 2194 // Clear the index stats cache since document count has changed. … … 2425 2445 } 2426 2446 2447 // Get the current index ID from configuration instead of using the constant 2448 // which may be outdated if configuration was just saved. 2449 $index_id = Searchcraft_Config::get_index_id(); 2450 if ( empty( $index_id ) ) { 2451 Searchcraft_Helper_Functions::searchcraft_error_log( 'Searchcraft: Index ID is not configured.' ); 2452 return; 2453 } 2454 2427 2455 try { 2428 2456 // Remove the document from the Searchcraft index by ID. … … 2431 2459 ); 2432 2460 2433 $ingest_client->documents()->deleteDocumentsByField( SEARCHCRAFT_INDEX_ID, $criteria );2461 $ingest_client->documents()->deleteDocumentsByField( $index_id, $criteria ); 2434 2462 2435 2463 // Commit the transaction to make the changes visible. 2436 $ingest_client->documents()->commitTransaction( SEARCHCRAFT_INDEX_ID);2464 $ingest_client->documents()->commitTransaction( $index_id ); 2437 2465 2438 2466 // Clear the index stats cache since document count has changed. -
searchcraft/trunk/readme.txt
r3441163 r3442785 5 5 Requires at least: 5.3 6 6 Tested up to: 6.9 7 Stable tag: 1.3. 27 Stable tag: 1.3.3 8 8 License: Apache 2.0 9 9 License URI: LICENSE.txt … … 69 69 70 70 == Changelog == 71 72 = 1.3.3 = 73 * Bugfix - Fix race conditition on first time initialization. 71 74 72 75 = 1.3.2 = -
searchcraft/trunk/searchcraft.php
r3441163 r3442785 11 11 * Plugin URI: https://github.com/searchcraft-inc/searchcraft-wordpress 12 12 * Description: Bring fast, relevant search to your site. Searchcraft replaces the default search with a customizable, tunable, highly relevant search experience. 13 * Version: 1.3. 213 * Version: 1.3.3 14 14 * Author: Searchcraft, Inc. 15 15 * Author URI: https://searchcraft.io/ … … 27 27 // Define plugin constants. 28 28 if ( ! defined( 'SEARCHCRAFT_VERSION' ) ) { 29 define( 'SEARCHCRAFT_VERSION', '1.3. 2' );29 define( 'SEARCHCRAFT_VERSION', '1.3.3' ); 30 30 } 31 31 … … 52 52 // Load the main plugin class. 53 53 require_once SEARCHCRAFT_PLUGIN_DIR . 'includes/class-searchcraft.php'; 54 55 // Define dynamic constants based on configuration.56 if ( ! defined( 'SEARCHCRAFT_INDEX_ID' ) ) {57 define( 'SEARCHCRAFT_INDEX_ID', Searchcraft_Config::get_index_id() );58 }59 54 60 55 /**
Note: See TracChangeset
for help on using the changeset viewer.