php solr 更新数据类型,Solr更新文档数据
使用XML更新文檔
以下是用于更新現有文檔中的字段的XML文件。將下面的內容保存在名稱為update.xml的文件中。
001
Raj
Malhotra
9000000000
Delhi
正如上面看到的,寫入更新數據的XML文件就類似之前用來添加文檔的XML文件。 但唯一的區別是這里使用字段的一個update屬性。
在這個示例中,我們將使用上述文檔并嘗試更新id為001文檔的字段。
假設XML文檔(update.xml)存在于Solr的bin目錄中。更新的核心是名稱為my_core的索引,可以使用post工具更新如下
[web3@ubuntu:/usr/local/solr-6.4.0/bin]$ ./post -c my_core update.xml
執行上述命令后,將得到以下輸出
web3@ubuntu:/usr/local/solr-6.4.0/bin$ ./post -c my_core update.xml
/usr/local/jdk1.8.0_65/bin/java -classpath /usr/local/solr-6.4.0/dist/solr-core-6.4.0.jar -Dauto=yes -Dc=my_core -Ddata=files org.apache.solr.util.SimplePostTool update.xml
SimplePostTool version 5.0.0
Posting files to [base] url http://localhost:8983/solr/my_core/update...
Entering auto mode. File endings considered are xml,json,jsonl,csv,pdf,doc,docx,ppt,pptx,xls,xlsx,odt,odp,ods,ott,otp,ots,rtf,htm,html,txt,log
POSTing file update.xml (application/xml) to [base]
1 files indexed.
COMMITting Solr index changes to http://localhost:8983/solr/my_core/update...
Time spent: 0:00:00.246
驗證修改結果
訪問Apache Solr Web界面的主頁,選擇核心 -?my_core。 嘗試通過在文本區域q中傳遞查詢“:”來檢索所有文檔,并執行查詢。 執行時可以觀察到文檔已經更新了。
總結
以上是生活随笔為你收集整理的php solr 更新数据类型,Solr更新文档数据的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php 访问类成员,PHP类成员的访问方
- 下一篇: java增加final,Java8增加功