如何在 Windows 中将文件上传到 Solr?

2024-03-06

我需要验证文本提取在 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(参见文件夹example\exampledocs of the apache-solr-X.X.X.zip):

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

OR

Windows PowerShell 3.0 有一个Invoke-WebRequest命令肯定可以用于此目的。看这篇博文 http://rambletech.wordpress.com/2011/09/21/windows-powershell-v3-includes-command-like-wgetcurl/.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在 Windows 中将文件上传到 Solr? 的相关文章

随机推荐