bin/post 任何文件的 curl 命令

curl command for bin/post any file

这是我所做的:

$ bin/solr start
$ bin/solr create -c mytest
$ bin/post -c mytest -filetypes py,js ~/Projects

因此,我现在可以在我的一个主目录中查询和搜索 *.py 和 *.js 文件。我知道,如果其中一个文件的内容已更改,我可以通过此命令更新索引:

$ bin/post -c mytest ~/path_to_the_file  # this is what I try to achive with curl

所有这些步骤都完全可以。但是,问题是——我不知道,也无法在文档中找到如何获得与上面最后一个命令相同的结果的方式,该命令更新了索引。在命令行中,我看到了如何通过 curl 创建集合,在 Solr 管理页面上,我看到了如何通过 curl 发出请求来查询索引。但是最后一个命令缺少文档。

最终,我在论坛、话题和博客的海洋中找到了解决方案。索引纯文本(非结构化)文本文件的正确方法是:

$ curl 'http://127.0.0.1:8983:/solr/collection1/update/extract/?literal.id=
any_document_id_you_like&commit=true' -F 'myfile=@path_to_the_file_you_want_to_index'

按预期工作。我希望文档中有关于这种做事方式的内容。