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

Joh*_*n81 12 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'
Run Code Online (Sandbox Code Playgroud)

我怎么能在Windows中这样做?我想测试上传pdf和Word文档,然后确认我可以使用Solr管理页面搜索文档中包含的单词.

jeh*_*eha 18

随着例子而来的post.jar(见文件夹example\exampledocsapache-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
Run Code Online (Sandbox Code Playgroud)

要么

Windows PowerShell 3.0有一个Invoke-WebRequest命令,肯定可以用于此.看到这篇博文.

调用-的WebRequest


Sha*_*alu 5

使用 solr 5.0,您必须在更新文档时提及核心名称。因此,在 exampledocs 中发布所有示例的命令将是:

java -Dc="core_name" -jar post.jar *.xml

这里用核心名称替换 core_name