Delegate OCR and AI description search fields to the Piwigo AI plugin

This commit is contained in:
Mathieu
2026-07-30 14:54:40 +02:00
parent 51cb21c1cf
commit 4697126b24
5 changed files with 7 additions and 12 deletions
+2 -1
View File
@@ -153,7 +153,8 @@ function get_regular_search_results($search, $images_where='')
$has_filters_filled = true;
// 1) we search in regular fields (ie, the ones in the piwigo_images table)
$fields = array('file', 'name', 'comment', 'ai_description', 'ocr', 'author');
$fields = array('file', 'name', 'comment', 'author');
$fields = trigger_change('get_search_allwords_fields', $fields);
if (isset($search['fields']['allwords']['fields']) and count($search['fields']['allwords']['fields']) > 0)
{
+2 -1
View File
@@ -788,7 +788,8 @@ function ws_images_filteredSearch_create($params, $service)
}
$search['fields']['allwords']['mode'] = $params['allwords_mode'];
$allwords_fields_available = array('name', 'comment', 'ai_description', 'ocr', 'file', 'author', 'tags', 'cat-title', 'cat-desc');
$allwords_fields_available = array('name', 'comment', 'file', 'author', 'tags', 'cat-title', 'cat-desc');
$allwords_fields_available = trigger_change('get_search_allwords_fields', $allwords_fields_available);
if (!isset($params['allwords_fields']))
{
$params['allwords_fields'] = $allwords_fields_available;
+2 -1
View File
@@ -80,8 +80,9 @@ if (count($words) > 0 or in_array('allwords', $fields))
$search['fields']['allwords'] = array(
'words' => $words,
'mode' => 'AND',
'fields' => array('file', 'name', 'comment', 'ai_description', 'ocr', 'tags', 'author', 'cat-title', 'cat-desc'),
'fields' => array('file', 'name', 'comment', 'tags', 'author', 'cat-title', 'cat-desc'),
);
$search['fields']['allwords']['fields'] = trigger_change('get_search_allwords_fields', $search['fields']['allwords']['fields']);
}
$cat_ids = array();
@@ -251,14 +251,6 @@ const prefix_icon = 'gallery-icon-';
<input type="checkbox" id="comment" name="comment">
<label for="comment">{'Photo description'|@translate}</label>
</div>
<div>
<input type="checkbox" id="ai_description" name="ai_description">
<label for="ai_description">{'AI description'|@translate}</label>
</div>
<div>
<input type="checkbox" id="ocr" name="ocr">
<label for="ocr">{'OCR'|@translate}</label>
</div>
<div>
<input type="checkbox" id="tags" name="tags">
<label for="tags">{'Tags'|@translate}</label>
+1 -1
View File
@@ -1463,7 +1463,7 @@ enabled_high, registration_date, registration_date_string, registration_date_sin
),
'allwords_fields' => array(
'flags' => WS_PARAM_OPTIONAL|WS_PARAM_FORCE_ARRAY,
'info' => 'values among [name, comment, tags, file, author, cat-title, cat-desc, ai_description, ocr]',
'info' => 'values among [name, comment, tags, file, author, cat-title, cat-desc]',
),
'tags' => array(
'flags' => WS_PARAM_OPTIONAL|WS_PARAM_FORCE_ARRAY,