solr bat文件

1.加数据

add.bat 参照下面

@echo off
SETLOCAL
SET HOST=localhost:8080
ECHO Post to http://%HOST%/solr-sample/update
java -Durl=http://%HOST%/solr-sample/update -jar ..\post.jar book.xml
ENDLOCAL
PAUSE > NUL

book.xml参照下面
<add>
<doc>
  <field name="IS_S.book.TITLE">python</field>
  <field name="IS_I.book.PRICE">18</field>
  <field name="id">@book.9784894713871</field>
</doc>
<doc>
  <field name="IS_S.book.TITLE">ORACLE</field>
  <field name="IS_I.book.PRICE">15</field>
  <field name="id">@book.9784898144930</field>
</doc>
</add>

2.删除一条数据
deleteById.bat 参照下面

@echo off
SETLOCAL
SET HOST=localhost:8080
ECHO Post to http://%HOST%/solr-sample/update
java -Durl=http://%HOST%/solr-sample/update -jar ..\post.jar deleteById.xml
ENDLOCAL
PAUSE > NUL

deleteById.xml参照下面
<delete><query>id:@book.9784894713871</query></delete>

3.删除全部数据
delete.bat 参照下面
@echo off
SETLOCAL
SET HOST=localhost:8080
ECHO Post to http://%HOST%/solr-sample/update
java -Durl=http://%HOST%/solr-sample/update -jar ..\post.jar delete.xml
ENDLOCAL
PAUSE > NUL

delete.xml参照下面
<delete><query>*:*</query></delete>

放置的位置\tomcat\6.0.10\solrapps\SOLR_HOME


你可能感兴趣的:(java,oracle,xml,python,Solr)