Skip to content

Commit f54d783

Browse files
Improve search results
1 parent 70a84c9 commit f54d783

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

data/templates/woocommerce/search.js.twig

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,15 @@ var form = document.querySelector('.phpdocumentor-search'),
55
var autoCompletejs = new autoComplete({
66
data: {
77
src: searchIndex,
8-
key: ['name', 'fqsen'],
9-
cache: false
10-
},
11-
sort: function(a, b) {
12-
if (a.match < b.match) {
13-
return -1;
14-
}
15-
if (a.match > b.match) {
16-
return 1;
17-
}
18-
return 0;
8+
key: ['name'],
9+
cache: true
1910
},
2011
placeHolder: 'Search',
2112
selector: '#autoComplete',
2213
highlight: true,
2314
threshold: 1,
24-
searchEngine: 'loose',
25-
maxResults: 20,
15+
searchEngine: 'strict',
16+
maxResults: 100,
2617
resultsList: {
2718
render: true,
2819
container: function(source) {

generate-hook-docs.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,13 @@ protected static function getJSOutput(array $hook_list): string
295295
foreach ($hook_list as $heading => $hooks) {
296296
foreach ($hooks as $hook => $details) {
297297
$summary = $heading . ' ' . (('filter' === $details['type']) ? 'Filter' : 'Action');
298+
$name = $hook . ' ' . $details['type'];
298299

299300
foreach ($details['files'] as $file) {
300301
$summary .= ' located in ' . str_replace('woocommerce/', '', $file['path']) . ': ' . $file['line'];
301302

302303
$output .= ',{';
303-
$output .= 'fqsen: "",';
304+
$output .= 'fqsen: "' . $name . '",';
304305
$output .= 'name: "' . $hook . '",';
305306
$output .= 'summary: "' . $summary . '",';
306307
$output .= 'url: "' . str_replace('../', 'https://woocommerce.github.io/code-reference/', self::getFileURL($file)) . '"';

0 commit comments

Comments
 (0)