一个完整的solr的增加索引的xml的格式:
<add allowDups = "true">
<doc boost="2.5">
<field name="Id">05991</field>
<field name="title" boost="2.0">Bridgewater</field>
<field name="content" boost="4.0">solr is very good search engine!</field>
</doc>
<doc>....</doc>
<doc>....</doc>
<commit/>
<optimize/>
</add>
--------------------------------------------
一:
Optional attributes for "add"
-
allowDups = "true" | "false" — default is "false"
-
commitWithin = "(milliseconds)" if the "commitWithin" attribute is present, the document will be added within that time.
Solr1.4 -
(deprecated) overwritePending = "true" | "false" — default is negation of allowDups
-
(deprecated) overwriteCommitted = "true"|"false" — default is negation of allowDups
The defaults for overwritePending and overwriteCommitted are linked to allowDups such that those defaults make more sense:
-
If allowDups is false (overwrite any duplicates), it implies that overwritePending and overwriteCommitted are true by default.
-
If allowDups is true (allow addition of duplicates), it implies that overwritePending and overwriteCommitted are false by default.
二:
Optional attributes for "commit" and "optimize"
-
maxSegments = N — default is '1' — optimizes down to at most this number of segments
Solr1.3 -
waitFlush = "true" | "false" — default is true — block until index changes are flushed to disk
-
waitSearcher = "true" | "false" — default is true — block until a new searcher is opened and registered as the main query searcher, making the changes visible.
用这个命令创建索引文件:
java -Durl=http://localhost:8080/solr/update -Ddata=files -jar post.jar *.xml
根据solr wiki 相关文章整理,详文请看:http://wiki.apache.org/solr/UpdateXmlMessages
本文介绍了如何使用XML格式为Solr创建和更新索引,包括add、commit和optimize等命令的详细用法及参数说明,并提供了实际操作的命令示例。
2445

被折叠的 条评论
为什么被折叠?



