xunsearch.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. return [
  3. //@see http://www.xunsearch.com/doc/php/guide/ini.guide
  4. "project" => [
  5. "project.name" => "tipask",
  6. "project.default_charset" => "utf-8",
  7. "server.index" => env('XUNSEARCH_INDEX',"127.0.0.1:8383"),
  8. "server.search" => env('XUNSEARCH_SEARCH',"127.0.0.1:8384"),
  9. //remember change FIELD_LABEL_DEFAULT_SEARCH_PK value in Config.php
  10. "primary_key" => [
  11. "type" => "id"
  12. ],
  13. //remember change FIELD_LABEL_DEFAULT_CLASS_ID value in Config.php
  14. "class_uid" => [
  15. "index" => "both"
  16. ],
  17. //remember change FIELD_LABEL_DEFAULT_DB_PK value in Config.php
  18. "id" => [
  19. "type" => "numeric"
  20. ],
  21. "subject" => [
  22. "type" => "title"
  23. ],
  24. "status" => [
  25. 'type' => "numeric"
  26. ],
  27. "content" => [
  28. "type" => "body"
  29. ]
  30. ],
  31. /*
  32. |--------------------------------------------------------------------------
  33. | The configurations of search index.
  34. |--------------------------------------------------------------------------
  35. |
  36. | The "models" is the list of the descriptions for models. Each description
  37. | must contains class of model and fields available for search indexing.
  38. |
  39. | For example, model's description can be like this:
  40. |
  41. | 'namespace\ModelClass' => [
  42. | 'fields' => [
  43. | 'name', 'description', // Fields for indexing.
  44. | ]
  45. | ]
  46. |
  47. */
  48. 'index' => [
  49. 'models' => [
  50. \App\Models\Question::class => [
  51. 'fields' => [
  52. 'title' => [
  53. 'search_field' => 'subject',
  54. ],
  55. 'description' => [
  56. 'search_field' => 'content',
  57. ],
  58. 'status' => [
  59. 'search_field' => 'status',
  60. ],
  61. ],
  62. 'primary_key' => 'id'
  63. ],
  64. \App\Models\Article::class => [
  65. 'fields' => [
  66. 'title' => [
  67. 'search_field' => 'subject',
  68. ],
  69. 'content' => [
  70. 'search_field' => 'content',
  71. ],
  72. 'status' => [
  73. 'search_field' => 'status',
  74. ],
  75. ],
  76. 'primary_key' => 'id'
  77. ],
  78. \App\Models\User::class => [
  79. 'fields' => [
  80. 'name' => [
  81. 'search_field' => 'subject',
  82. ],
  83. 'title' => [
  84. 'search_field' => 'content',
  85. ],
  86. 'status' => [
  87. 'search_field' => 'status',
  88. ],
  89. ],
  90. 'primary_key' => 'id'
  91. ],
  92. \App\Models\Tag::class => [
  93. 'fields' => [
  94. 'name' => [
  95. 'search_field' => 'subject',
  96. ],
  97. 'summary' => [
  98. 'search_field' => 'content',
  99. ],
  100. ],
  101. 'primary_key' => 'id'
  102. ]
  103. ]
  104. ],
  105. ];