我已经下载了solr 6.4.0版本并尝试将doucments索引到以前创建的名为" firstcore"的核心中,我最终得到以下错误:
D:\ solr-6.4.0 \ bin> post -c firstcore example / exampledocs / * .xml
'后'不被视为内部或外部命令, 可操作程序或批处理文件。
d:\ solr的-6.4.0 \ BIN>
你能告诉我有没有我需要做的配置/如何索引?
答案 0 :(得分:1)
bin/pos
目前仅作为Unix shell脚本存在,但它 将其工作委托给具有跨平台能力的Java程序。该SimplePostTool
可以直接在受支持的环境中运行, 包括 Windows 。这个工具捆绑在一个可执行的JAR中,可以直接使用
java -jar example/exampledocs/post.jar
。
请检查您在此路径下的Solr安装中是否有post.jar
,并且您已安装Java并配置为通过PATH访问
答案 1 :(得分:0)
在这里,您是Windows的“ post.cmd ”代码
注意:适用于Solr7(对于solr6,您应该进行一些修改/更改)
@echo off
rem * *****************************************************************
rem * POST Help *
rem * *****************************************************************
rem * SimplePostTool version 5.0.0
rem * Uses JAVA: java [SystemProperties] -jar post.jar [-h|-] [<file|folder|url|arg> [<file|folder|url|arg>...]]
rem * -h = prints thsi HELP
rem * - commits changes to SOLR core/collection
rem *
rem * Supported System Properties and their defaults:
rem * -Dc=<core/collection>
rem * -Durl=<base Solr update URL> (overrides -Dc option if specified)
rem * -Ddata=files|web|args|stdin (default=files)
rem * -Dtype=<content-type> (default=application/xml)
rem * -Dhost=<host> (default: localhost)
rem * -Dport=<port> (default: 8983)
rem * -Dbasicauth=<user:pass> (sets Basic Authentication credentials)
rem * -Dauto=yes|no (default=no)
rem * -Drecursive=yes|no|<depth> (default=0)
rem * -Ddelay=<seconds> (default=0 for files, 10 for web)
rem * -Dfiletypes=<type>[,<type>,...] (default=xml,json,jsonl,csv,pdf,doc,docx,ppt,pptx,xls,xlsx,odt,odp,ods,ott,otp,ots,rtf,htm,html,txt,log)
rem * -Dparams="<key>=<value>[&<key>=<value>...]" (values must be URL-encoded)
rem * -Dcommit=yes|no (default=yes)
rem * -Doptimize=yes|no (default=no)
rem * -Dout=yes|no (default=no)
rem
rem * This is a simple command line tool for POSTing raw data to a Solr port.
rem * NOTE: Specifying the url/core/collection name is mandatory.
rem * Data can be read from files specified as commandline args,
rem * URLs specified as args, as raw commandline arg strings or via STDIN.
rem * Examples:
rem * java -Dc=gettingstarted -jar post.jar *.xml
rem * java -Ddata=args -Dc=gettingstarted -jar post.jar '<delete><id>42</id></delete>'
rem * java -Ddata=stdin -Dc=gettingstarted -jar post.jar < hd.xml
rem * java -Ddata=web -Dc=gettingstarted -jar post.jar http://example.com/
rem * java -Dtype=text/csv -Dc=gettingstarted -jar post.jar *.csv
rem * java -Dtype=application/json -Dc=gettingstarted -jar post.jar *.json
rem * java -Durl=http://localhost:8983/solr/techproducts/update/extract -Dparams=literal.id=pdf1 -jar post.jar solr-word.pdf
rem * java -Dauto -Dc=gettingstarted -jar post.jar *
rem * java -Dauto -Dc=gettingstarted -Drecursive -jar post.jar afolder
rem * java -Dauto -Dc=gettingstarted -Dfiletypes=ppt,html -jar post.jar afolder
rem * The options controlled by System Properties include the Solr
rem * URL to POST to, the Content-Type of the data, whether a commit
rem * or optimize should be executed, and whether the response should
rem * be written to STDOUT. If auto=yes the tool will try to set type
rem * automatically from file name. When posting rich documents the
rem * file name will be propagated as "resource.name" and also used
rem * as "literal.id". You may override these or any other request parameter
rem * through the -Dparams property. To do a commit only, use "-" as argument.
rem * The web mode is a simple crawler following links within domain, default delay=10s.
set CORE=%2
set DELAY=1
set RECURSIVE=%5
set HOST=localhost
set PORT=8983
set FTYPES=%6
set PARAMS="uprefix=attr_^&literal.id=%3"
set DATA=%4
set URI=%1
@echo off
if [%2]==[] goto usage
if [%5]==[] set RECURSIVE=yes
if [%4]==[] set DATA="files"
if [%3]==[] set PARAMS=uprefix=attr_^&literal.id=
if [%6]==[] set FTYPES=
if [%1]==[] goto usage
echo.
echo about to execute:
echo java -Dc=%CORE% -Ddelay=%DELAY% -Drecursive=%RECURSIVE% -Dhost=%HOST% -Dport=%PORT% -Dfiletypes=%FTYPES% -Dparams=%PARAMS% -Ddata=%DATA% -Dauto=yes -jar ../example/exampledocs/post.jar -h %URI%
echo.
cmd /C "java -Dc=%CORE% -Ddelay=%DELAY% -Drecursive=%RECURSIVE% -Dhost=%HOST% -Dport=%PORT% -Dfiletypes=%FTYPES% -Dparams=%PARAMS% -Ddata=%DATA% -Dauto=yes -jar ../example/exampledocs/post.jar %URI%"
goto end
:usage
@echo off
echo.
echo Usage syntax: post "full/url/or/uri-to-document,full/url/or/uri-to-folder" "core/collection name" [document-id] [filetypes:pdf,xml,docx,...] [data-type:files,web,args,stdin] [recursive:yes,no,depth[es: 99]]
echo.
echo Usage example: post "../docs/apache-solr-ref-guide-7.5.pdf" "nur" "apache-solr-ref-guide-7.5.pdf"
echo.
echo HELP:
cmd /C "java -jar ../example/exampledocs/post.jar -h
:end
echo.
echo.