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

标签 windows solr

我需要验证文本提取是否正在我在 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 .

Invoke-WebRequest

关于windows - 如何在 Windows 中将文件上传到 Solr?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7932897/

相关文章:

c# - 从mp3文件中删除特定的频率

windows - Visual Studio 2010——如何减少其内存占用

windows - 为什么 Windows 的 boot2docker 中的 bash 如此缓慢?

apache-spark - 在 solr v6+ 中替代 org.apache.solr.client.solrj.util.ClientUtils.toSolrInputDocument() 方法?

solr - 索引 csv 文件 solr - 缺少内容流

hadoop - Hadoop在减少步骤java.lang.NullPointerException时崩溃

windows - 哪个版本控制最适合这个需求列表

windows - 使用 Windows Compact 2013 Virtual PC 打开 COM 端口

solr - Nutch 与 Solr

php - Solr HTTP 错误 'Unknown Field' 使用 Solarium 时出错