我需要验证文本提取是否正在我在 Windows Server 2003 上安装的 Solr 上运行。我找到的所有将文件上传到 Solr 的示例都使用 curl,如下所示。
curl "http://localhost:8983/solr/update/extract?&extractOnly=true" --data-binary @tutorial.html -H 'Content-type:text/html'
我如何在 Windows 中执行此操作?我想测试上传 pdf 和 Word 文档,然后确认我可以使用 Solr 管理页面搜索文档中包含的单词。
最佳答案
示例附带一个 post.jar
(请参阅 apache-solr-X.X.X.zip
的文件夹 example\exampledocs
):
java -jar post.jar -h
This is a simple command line tool for POSTing raw data to a Solr
port. Data can be read from files specified as commandline args,
as raw commandline arg strings, or via STDIN.
Examples:
java -jar post.jar *.xml
java -Ddata=args -jar post.jar '<delete><id>42</id></delete>'
java -Ddata=stdin -jar post.jar < hd.xml
java -Durl=http://localhost:8983/solr/update/csv -Dtype=text/csv -jar post.jar *.csv
java -Durl=http://localhost:8983/solr/update/json -Dtype=application/json -jar post.jar *.json
java -Durl=http://localhost:8983/solr/update/extract?literal.id=a -Dtype=application/pdf -jar post.jar a.pdf
Other options controlled by System Properties include the Solr
URL to POST to, the Content-Type of the data, whether a commit
or optimize should be executed, and whether the response should
be written to STDOUT. These are the defaults for all System Properties:
-Ddata=files
-Dtype=application/xml
-Durl=http://localhost:8983/solr/update
-Dcommit=yes
-Doptimize=no
-Dout=no
或
Windows PowerShell 3.0 有一个 Invoke-WebRequest
命令,肯定可以用于此目的。参见 this blog post .
关于windows - 如何在 Windows 中将文件上传到 Solr?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7932897/