Loading...
 
Skip to main content

Api Search Doc

Perform a lookup in the search index


Perform a lookup in the search index to find objects matching specific filters and sorting options.


Request URL - search
Copy to clipboard
https://example.com/api/search/lookup


cURL - search
Copy to clipboard
curl --request GET \ --url "https://example.com/api/search/lookup" \ --header "accept: application/json" \ --header "Authorization: Bearer <API_TOKEN>" \ --data-urlencode "filter=filter[title]=plugin" \ --data-urlencode "format={object_id} {title}" \ --data-urlencode "sort_order=title_desc" \ --data-urlencode "maxRecords=5"


PHP - search
Copy to clipboard
<?php $baseUrl = 'https://example.com/api/search/lookup'; $params = [ 'filter' => 'filter[title]=plugin', 'format' => '{object_id} {title}', 'sort_order' => 'title_desc', 'maxRecords' => 5 ]; $url = $baseUrl . '?' . http_build_query($params); $headers = [ 'Accept: application/json', 'Authorization: Bearer <API_TOKEN>' ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($http_code === 200) { $data = json_decode($response, true); print_r($data); } else { echo 'Error: HTTP status code ' . $http_code; } curl_close($ch); ?>


Javascript - search
Copy to clipboard
const params = new URLSearchParams({ filter: 'filter[title]=plugin', format: '{object_id} {title}', sort_order: 'title_desc', maxRecords: '5' }); fetch('https://example.com/api/search/lookup?' + params.toString(), { method: 'GET', headers: { 'Accept': 'application/json', 'Authorization': 'Bearer <API_TOKEN>' } }) .then(res => { if (!res.ok) throw new Error("HTTP " + res.status); return res.json(); }) .then(data => { console.log(data); }) .catch(err => { console.log('Fetch error: ' + err.message); });


Response - search
Copy to clipboard
{ "title": "Lookup Result", "resultset": { "count": 4, "offset": 0, "maxRecords": 5, "result": [ { "object_type": "file gallery", "object_id": "10", "parent_id": "3", "title": "10 <b class=\"highlight_word highlight_word_0\">plugin</b> error" }, { "object_type": "wiki page", "object_id": "plugin error", "parent_id": null, "title": "<b class=\"highlight_word highlight_word_0\">plugin</b> error <b class=\"highlight_word highlight_word_0\">plugin</b> error" }, { "object_type": "wiki page", "object_id": "plugin-test", "parent_id": null, "title": "<b class=\"highlight_word highlight_word_0\">plugin</b>-test <b class=\"highlight_word highlight_word_0\">plugin</b>-test" }, { "object_type": "wiki page", "object_id": "test-plugin-argument", "parent_id": null, "title": "test-<b class=\"highlight_word highlight_word_0\">plugin</b>-argument test-<b class=\"highlight_word highlight_word_0\">plugin</b>-argument" } ] } }



Parameters

  • filter[] array *: Filter index fields and content.
  • format string optional : The format of the response data. e.g. {object_id} {title}
  • sort_order string optional: The sort order of the results. Possible values are:
    • title_asc : Sort by title, A to Z.
    • title_desc : Sort by title, Z to A.
  • offset integer optional : The record offset to start returning results from.
  • maxRecords integer optional : The maximum number of records to return.


Process incremental index queue update


Process incremental index queue update


Request URL - search
Copy to clipboard
https://example.com/api/search/process-queue


cURL - search
Copy to clipboard
curl --request POST \ --url "https://example.com/api/search/process-queue" \ --header "accept: application/json" \ --header "Authorization: Bearer <API_TOKEN>" \ --data-urlencode "batch=10"


PHP - search
Copy to clipboard
<?php $baseUrl = 'https://example.com/api/search/process-queue'; $params = ['batch' => 10]; $url = $baseUrl . '?' . http_build_query($params); $headers = [ 'Accept: application/json', 'Authorization: Bearer <API_TOKEN>' ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($http_code === 200) { $data = json_decode($response, true); print_r($data); } else { echo 'Error: HTTP status code ' . $http_code; } curl_close($ch); ?>


Javascript - search
Copy to clipboard
const params = new URLSearchParams({ batch: '10' }); fetch('https://example.com/api/search/process-queue?' + params.toString(), { method: 'POST', headers: { 'Accept': 'application/json', 'Authorization': 'Bearer <API_TOKEN>' } }) .then(res => { if (!res.ok) throw new Error("HTTP " + res.status); return res.json(); }) .then(data => { console.log(data); }) .catch(err => { console.log('Fetch error: ' + err.message); });


Response - search
Copy to clipboard
{ "title": "Process Update Queue", "stat": null, "queue_count": 0, "batch": 10 }



Parameters

  • batch integer *: The number of records to process.


Run search index rebuild


Run search index rebuild


Request URL - search
Copy to clipboard
https://example.com/api/search/rebuild


cURL - search
Copy to clipboard
curl --request POST \ --url "https://example.com/api/search/rebuild" \ --header "accept: application/json" \ --header "Authorization: Bearer <API_TOKEN>" \ --data-urlencode "loggit=2"


PHP - search
Copy to clipboard
<?php $baseUrl = 'https://example.com/api/search/rebuild'; $params = ['loggit' => 2]; $url = $baseUrl . '?' . http_build_query($params); $headers = [ 'Accept: application/json', 'Authorization: Bearer <API_TOKEN>' ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($http_code === 200) { $data = json_decode($response, true); print_r($data); } else { echo 'Error: HTTP status code ' . $http_code; } curl_close($ch); ?>


Javascript - search
Copy to clipboard
const params = new URLSearchParams({ loggit: '2' }); fetch('https://example.com/api/search/rebuild?' + params.toString(), { method: 'POST', headers: { 'Accept': 'application/json', 'Authorization': 'Bearer <API_TOKEN>' } }) .then(res => { if (!res.ok) throw new Error("HTTP " + res.status); return res.json(); }) .then(data => { console.log(data); }) .catch(err => { console.log('Fetch error: ' + err.message); });


Response - search
Copy to clipboard
{ "title": "Rebuild Index", "formattedStats": null, "search_engine": "MySQL", "search_version": "8.0.40", "search_index": "index_68f4e5c8c4ea5", "fallback_search_engine": "", "fallback_search_version": "", "fallback_search_index": "", "queue_count": 0, "log_file_browser": "/temp/Search_Indexer_mysql_tiki.log", "fallback_log_file_browser": "/temp/Search_Indexer_mysql_tiki.log", "log_file_console": "/temp/Search_Indexer_mysql_tiki_console.log", "fallback_log_file_console": "/temp/Search_Indexer_mysql_tiki_console.log", "lastLogItemWeb": "2025-05-19T21:48:04+00:00 INFO (6): Execution time: < 1 sec\n", "lastLogItemConsole": "[2025-10-19T13:21:25.804120+00:00] indexer.INFO: total fields used in the mysql search index: 231 [] []\n", "isAjax": false, "showForm": false, "unified_last_rebuild": 1760880072 }



Parameters

  • loggit integer *: Log index rebuild process to file. Possible values are:
    • 0 : no logging
    • 1 : log to Search_Indexer.log
    • 2 : log to Search_Indexer_console.log

Show PHP error messages