文件搜索的详细信息

搜索选项

可以在seafevents.conf中设置以下选项来控制文件搜索的行为。你需要重新启动seafile和seahub使它们生效。

[INDEX FILES]
## must be "true" to enable search
enabled = true

## The interval the search index is updated. Can be s(seconds), m(minutes), h(hours), d(days)
interval=10m

## If true, indexes the contents of office/pdf files while updating search index
## Note: If you change this option from "false" to "true", then you need to clear the search index and update the index again.
index_office_pdf=false

启用 Office/PDF 文件的全文搜索

全文搜索默认情况下不启用以保存系统资源。如果要启用它,您需要按照以下说明进行操作。

首先,您必须在 seafevents.conf 中将 index_office_pdf 选项的值设置为 true

然后重新启动seafile服务。

cd /data/haiwen/seafile-pro-server-1.7.0/
./seafile.sh restart

你需要删除现有的搜索索引并重建它。

./pro/pro.py search --clear
./pro/pro.py search --update

使用现有的 ElasticSearch 服务

搜索模块使用与Seafile Professional Server捆绑在一起的ElasticSearch服务。但是,您可能在您的公司中运行了一个现有的ElasticSearch服务器或集群。在这种情况下,您可以更改配置文件以使用现有的ES服务器或集群。

此功能在Seafile Professional Server 2.0.5中已添加。

更改配置文件

[INDEX FILES]
...
external_es_server = true
es_host = 192.168.1.101
es_port = 9500

常见问题

如果出现问题,请重建索引

您可以通过执行以下命令重建搜索索引:

./pro/pro.py search --clear
./pro/pro.py search --update

如果这样不能解决问题,可以尝试以下步骤:

  1. 停止 Seafile 服务
  2. 删除旧的搜索索引 rm -rf pro-data/search
  3. 重启 Seafile 服务
  4. 稍等片刻,然后执行 ./pro/pro.py search --update

当我搜索关键字时,没有返回结果

搜索索引默认每10分钟更新一次,所以在执行第一次搜索更新之前,无论你搜索什么都没有结果。

为了能立即搜索:

cd haiwen/seafile-pro-server-2.0.4
./pro/pro.py search --update

无法搜索加密文件

这是因为服务器无法对加密文件进行索引,因为它们被加密了。

增加用于搜索的Java进程堆大小

搜索功能基于Elasticsearch服务,这是一个Java进程。要增加Java堆内存大小,可以通过修改jvm配置文件来修改Elasticsearch使用的内存大小空间。例如,修改为2G内存空间。修改seafile-server-latest/pro/elasticsearch/config/jvm.options文件的以下配置项:

-Xms2g # 最小使用内存空间
-Xmx2g # 最大使用内存空间
### 建议将以上两个配置项的值设置为一样大小。

重启seafile服务使上述修改生效:

./seafile.sh restart
./seahub.sh restart

Last modified by Daniel Pan, 2021-08-17

搜索选项
启用 Office/PDF 文件的全文搜索
使用现有的 ElasticSearch 服务
更改配置文件
常见问题
如果出现问题,请重建索引
当我搜索关键字时,没有返回结果
无法搜索加密文件
增加用于搜索的Java进程堆大小