首页 \ 问答 \ PHP Solr PECL扩展支持字段更新(PHP Solr PECL Extension Support Field Updating)

PHP Solr PECL扩展支持字段更新(PHP Solr PECL Extension Support Field Updating)

基于我在这个SO答案中找到的信息:

更新SOLR索引的特定字段

从Solr 4.0开始,可以通过HTTP API更新Solr文档的特定字段。

在这里查看PHP Solr PECL扩展页面:

http://pecl.php.net/package/solr

似乎暗示已添加Solr 4.0功能支持。 我在这里查看了扩展的文档:

http://www.php.net/manual/en/book.solr.php

特别是addDocument的文档:

http://www.php.net/manual/en/solrclient.adddocument.php

但它似乎并不表示“覆盖”文档是否意味着删除它然后添加当前文档,或单独更新字段。 似乎没有任何专门用于更新字段的方法。

有谁知道扩展是否能够在不删除文档的情况下更新字段值?


Based on information I found in this SO answer:

Update specific field on SOLR index

as of Solr 4.0, updating specific fields of a Solr document is possible via its HTTP API.

Looking on the PHP Solr PECL extension page here:

http://pecl.php.net/package/solr

seems to imply that Solr 4.0 feature support has been added. I looked through the documentation for the extension here:

http://www.php.net/manual/en/book.solr.php

and in particular the documentation for addDocument here:

http://www.php.net/manual/en/solrclient.adddocument.php

but it does not seem to indicate whether or not "overwriting" a document means deleting it and then adding the current document, or updating fields individually. There does not appear to be any methods specifically meant to update fields either.

Does anyone know if the extension has the capability of updating field values without deleting the document?


原文:
更新时间:2022-09-30 07:09

最满意答案

您可以通过连接URL获取所需的页面。 一旦你有了文件然后寻找elemnt'td'(如果文本在上/下根据你需要使用TD / td,则检查文件到控制台)。 然后得到文本。

Document document = Jsoup.connect("http://www.google.com").get();
Element table = document.getElementById("tableId");
Elements tds = table.getElementsByTag("td");
for(Element td : tds)
{
    System.out.println(td.text());
}

You can get the required page by connecting the URL. once you have the document then look for elemnt 'td'(check the document by printing it to console if the text is in upper/lower based on that you need to use TD/td). Then get the text.

Document document = Jsoup.connect("http://www.google.com").get();
Element table = document.getElementById("tableId");
Elements tds = table.getElementsByTag("td");
for(Element td : tds)
{
    System.out.println(td.text());
}

相关问答

更多