如何在 Windows 中将文件上传到 Solr? [英] How can I upload a file to Solr in Windows?

查看:41
本文介绍了如何在 Windows 中将文件上传到 Solr?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要验证文本提取在 Windows Server 2003 上的 Solr 安装中是否正常工作.我找到的所有将文件上传到 Solr 的示例都使用如下所示的 curl.

I need to verify that text extraction is working on my Solr installation on Windows Server 2003. All the examples I found for uploading files to Solr use curl like below.

curl "http://localhost:8983/solr/update/extract?&extractOnly=true"  --data-binary @tutorial.html  -H 'Content-type:text/html'

如何在 Windows 中执行此操作?我想测试上传 pdf 和 Word 文档,然后确认我可以使用 Solr 管理页面搜索文档中包含的单词.

How can I do this in Windows? I want to test upload a pdf and Word document then confirm I can search for words contained in the document using Solr admin page.

推荐答案

随示例一起提供了一个 post.jar(参见 的文件夹 example\exampledocsapache-solr-XXXzip):

With the examples comes a post.jar (see folder 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

Windows PowerShell 3.0 有一个 Invoke-WebRequest 命令,当然可以用于此目的.请参阅这篇博文.

The Windows PowerShell 3.0 has an Invoke-WebRequest command which for sure could be used for that. See this blog post.

这篇关于如何在 Windows 中将文件上传到 Solr?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆