visuddhinanda 1 tydzień temu
rodzic
commit
120cb5e857

+ 0 - 2
api-v12/app/Console/Commands/ExportPaliSynonyms.php

@@ -6,8 +6,6 @@ use Illuminate\Console\Command;
 use App\Http\Api\DictApi;
 use App\Http\Api\DictApi;
 use App\Models\UserDict;
 use App\Models\UserDict;
 use App\Models\DhammaTerm;
 use App\Models\DhammaTerm;
-use Illuminate\Support\Facades\Redis;
-use Illuminate\Support\Facades\Log;
 
 
 class ExportPaliSynonyms extends Command
 class ExportPaliSynonyms extends Command
 {
 {

+ 73 - 70
api-v12/app/Console/Commands/IndexPaliText.php

@@ -92,7 +92,7 @@ class IndexPaliText extends Command
                 $booksId = [$book];
                 $booksId = [$book];
             }
             }
             foreach ($booksId as $key => $bookId) {
             foreach ($booksId as $key => $bookId) {
-                $this->indexPaliParagraphs($bookId, $paragraph);
+                $this->indexTipitakaParagraphs($bookId, $paragraph);
             }
             }
 
 
             return $overallStatus;
             return $overallStatus;
@@ -104,11 +104,66 @@ class IndexPaliText extends Command
     }
     }
 
 
     /**
     /**
+     * Index Pali paragraphs for a given book.
      *
      *
+     * @param int $book
+     * @return int
      */
      */
-    protected function indexPaliParagraph($paraInfo, $paraContent, $related_id, array $category)
+    protected function indexTipitakaParagraphs($book, $paragraph = null)
     {
     {
-        $paraId = $paraInfo['book'] . '_' . $paraInfo['paragraph'];
+        $this->info("Starting to index paragraphs for book: $book");
+        $total = 0;
+        if ($paragraph) {
+            $paragraphs = PaliText::where('book', $book)
+                ->where('paragraph', $paragraph)
+                ->orderBy('paragraph')->cursor();
+        } else {
+            $paragraphs = PaliText::where('book', $book)
+                ->orderBy('paragraph')->cursor();
+        }
+        $bookUid = PaliText::where('book', $book)->where('level', 1)->first()->uid;
+        $category = $this->tagService->getTagsName($bookUid);
+        $headings = [];
+        $currChapterTitle = '';
+        $commentaryId = '';
+        $currSession = [];
+        foreach ($paragraphs as $key => $para) {
+            $total++;
+            if ($para->level < 8) {
+                $currChapterTitle = $para->toc;
+            }
+            if ($para->class === 'nikaya') {
+                $nikaya = $para->text;
+            }
+            $paraContent = $this->searchPaliDataService
+                ->getParaContent($para['book'], $para['paragraph']);
+            if (!empty($commentaryId)) {
+                $currSession[] = $paraContent;
+            }
+            if (isset($paraContent['commentary'])) {
+                if (!empty($commentaryId)) {
+                    //保存 session
+                    $this->indexPaliSession($para->toArray(), $currSession, $currChapterTitle, $commentaryId);
+                    $currSession = [];
+                }
+                $commentaryId = $paraContent['commentary'];
+            }
+            $this->indexParagraph($para->toArray(), $paraContent, $commentaryId, $category);
+            $this->info("{$para['book']}-[{$para['paragraph']}]-[{$commentaryId}]");
+            usleep(10000);
+        }
+
+        $this->info("Successfully indexed $total paragraphs for book: $book");
+        Log::info("Indexed $total paragraphs for book: $book");
+
+        return 0;
+    }
+    /**
+     *
+     */
+    protected function indexParagraph($paraInfo, $paraContent, $related_id, array $category)
+    {
+        $paraId = $paraInfo['book'] . '-' . $paraInfo['paragraph'];
         $resource_id = $paraInfo['uid'];
         $resource_id = $paraInfo['uid'];
         $path = json_decode($paraInfo['path']);
         $path = json_decode($paraInfo['path']);
         if (is_array($path) && count($path) > 0) {
         if (is_array($path) && count($path) > 0) {
@@ -117,9 +172,9 @@ class IndexPaliText extends Command
             $title = '';
             $title = '';
         }
         }
         $document = [
         $document = [
-            'id' => "pali_para_{$paraId}",
+            'id' => "tipitaka_paragraph_pi_{$paraId}",
             'resource_id' => $resource_id, // Use uid from getPaliData for resource_id
             'resource_id' => $resource_id, // Use uid from getPaliData for resource_id
-            'resource_type' => 'original_text',
+            'resource_type' => 'tipitaka',
             'title' => [
             'title' => [
                 'pali' => $title,
                 'pali' => $title,
             ],
             ],
@@ -127,14 +182,14 @@ class IndexPaliText extends Command
                 'text' => $this->summary  ? $this->summaryService->summarize($paraContent['markdown']) : ''
                 'text' => $this->summary  ? $this->summaryService->summarize($paraContent['markdown']) : ''
             ],
             ],
             'content' => [
             'content' => [
-                'pali' => $paraContent['markdown'],
+                'pali' => $paraContent['text'],
                 'suggest' => $paraContent['words'],
                 'suggest' => $paraContent['words'],
             ],
             ],
             'bold_single' => implode(' ', $paraContent['bold1']),
             'bold_single' => implode(' ', $paraContent['bold1']),
             'bold_multi' => implode(' ', array_merge($paraContent['bold2'], $paraContent['bold3'])),
             'bold_multi' => implode(' ', array_merge($paraContent['bold2'], $paraContent['bold3'])),
-            'related_id' => $related_id,
+            'related_id' => $paraId,
             'category' => $category, // Assuming Pali paragraphs are sutta; adjust as needed
             'category' => $category, // Assuming Pali paragraphs are sutta; adjust as needed
-            'language' => 'pali',
+            'language' => 'pi',
             'updated_at' => now()->toIso8601String(),
             'updated_at' => now()->toIso8601String(),
             'granularity' => 'paragraph',
             'granularity' => 'paragraph',
             'path' => $this->getPathTitle($path),
             'path' => $this->getPathTitle($path),
@@ -197,69 +252,7 @@ class IndexPaliText extends Command
         return;
         return;
     }
     }
 
 
-    private function getPathTitle(array $input)
-    {
-        $output = [];
-        foreach ($input as $key => $node) {
-            $output[] = $node->title;
-        }
-        return implode('/', $output);
-    }
-    /**
-     * Index Pali paragraphs for a given book.
-     *
-     * @param int $book
-     * @return int
-     */
-    protected function indexPaliParagraphs($book, $paragraph = null)
-    {
-        $this->info("Starting to index paragraphs for book: $book");
-        $total = 0;
-        if ($paragraph) {
-            $paragraphs = PaliText::where('book', $book)
-                ->where('paragraph', $paragraph)
-                ->orderBy('paragraph')->cursor();
-        } else {
-            $paragraphs = PaliText::where('book', $book)
-                ->orderBy('paragraph')->cursor();
-        }
-        $bookUid = PaliText::where('book', $book)->where('level', 1)->first()->uid;
-        $category = $this->tagService->getTagsName($bookUid);
-        $headings = [];
-        $currChapterTitle = '';
-        $commentaryId = '';
-        $currSession = [];
-        foreach ($paragraphs as $key => $para) {
-            $total++;
-            if ($para->level < 8) {
-                $currChapterTitle = $para->toc;
-            }
-            if ($para->class === 'nikaya') {
-                $nikaya = $para->text;
-            }
-            $paraContent = $this->searchPaliDataService
-                ->getParaContent($para['book'], $para['paragraph']);
-            if (!empty($commentaryId)) {
-                $currSession[] = $paraContent;
-            }
-            if (isset($paraContent['commentary'])) {
-                if (!empty($commentaryId)) {
-                    //保存 session
-                    $this->indexPaliSession($para->toArray(), $currSession, $currChapterTitle, $commentaryId);
-                    $currSession = [];
-                }
-                $commentaryId = $paraContent['commentary'];
-            }
-            $this->indexPaliParagraph($para->toArray(), $paraContent, $commentaryId, $category);
-            $this->info("{$para['book']}-[{$para['paragraph']}]-[{$commentaryId}]");
-            usleep(10000);
-        }
-
-        $this->info("Successfully indexed $total paragraphs for book: $book");
-        Log::info("Indexed $total paragraphs for book: $book");
 
 
-        return 0;
-    }
 
 
     /**
     /**
      * Index Pali suttas for a given book (placeholder for future implementation).
      * Index Pali suttas for a given book (placeholder for future implementation).
@@ -286,4 +279,14 @@ class IndexPaliText extends Command
         Log::warning("Sentence indexing not implemented for book: $book");
         Log::warning("Sentence indexing not implemented for book: $book");
         return 1;
         return 1;
     }
     }
+
+
+    private function getPathTitle(array $input)
+    {
+        $output = [];
+        foreach ($input as $key => $node) {
+            $output[] = $node->title;
+        }
+        return implode('/', $output);
+    }
 }
 }

+ 4 - 3
api-v12/app/Console/Commands/UsersDesensitize.php

@@ -49,10 +49,11 @@ class UsersDesensitize extends Command
             $this->info('test mode');
             $this->info('test mode');
         } else {
         } else {
             $this->error('this is not test mode');
             $this->error('this is not test mode');
+            if (!$this->confirm("desensitize all users information?")) {
+                return 0;
+            }
         }
         }
-        if (!$this->confirm("desensitize all users information?")) {
-            return 0;
-        }
+
         $users = UserInfo::cursor();
         $users = UserInfo::cursor();
         $total = UserInfo::count();
         $total = UserInfo::count();
         $desensitized = 0;
         $desensitized = 0;

+ 6 - 2
api-v12/app/Http/Api/TemplateRender.php

@@ -979,15 +979,19 @@ class TemplateRender
             true,
             true,
             $this->format
             $this->format
         );
         );
-        if ($props === false) {
+        if (!$props) {
             $props['error'] = "句子模版渲染错误。句子参数个数不符。应该是四个。";
             $props['error'] = "句子模版渲染错误。句子参数个数不符。应该是四个。";
+            Log::error('句子模版渲染错误。句子参数个数不符。应该是四个。');
         }
         }
         if ($this->mode === 'read') {
         if ($this->mode === 'read') {
             $tpl = "sentread";
             $tpl = "sentread";
         } else {
         } else {
             $tpl = "sentedit";
             $tpl = "sentedit";
         }
         }
-        $props['show'] = $show;
+        if (is_array($props)) {
+            $props['show'] = $show;
+        }
+
         //输出引用
         //输出引用
         $arrSid = explode('-', $sid);
         $arrSid = explode('-', $sid);
         $bookPara = array_slice($arrSid, 0, 2);
         $bookPara = array_slice($arrSid, 0, 2);

+ 29 - 5
api-v12/app/Http/Controllers/CorpusController.php

@@ -109,8 +109,13 @@ class CorpusController extends Controller
     {
     {
         //
         //
     }
     }
-    public function getSentTpl($id, $inputChannels, $mode = 'edit', $onlyProps = false, $format = 'react')
-    {
+    public function getSentTpl(
+        $id,
+        $inputChannels,
+        $mode = 'edit',
+        $onlyProps = false,
+        $format = 'react'
+    ) {
         $sent = [];
         $sent = [];
         $channels = $inputChannels;
         $channels = $inputChannels;
         $sentId = \explode('-', $id);
         $sentId = \explode('-', $id);
@@ -157,7 +162,18 @@ class CorpusController extends Controller
                 break;
                 break;
             }
             }
         }
         }
-        return $this->makeContent($record, $mode, $channelIndex, [], $onlyProps, false, $format);
+        if (count($record) === 0) {
+            return null;
+        }
+        return $this->makeContent(
+            $record,
+            $mode,
+            $channelIndex,
+            [],
+            $onlyProps,
+            false,
+            $format
+        );
     }
     }
     /**
     /**
      * Display the specified resource.
      * Display the specified resource.
@@ -576,8 +592,15 @@ class CorpusController extends Controller
      * $indexChannel channel索引
      * $indexChannel channel索引
      * $indexedHeading 标题索引 用于给段落加标题标签 <h1> ect.
      * $indexedHeading 标题索引 用于给段落加标题标签 <h1> ect.
      */
      */
-    private function makeContent($record, $mode, $indexChannel, $indexedHeading = [], $onlyProps = false, $paraMark = false, $format = 'react')
-    {
+    private function makeContent(
+        $record,
+        $mode,
+        $indexChannel,
+        $indexedHeading = [],
+        $onlyProps = false,
+        $paraMark = false,
+        $format = 'react'
+    ) {
         $content = [];
         $content = [];
         $sent = [];
         $sent = [];
         $sent["origin"] = [];
         $sent["origin"] = [];
@@ -797,6 +820,7 @@ class CorpusController extends Controller
                         break;
                         break;
                 }
                 }
             }
             }
+            //FIXME 移到for外面
             if ($onlyProps) {
             if ($onlyProps) {
                 return $sent;
                 return $sent;
             }
             }

+ 16 - 17
api-v12/app/Http/Controllers/Library/SearchController.php

@@ -7,7 +7,7 @@ use App\Http\Controllers\Controller;
 use Illuminate\Http\Request;
 use Illuminate\Http\Request;
 use App\Services\OpenSearchService;
 use App\Services\OpenSearchService;
 use App\DTO\Search\SearchDataDTO;
 use App\DTO\Search\SearchDataDTO;
-
+use Carbon\Carbon;
 
 
 class SearchController extends Controller
 class SearchController extends Controller
 {
 {
@@ -17,7 +17,7 @@ class SearchController extends Controller
         $category = $request->input('category', 'all');
         $category = $request->input('category', 'all');
         $page     = max(1, (int) $request->input('page', 1));
         $page     = max(1, (int) $request->input('page', 1));
         $perPage  = 10;
         $perPage  = 10;
-        $lang = $request->input('lang');
+        $lang = $request->input('language');
 
 
         $search = app(OpenSearchService::class);
         $search = app(OpenSearchService::class);
         // 组装搜索参数
         // 组装搜索参数
@@ -26,7 +26,7 @@ class SearchController extends Controller
             'pageSize'     => $perPage,
             'pageSize'     => $perPage,
             'page'     => $page,
             'page'     => $page,
             'language'     => $lang,
             'language'     => $lang,
-            'resourceType'     => $request->input('type'),
+            'resourceType'     => $request->input('resource_type'),
         ];
         ];
         $result = $search->search($params);
         $result = $search->search($params);
 
 
@@ -34,18 +34,19 @@ class SearchController extends Controller
         $results = [];
         $results = [];
         foreach ($dto->hits->items as $key => $item) {
         foreach ($dto->hits->items as $key => $item) {
             $results[] = [
             $results[] = [
-                'word'     => $item->id,
-                'zh'       => $item->title,
-                'lang'     => 'pi',
-                'category' => '法义术语',
+                'id'     => $item->resId,
+                'title'       => $item->title,
+                'type'     => $item->type,
+                'lang'     => $item->language,
+                'category' => $item->type,
                 'quality'  => 'featured',
                 'quality'  => 'featured',
                 'snippet'  => !empty($item->highlight) ? $item->highlight : $item->content,
                 'snippet'  => !empty($item->highlight) ? $item->highlight : $item->content,
-                'updated'  => '2025-11-12',
+                'updated'  => Carbon::parse($item->updated)->format('Y-m-d'),
             ];
             ];
         }
         }
 
 
-        $category = $dto->aggregations->category->buckets;
-
+        $aggregations = $dto->aggregations->toArray();
+        unset($aggregations['resource_type']);
         // 分页对象(兼容 Blade paginator 风格)
         // 分页对象(兼容 Blade paginator 风格)
         $pagination = [
         $pagination = [
             'total'        => $dto->hits->total,
             'total'        => $dto->hits->total,
@@ -60,8 +61,8 @@ class SearchController extends Controller
             'results'        => $results,
             'results'        => $results,
             'pagination'     => $pagination,
             'pagination'     => $pagination,
             'category'       => 'all',
             'category'       => 'all',
-            'filters'     => $category,
-            'categories'     => $this->types(),
+            'filters'     => $aggregations,
+            'types'     => $this->types(),
             'recentUpdates'  => [],
             'recentUpdates'  => [],
         ]);
         ]);
     }
     }
@@ -70,11 +71,9 @@ class SearchController extends Controller
     private function types(): array
     private function types(): array
     {
     {
         return [
         return [
-            ['slug' => 'all',      'label' => '全部'],
-            ['slug' => 'term',     'label' => '法义术语'],
-            ['slug' => 'original_text',   'label' => '原文'],
-            ['slug' => 'translation',     'label' => '译文'],
-            ['slug' => 'article',   'label' => '文章'],
+            ['slug' => 'term',     'label' => '百科词条'],
+            ['slug' => 'tipitaka',   'label' => '巴利三藏'],
+            ['slug' => 'article',   'label' => '文章文集'],
             ['slug' => 'course', 'label' => '课程'],
             ['slug' => 'course', 'label' => '课程'],
             ['slug' => 'dictionary',    'label' => '字典'],
             ['slug' => 'dictionary',    'label' => '字典'],
         ];
         ];

+ 9 - 5
api-v12/app/Http/Controllers/Library/WikiController.php

@@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
 use Illuminate\Http\Request;
 use Illuminate\Http\Request;
 use App\Helpers\WikiContentParser;
 use App\Helpers\WikiContentParser;
 use App\Services\TermService;
 use App\Services\TermService;
+use Illuminate\Support\Str;
 
 
 class WikiController extends Controller
 class WikiController extends Controller
 {
 {
@@ -108,11 +109,14 @@ HTML,
 
 
     public function show(string $lang, string $word)
     public function show(string $lang, string $word)
     {
     {
+        if (Str::isUuid($word)) {
+            $term = $this->termService->find($word, 'html');
+        } else {
+            $term = $this->termService->communityTerm($word, $lang, 'html');
+        }
 
 
-        $term = $this->termService->communityTerm($word, $lang);
-        $urlParam = ['format' => 'html'];
-        $fakeRequest = Request::create('', 'GET', $urlParam);
-        $termArray    = $term->toArray($fakeRequest);
+
+        $termArray    = $term;
         $entry = [
         $entry = [
             'word'      => $termArray['word'],
             'word'      => $termArray['word'],
             'lang'      => $termArray['language'],
             'lang'      => $termArray['language'],
@@ -131,7 +135,7 @@ HTML,
                 ['word' => 'Vipassanā', 'zh' => '内观', 'lang' => 'pi'],
                 ['word' => 'Vipassanā', 'zh' => '内观', 'lang' => 'pi'],
                 ['word' => 'Ti-lakkhaṇa', 'zh' => '三相', 'lang' => 'pi'],
                 ['word' => 'Ti-lakkhaṇa', 'zh' => '三相', 'lang' => 'pi'],
             ],
             ],
-            'content' => $termArray['html']
+            'content' => $termArray['html'] ?? ''
         ];
         ];
         $parsed  = WikiContentParser::parse($entry['content']);
         $parsed  = WikiContentParser::parse($entry['content']);
 
 

+ 1 - 1
api-v12/app/Http/Controllers/SearchPlusController.php

@@ -59,7 +59,7 @@ class SearchPlusController extends Controller
         $granularity  = $request->input('granularity');   // 文档颗粒度
         $granularity  = $request->input('granularity');   // 文档颗粒度
         $language     = $request->input('language');      // 语言
         $language     = $request->input('language');      // 语言
         $category     = $request->input('category');      // 分类
         $category     = $request->input('category');      // 分类
-        $tags         = $request->input('tags', []);      // 标签
+        $tags         = $request->has('tags') ? explode(',', $request->input('tags')) : [];      // 标签
         $pageRefs     = $request->input('page_refs', []); // 页码标记
         $pageRefs     = $request->input('page_refs', []); // 页码标记
         $relatedId    = $request->input('related_id'); // 关联 ID
         $relatedId    = $request->input('related_id'); // 关联 ID
         $author       = $request->input('author');        // 作者/译者 (metadata.author)
         $author       = $request->input('author');        // 作者/译者 (metadata.author)

+ 21 - 17
api-v12/app/Http/Controllers/SearchSuggestController.php

@@ -11,7 +11,7 @@ use App\Services\OpenSearchService;
  *
  *
  * 返回示例:
  * 返回示例:
  *
  *
- * 请求:GET /api/v2/suggest?q=dhamma&fields=title,content&limit=10
+ * 请求:GET /api/v3/search-suggest?q=dhamma&fields=title,content&limit=10
  *
  *
  * 返回:
  * 返回:
  * {
  * {
@@ -19,22 +19,26 @@ use App\Services\OpenSearchService;
  *   "data": {
  *   "data": {
  *     "query": "dhamma",
  *     "query": "dhamma",
  *     "suggestions": [
  *     "suggestions": [
- *       {
- *         "text": "dhammapada",
- *         "source": "title",
- *         "score": 5.2,
- *         "resource_type": "sutta",
- *         "language": "pali",
- *         "doc_id": "doc_123"
- *       },
- *       {
- *         "text": "dhammapadā",
- *         "source": "content",
- *         "score": 4.8,
- *         "resource_type": "commentary",
- *         "language": "pali",
- *         "doc_id": "doc_456"
- *       }
+      {
+        "text": "dhammacakkapavattanasutta",
+        "source": "content",
+        "score": 1,
+        "resource_type": "term",
+        "language": "zh",
+        "doc_id": "term_69258244-bccd-40ed-bfaa-ddef4ae5ae4c",
+        "category": [],
+        "granularity": null
+      },
+      {
+        "text": "dhammacakkappavattanasutta",
+        "source": "content",
+        "score": 1,
+        "resource_type": "term",
+        "language": "zh-hans",
+        "doc_id": "term_bcb14399-ea80-4a8a-aeab-a4c927e45fdd",
+        "category": [],
+        "granularity": null
+      }
  *     ],
  *     ],
  *     "total": 2
  *     "total": 2
  *   }
  *   }

+ 4 - 3
api-v12/app/Http/Resources/TermResource.php

@@ -35,6 +35,7 @@ class TermResource extends JsonResource
             "tag" => $this->tag,
             "tag" => $this->tag,
             "note" => $this->note,
             "note" => $this->note,
             "language" => $this->language,
             "language" => $this->language,
+            "channel_id" => $this->channal,
             "channal" => $this->channal,
             "channal" => $this->channal,
             "studio" => StudioApi::getById($this->owner),
             "studio" => StudioApi::getById($this->owner),
             "editor" => UserApi::getById($this->editor_id),
             "editor" => UserApi::getById($this->editor_id),
@@ -46,9 +47,9 @@ class TermResource extends JsonResource
         if ($request->has('channel') && !empty($request->input('channel'))) {
         if ($request->has('channel') && !empty($request->input('channel'))) {
             $channels = explode('_', $request->input('channel'));
             $channels = explode('_', $request->input('channel'));
         } else {
         } else {
-            if (!empty($this->channal) && Str::isUuid($this->channal)) {
-                $channelId = $this->channal;
-                $data["channel"] = ChannelApi::getById($this->channal);
+            if (!empty($this->channel_id) && Str::isUuid($this->channel_id)) {
+                $channelId = $this->channel_id;
+                $data["channel"] = ChannelApi::getById($this->channel_id);
             } else {
             } else {
                 $channelId = ChannelApi::getSysChannel('_community_translation_' . $this->language . '_');
                 $channelId = ChannelApi::getSysChannel('_community_translation_' . $this->language . '_');
                 if (empty($channelId)) {
                 if (empty($channelId)) {

+ 19 - 5
api-v12/app/Services/OpenSearchService.php

@@ -76,6 +76,10 @@ class OpenSearchService
                         'tokenizer' => 'standard',
                         'tokenizer' => 'standard',
                         'filter' => ['lowercase', 'asciifolding']
                         'filter' => ['lowercase', 'asciifolding']
                     ],
                     ],
+                    'zh_suggest_analyzer' => [
+                        'tokenizer' => 'ik_smart',
+                        'char_filter' => ['tsconvert'],
+                    ],
                     // 中文简繁统一 (繁 -> 简)
                     // 中文简繁统一 (繁 -> 简)
                     'zh_index_analyzer' => [
                     'zh_index_analyzer' => [
                         'tokenizer' => 'ik_max_word',
                         'tokenizer' => 'ik_max_word',
@@ -145,10 +149,14 @@ class OpenSearchService
                             ],
                             ],
                         ],
                         ],
                         // 自动建议字段
                         // 自动建议字段
-                        'suggest' => [
+                        'suggest_pali' => [
                             'type' => 'completion',
                             'type' => 'completion',
                             'analyzer' => 'pali_suggest_analyzer'
                             'analyzer' => 'pali_suggest_analyzer'
                         ],
                         ],
+                        'suggest_zh' => [
+                            'type' => 'completion',
+                            'analyzer' => 'zh_suggest_analyzer'
+                        ],
                     ],
                     ],
                 ],
                 ],
                 /** 简体中文 llm生成 */
                 /** 简体中文 llm生成 */
@@ -212,10 +220,14 @@ class OpenSearchService
                                 'engine'     => 'nmslib',
                                 'engine'     => 'nmslib',
                             ],
                             ],
                         ],
                         ],
-                        'suggest' => [
+                        'suggest_pali' => [
                             'type' => 'completion',
                             'type' => 'completion',
                             'analyzer' => 'pali_suggest_analyzer'
                             'analyzer' => 'pali_suggest_analyzer'
-                        ]
+                        ],
+                        'suggest_zh' => [
+                            'type' => 'completion',
+                            'analyzer' => 'zh_suggest_analyzer'
+                        ],
                     ],
                     ],
                 ],
                 ],
                 'related_id' => ['type' => 'keyword'],
                 'related_id' => ['type' => 'keyword'],
@@ -775,8 +787,10 @@ class OpenSearchService
     ): array {
     ): array {
         // 字段映射配置
         // 字段映射配置
         $fieldMap = [
         $fieldMap = [
-            'title' => 'title.suggest',
-            'content' => 'content.suggest',
+            'title_pali' => 'title.suggest_pali',
+            'title_zh' => 'title.suggest_zh',
+            'content_pali' => 'content.suggest_pali',
+            'content_zh' => 'content.suggest_zh',
         ];
         ];
 
 
         // 处理字段参数
         // 处理字段参数

+ 18 - 7
api-v12/app/Services/SearchPaliDataService.php

@@ -111,9 +111,8 @@ class SearchPaliDataService
         $text = [];
         $text = [];
         $wordList = [];
         $wordList = [];
         foreach ($sentences as $key => $sentence) {
         foreach ($sentences as $key => $sentence) {
-            $content = $this->getSentenceText($book, $para, $sentence->word_begin, $sentence->word_end);
-            $id = "{$book}-{$para}-{$sentence->word_begin}-{$sentence->word_end}";
-            $markdown[] = "`id:{$id}`" . $content['markdown'];
+            $content = $this->getSentenceContent($book, $para, $sentence->word_begin, $sentence->word_end);
+            $markdown[] = $content['markdown'];
             $text[] = $content['text'];
             $text[] = $content['text'];
             $wordList = array_merge($wordList, $content['words']);
             $wordList = array_merge($wordList, $content['words']);
         }
         }
@@ -173,7 +172,7 @@ class SearchPaliDataService
      * @param int $para
      * @param int $para
      * @return array $sentence
      * @return array $sentence
      */
      */
-    public function getSentenceText($book, $para, $start, $end)
+    public function getSentenceContent($book, $para, $start, $end)
     {
     {
         $words = WbwTemplate::where('book', $book)
         $words = WbwTemplate::where('book', $book)
             ->where('paragraph', $para)
             ->where('paragraph', $para)
@@ -200,16 +199,28 @@ class SearchPaliDataService
                 $markdown .= $word->word . ' ';
                 $markdown .= $word->word . ' ';
             }
             }
         }
         }
-        $markdown = str_replace([' ti', ' ,', ' .', ' ?', '‘ ‘ ', ' ’ ’'], ['ti', ',', '.', '?', '‘‘', '’’'], $markdown);
+
+        //去掉多于的空格
+
+        $markdown = $this->removeSpace($markdown);
+        //合并连续的黑体
         $markdown = str_replace(['~~  ~~', '** **'], [' ', ' '], $markdown);
         $markdown = str_replace(['~~  ~~', '** **'], [' ', ' '], $markdown);
-        $text = implode(' ', $arrText);
-        $text = str_replace([' ti', ' ,', ' .', ' ?'], ['ti', ',', '.', '?'], $text);
+
+        $text = $this->removeSpace(implode(' ', $arrText));
         return [
         return [
             'markdown' => $this->abbrReplace(trim($markdown)),
             'markdown' => $this->abbrReplace(trim($markdown)),
             'text' => $this->abbrReplace($text),
             'text' => $this->abbrReplace($text),
             'words' => $wordList,
             'words' => $wordList,
         ];
         ];
     }
     }
+    private function removeSpace(string $input)
+    {
+        return str_replace(
+            [' ti', ' ,', ' .', ' ?', ' ;', '[ ', ' ]', '( ', ' )', '‘ ‘ ', ' ’ ’'],
+            ['ti', ',', '.', '?', ';', '[', ']', '(', ')', '‘‘', '’’'],
+            $input
+        );
+    }
     private function abbrReplace($input)
     private function abbrReplace($input)
     {
     {
         $abbr = ['sī .', 'syā .', 'kaṃ .', 'pī .'];
         $abbr = ['sī .', 'syā .', 'kaṃ .', 'pī .'];

+ 37 - 2
api-v12/app/Services/TermService.php

@@ -5,6 +5,7 @@ namespace App\Services;
 use App\Models\DhammaTerm;
 use App\Models\DhammaTerm;
 use App\Http\Api\ChannelApi;
 use App\Http\Api\ChannelApi;
 use App\Http\Resources\TermResource;
 use App\Http\Resources\TermResource;
+use Illuminate\Http\Request;
 
 
 
 
 class TermService
 class TermService
@@ -38,7 +39,19 @@ class TermService
         return $result;
         return $result;
     }
     }
 
 
-    public function communityTerm(string $word, string $lang)
+    public function isCommunity(?string $channelId)
+    {
+        $channel = ChannelApi::getById($channelId);
+        if (!$channel) {
+            return false;
+        }
+        if (strpos($channel['name'], '_community_term_') === false) {
+            return false;
+        } else {
+            return true;
+        }
+    }
+    public function communityTerm(string $word, string $lang, string $format)
     {
     {
         $localTermChannel = ChannelApi::getSysChannel(
         $localTermChannel = ChannelApi::getSysChannel(
             "_community_term_" . strtolower($lang) . "_"
             "_community_term_" . strtolower($lang) . "_"
@@ -47,7 +60,15 @@ class TermService
             ->where('channal', $localTermChannel)
             ->where('channal', $localTermChannel)
             ->first();
             ->first();
         if ($result) {
         if ($result) {
-            return new TermResource($result);
+            $resource = new TermResource($result);
+            $urlParam = ['format' => $format];
+            $fakeRequest = Request::create('', 'GET', $urlParam);
+            $termArray    = $resource->toArray($fakeRequest);
+            if ($result) {
+                return $termArray;
+            } else {
+                return null;
+            }
         } else {
         } else {
             return null;
             return null;
         }
         }
@@ -68,4 +89,18 @@ class TermService
             "count" => 10
             "count" => 10
         ];
         ];
     }
     }
+
+    public function find(string $id, string $format): ?array
+    {
+        $result = DhammaTerm::find($id);
+        $resource = new TermResource($result);
+        $urlParam = ['format' => $format];
+        $fakeRequest = Request::create('', 'GET', $urlParam);
+        $termArray    = $resource->toArray($fakeRequest);
+        if ($result) {
+            return $termArray;
+        } else {
+            return null;
+        }
+    }
 }
 }

+ 9 - 0
api-v12/resources/css/components/_search-input.css

@@ -11,3 +11,12 @@
     max-width: 500px;
     max-width: 500px;
     margin: 0 auto;
     margin: 0 auto;
 }
 }
+
+.search-suggest-dropdown {
+    max-height: 300px;
+    overflow-y: auto;
+}
+
+.search-suggest-dropdown .dropdown-item {
+    cursor: pointer;
+}

+ 31 - 19
api-v12/resources/views/components/ui/search-input.blade.php

@@ -1,14 +1,4 @@
-{{-- resources/views/components/ui/search-input.blade.php
-     通用搜索输入框组件。
-     Props:
-       $action      — 表单提交路由
-       $value       — 当前搜索词(默认空)
-       $placeholder — 占位文字
-       $buttonText  — 按钮文字(默认"搜索")
-       $size        — lg | md(默认 md)
-       $hiddenFields — 额外隐藏字段 array ['name' => 'value']
-       $autofocus   — 是否自动聚焦(默认 false)
---}}
+{{-- resources/views/components/ui/search-input.blade.php --}}
 @props([
 @props([
 'action',
 'action',
 'value' => '',
 'value' => '',
@@ -19,24 +9,46 @@
 'autofocus' => false,
 'autofocus' => false,
 ])
 ])
 
 
-<form action="{{ $action }}" method="GET" class="search-input-form">
+<form action="{{ $action }}" method="GET" class="search-input-form position-relative">
     <div class="input-group {{ $size === 'lg' ? 'input-group-lg' : '' }}">
     <div class="input-group {{ $size === 'lg' ? 'input-group-lg' : '' }}">
-        <input
-            type="text"
-            name="q"
-            class="form-control search-input"
-            value="{{ $value }}"
-            placeholder="{{ $placeholder }}"
-            {{ $autofocus ? 'autofocus' : '' }} />
 
 
+        {{-- 🔍 图标输入框 --}}
+        <div class="input-icon flex-grow-1">
+            <span class="input-icon-addon">
+                {{-- Tabler 搜索图标 --}}
+                <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24"
+                    viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"
+                    fill="none" stroke-linecap="round" stroke-linejoin="round">
+                    <path stroke="none" d="M0 0h24v24H0z" fill="none" />
+                    <circle cx="10" cy="10" r="7" />
+                    <line x1="21" y1="21" x2="15" y2="15" />
+                </svg>
+            </span>
+
+            <input
+                type="text"
+                name="q"
+                class="form-control search-input"
+                value="{{ $value }}"
+                placeholder="{{ $placeholder }}"
+                autocomplete="off"
+                data-suggest-url="/api/v3/search-suggest"
+                {{ $autofocus ? 'autofocus' : '' }} />
+        </div>
+
+        {{-- 隐藏字段 --}}
         @foreach ($hiddenFields as $name => $val)
         @foreach ($hiddenFields as $name => $val)
         @if ($val)
         @if ($val)
         <input type="hidden" name="{{ $name }}" value="{{ $val }}">
         <input type="hidden" name="{{ $name }}" value="{{ $val }}">
         @endif
         @endif
         @endforeach
         @endforeach
 
 
+        {{-- 按钮 --}}
         <button class="btn btn-primary" type="submit">
         <button class="btn btn-primary" type="submit">
             {{ $buttonText }}
             {{ $buttonText }}
         </button>
         </button>
     </div>
     </div>
+
+    {{-- 自动补全下拉 --}}
+    <div class="search-suggest-dropdown dropdown-menu w-100"></div>
 </form>
 </form>

+ 0 - 50
api-v12/resources/views/components/wiki/search-box.blade.php

@@ -1,50 +0,0 @@
-{{-- resources/views/components/wiki/search-box.blade.php (Tabler 增强版) --}}
-@props([
-'action' => '/library/search',
-'method' => 'GET',
-'placeholder' => '搜索佛法词条、经典、人物...',
-'buttonText' => '搜索',
-'queryParam' => 'q',
-'typeParam' => 'type',
-'typeValue' => 'wiki',
-'autoFocus' => false,
-'size' => 'md', // sm, md, lg
-'class' => '',
-])
-
-<div {{ $attributes->merge(['class' => $class]) }}>
-    <form action="{{ $action }}" method="{{ $method }}" role="search">
-        <div class="row g-2 align-items-center">
-            <div class="col">
-                <div class="input-icon">
-                    <span class="input-icon-addon">
-                        <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
-                            <path stroke="none" d="M0 0h24v24H0z" fill="none" />
-                            <circle cx="10" cy="10" r="7" />
-                            <line x1="21" y1="21" x2="15" y2="15" />
-                        </svg>
-                    </span>
-                    <input
-                        type="text"
-                        name="{{ $queryParam }}"
-                        class="form-control"
-                        placeholder="{{ $placeholder }}"
-                        value="{{ request($queryParam) }}"
-                        {{ $autoFocus ? 'autofocus' : '' }}
-                        aria-label="{{ $placeholder }}">
-                </div>
-            </div>
-            <div class="col-auto">
-                <button type="submit" class="btn btn-primary">
-                    <span class="d-none d-sm-inline ms-2">{{ $buttonText }}</span>
-                </button>
-            </div>
-        </div>
-
-        @if($typeParam && $typeValue)
-        <input type="hidden" name="{{ $typeParam }}" value="{{ $typeValue }}">
-        @endif
-
-        {{ $slot }}
-    </form>
-</div>

+ 7 - 3
api-v12/resources/views/components/wiki/search-result-card.blade.php

@@ -5,9 +5,13 @@
 
 
     <div class="wiki-search-card-header">
     <div class="wiki-search-card-header">
         <a class="wiki-search-card-title"
         <a class="wiki-search-card-title"
-           href="{{ route('library.wiki.show', [$result['lang'], $result['word']]) }}">
-            {{ $result['zh'] }}
-            <span class="wiki-search-card-word">{{ $result['word'] }}</span>
+            href="
+            @if($result['type']==='term')
+            {{ route('library.wiki.show', [$result['lang'], $result['id']]) }}
+            @endif
+            ">
+            {{ $result['title'] }}
+            <span class="wiki-search-card-word">{{ $result['type'] }}</span>
         </a>
         </a>
         <x-wiki.quality-badge :quality="$result['quality']" />
         <x-wiki.quality-badge :quality="$result['quality']" />
     </div>
     </div>

+ 9 - 12
api-v12/resources/views/library/anthology/index.blade.php

@@ -4,7 +4,7 @@
 @section('title', '文集 · 巴利书库')
 @section('title', '文集 · 巴利书库')
 
 
 @push('styles')
 @push('styles')
-    @vite('resources/css/modules/_anthology.css')
+@vite('resources/css/modules/_anthology.css')
 @endpush
 @endpush
 
 
 @section('breadcrumb')
 @section('breadcrumb')
@@ -32,14 +32,13 @@
             <div class="col-lg-9">
             <div class="col-lg-9">
 
 
                 @forelse($anthologies as $item)
                 @forelse($anthologies as $item)
-                    <x-ui.card-anthology
-                        :item="$item"
-                        :href="route('library.anthology.show', $item['id'])"
-                    />
+                <x-ui.card-anthology
+                    :item="$item"
+                    :href="route('library.anthology.show', $item['id'])" />
                 @empty
                 @empty
-                    <div class="wiki-card">
-                        <x-ui.empty-state title="暂无文集" />
-                    </div>
+                <div class="wiki-card">
+                    <x-ui.empty-state title="暂无文集" />
+                </div>
                 @endforelse
                 @endforelse
 
 
                 {{-- 分页 --}}
                 {{-- 分页 --}}
@@ -57,8 +56,7 @@
                     <x-ui.search-input
                     <x-ui.search-input
                         :action="route('library.search')"
                         :action="route('library.search')"
                         placeholder="搜索文集…"
                         placeholder="搜索文集…"
-                        :hidden-fields="['type' => 'anthology']"
-                    />
+                        :hidden-fields="['resource_type' => 'anthology']" />
                 </div>
                 </div>
 
 
                 {{-- 作者列表 --}}
                 {{-- 作者列表 --}}
@@ -75,8 +73,7 @@
                                     :initials="$author['initials']"
                                     :initials="$author['initials']"
                                     :name="$author['name']"
                                     :name="$author['name']"
                                     :sub="$author['count'] . ' 篇文集'"
                                     :sub="$author['count'] . ' 篇文集'"
-                                    size="md"
-                                />
+                                    size="md" />
                             </a>
                             </a>
                         </li>
                         </li>
                         @endforeach
                         @endforeach

+ 73 - 40
api-v12/resources/views/library/search.blade.php

@@ -6,6 +6,7 @@
 --}}
 --}}
 @extends('library.wiki.layouts.app')
 @extends('library.wiki.layouts.app')
 
 
+
 @section('title', $query ? '"' . $query . '" 的搜索结果 · WikiPāli' : '搜索 · WikiPāli')
 @section('title', $query ? '"' . $query . '" 的搜索结果 · WikiPāli' : '搜索 · WikiPāli')
 
 
 @section('wiki-content')
 @section('wiki-content')
@@ -23,46 +24,46 @@
 {{-- 结果摘要 --}}
 {{-- 结果摘要 --}}
 <div class="wiki-search-summary">
 <div class="wiki-search-summary">
     @if ($query)
     @if ($query)
-        搜索 <strong>「{{ $query }}」</strong>
-        @if ($pagination['total'] > 0)
-            ,共找到 <strong>{{ $pagination['total'] }}</strong> 条结果
-            @if ($pagination['last_page'] > 1)
-                (第 {{ $pagination['current_page'] }} / {{ $pagination['last_page'] }} 页)
-            @endif
-        @else
-            ,未找到相关条目
-        @endif
+    搜索 <strong>「{{ $query }}」</strong>
+    @if ($pagination['total'] > 0)
+    ,共找到 <strong>{{ $pagination['total'] }}</strong> 条结果
+    @if ($pagination['last_page'] > 1)
+    (第 {{ $pagination['current_page'] }} / {{ $pagination['last_page'] }} 页)
+    @endif
+    @else
+    ,未找到相关条目
+    @endif
     @endif
     @endif
 </div>
 </div>
 
 
 {{-- 结果列表 --}}
 {{-- 结果列表 --}}
 @if (count($results) > 0)
 @if (count($results) > 0)
 
 
-    <div class="wiki-card wiki-search-results">
-        @foreach ($results as $result)
-            <x-wiki.search-result-card :result="$result" :lang="$lang" />
-        @endforeach
-    </div>
+<div class="wiki-card wiki-search-results">
+    @foreach ($results as $result)
+    <x-wiki.search-result-card :result="$result" :lang="$lang" />
+    @endforeach
+</div>
 
 
-    {{-- 分页 --}}
-    @if ($pagination['last_page'] > 1)
-        <x-wiki.pagination
-            :pagination="$pagination"
-            routeName="library.search"
-            :queryParams="array_filter([
+{{-- 分页 --}}
+@if ($pagination['last_page'] > 1)
+<x-wiki.pagination
+    :pagination="$pagination"
+    routeName="library.search"
+    :queryParams="array_filter([
                 'q'        => $query,
                 'q'        => $query,
                 'lang'     => $lang,
                 'lang'     => $lang,
                 'category' => $category !== 'all' ? $category : null,
                 'category' => $category !== 'all' ? $category : null,
             ])" />
             ])" />
-    @endif
+@endif
 
 
 @else
 @else
 
 
-    <div class="wiki-card">
-        <x-ui.empty-state
-            title="未找到相关条目"
-            desc="请尝试其他关键词" />
-    </div>
+<div class="wiki-card">
+    <x-ui.empty-state
+        title="未找到相关条目"
+        desc="请尝试其他关键词" />
+</div>
 
 
 @endif
 @endif
 
 
@@ -71,29 +72,31 @@
 @section('wiki-sidebar')
 @section('wiki-sidebar')
 
 
 {{-- 分类筛选 --}}
 {{-- 分类筛选 --}}
+@isset($filters)
+@foreach ($filters as $key=>$filter)
 <div class="wiki-sidebar-section">
 <div class="wiki-sidebar-section">
-    <div class="wiki-sidebar-title">按分类筛选</div>
+    <div class="wiki-sidebar-title">按{{ $key }}筛选</div>
     <ul class="wiki-cat-list">
     <ul class="wiki-cat-list">
         <li>
         <li>
             <a href="{{ route('library.search', ['q' => $query]) }}"
             <a href="{{ route('library.search', ['q' => $query]) }}"
-               class="{{ $category === 'all' ? 'active' : '' }}">
+                class="{{ $category === 'all' ? 'active' : '' }}">
                 全部
                 全部
-                <span class="wiki-cat-count">{{ $pagination['total'] }}</span>
             </a>
             </a>
         </li>
         </li>
-        @isset($filters)
-            @foreach ($filters as $cat)
-            <li>
-                <a href="{{ route('library.search', ['q' => $query, 'category' => $cat->key]) }}"
-                   class="{{ $category === $cat->key ? 'active' : '' }}">
-                    {{ $cat->key }}
-                    <span class="wiki-cat-count">{{ $cat->doc_count }}</span>
-                </a>
-            </li>
-            @endforeach
-        @endisset
+
+        @foreach ($filter['buckets'] as $bucket)
+        <li>
+            <a href="{{ route('library.search', ['q' => $query, $key => $bucket['key']]) }}"
+                class="{{ $category === $bucket['key'] ? 'active' : '' }}">
+                {{ $bucket['key'] }}
+                <span class="wiki-cat-count">{{ $bucket['doc_count'] }}</span>
+            </a>
+        </li>
+        @endforeach
     </ul>
     </ul>
 </div>
 </div>
+@endforeach
+@endisset
 
 
 {{-- 近似词条(无结果时显示) --}}
 {{-- 近似词条(无结果时显示) --}}
 @if (count($results) === 0 && $query)
 @if (count($results) === 0 && $query)
@@ -110,3 +113,33 @@
 @endif
 @endif
 
 
 @endsection
 @endsection
+
+
+@section('wiki-sidebar-left')
+
+
+
+<div class="wiki-sidebar-section">
+    <div class="wiki-sidebar-title">分类浏览</div>
+    <ul class="wiki-cat-list">
+        <li>
+            <a href="{{ route('library.search', ['q' => $query]) }}"
+                class="{{ $category === 'all' ? 'active' : '' }}">
+                全部
+            </a>
+        </li>
+        @foreach ($types as $type)
+        <li>
+            <a href="{{ route('library.search', ['q' => $query,'resource_type' => $type['slug']]) }}"
+                class="{{ (request('resource_type', 'all') === $type['slug']) ? 'active' : '' }}">
+                {{ $type['label'] }}
+                @if(isset($type['count']))
+                <span class="wiki-cat-count">{{ $type['count'] }}</span>
+                @endif
+            </a>
+        </li>
+        @endforeach
+    </ul>
+</div>
+
+@endsection

+ 1 - 1
api-v12/resources/views/library/tipitaka/category.blade.php

@@ -75,7 +75,7 @@
                     :action="route('library.search')"
                     :action="route('library.search')"
                     :value="request('q')"
                     :value="request('q')"
                     placeholder="搜索三藏原文译文"
                     placeholder="搜索三藏原文译文"
-                    :hidden-fields="['type' => 'tipitaka']" />
+                    :hidden-fields="['resource_type' => 'tipitaka']" />
             </div>
             </div>
 
 
             {{-- 1. 子分类 --}}
             {{-- 1. 子分类 --}}

+ 4 - 3
api-v12/resources/views/library/wiki/home.blade.php

@@ -25,11 +25,12 @@
 
 
     {{-- 搜索框 --}}
     {{-- 搜索框 --}}
     <div class="wiki-home-search">
     <div class="wiki-home-search">
-        <x-wiki.search-box
+        <x-ui.search-input
             :action="route('library.search')"
             :action="route('library.search')"
+            :value="request('q')"
             placeholder="搜索佛法词条、经典、人物..."
             placeholder="搜索佛法词条、经典、人物..."
-            button-text="搜索"
-            size="lg" />
+            size="lg"
+            :hidden-fields="['resource_type' => 'term']" />
     </div>
     </div>
 
 
     {{-- 热门搜索标签 --}}
     {{-- 热门搜索标签 --}}

+ 4 - 3
api-v12/resources/views/library/wiki/index.blade.php

@@ -6,11 +6,12 @@
 @section('wiki-content')
 @section('wiki-content')
 {{-- 搜索框组件 --}}
 {{-- 搜索框组件 --}}
 <div class="wiki-search-wrapper">
 <div class="wiki-search-wrapper">
-    <x-wiki.search-box
+    <x-ui.search-input
         :action="route('library.search')"
         :action="route('library.search')"
+        :value="request('q')"
         placeholder="搜索佛法词条、经典、人物..."
         placeholder="搜索佛法词条、经典、人物..."
-        button-text="搜索"
-        size="lg" />
+        size="lg"
+        :hidden-fields="['resource_type' => 'term']" />
 </div>
 </div>
 {{-- 今日条目 --}}
 {{-- 今日条目 --}}
 <div class="wiki-today-banner">
 <div class="wiki-today-banner">

+ 4 - 3
api-v12/resources/views/library/wiki/show.blade.php

@@ -6,11 +6,12 @@
 @section('wiki-content')
 @section('wiki-content')
 {{-- 搜索框组件 --}}
 {{-- 搜索框组件 --}}
 <div class="wiki-search-wrapper">
 <div class="wiki-search-wrapper">
-    <x-wiki.search-box
+    <x-ui.search-input
         :action="route('library.search')"
         :action="route('library.search')"
+        :value="request('q')"
         placeholder="搜索佛法词条、经典、人物..."
         placeholder="搜索佛法词条、经典、人物..."
-        button-text="搜索"
-        size="lg" />
+        size="lg"
+        :hidden-fields="['resource_type' => 'term']" />
 </div>
 </div>
 <article class="wiki-card">
 <article class="wiki-card">