Skip to content

Commit

Permalink
修改标题、内容字段的索引类型,修复启用插件时的报错提示
Browse files Browse the repository at this point in the history
  • Loading branch information
jjandxa committed Jan 14, 2021
1 parent 0fbf501 commit a0ee637
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type = id
index = self

[title]
index = self
type = title

[content]
type = body
Expand Down
15 changes: 12 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jjandxa/flarum-ext-chinese-search",
"description": "chinese search",
"version": "0.0.9",
"version": "0.0.10",
"type": "flarum-extension",
"license": "apache-2.0",
"authors": [
Expand All @@ -14,9 +14,12 @@
"email": "[email protected]"
}
],
"support": {
"source": "https://github.com/jjandxa/flarum-ext-chinese-search"
},
"minimum-stability": "beta",
"require": {
"flarum/core": "^0.1.0-beta.14",
"flarum/core": "^0.1.0-beta.15",
"hightman/xunsearch": "*@beta"
},
"autoload": {
Expand All @@ -28,5 +31,11 @@
"flarum-extension": {
"title": "Chinese Search"
}
}
},
"funding": [
{
"type": "website",
"url": "https://github.com/jjandxa/flarum-ext-chinese-search"
}
]
}
1 change: 0 additions & 1 deletion migrations/2017_10_15_080540_init.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

foreach ($posts as $post) {
$doc = $xunSearchUtils->getDocument($discussion, $post, $posts->count());
echo $discussion->title."->".$post->id."===";
$index->add($doc);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Service/XunSearchService.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function convertDiscussion($query, $limit, $offset, $sort) {
}

try {
$tempDiscData = $search->search("title:$query OR $query");
$tempDiscData = $search->setFuzzy(true)->search("title:$query OR $query");
} catch (\XSException $e) {
$tempDiscData = [];
}
Expand Down

0 comments on commit a0ee637

Please sign in to comment.