PHP Solr PECL扩展支持字段更新(PHP Solr PECL Extension Support Field Updating)
基于我在这个SO答案中找到的信息:
从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?
原文:
最满意答案
您可以通过连接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()); }
相关问答
更多-
JSoup没有显示Java中的所有html(缺少td和tr标签)(JSoup not showing all the html in Java (td and tr tags missing))[2022-08-23]
Jsoup是一个解析器。 这意味着它无法执行任何可能生成html的javascript代码。 当您遇到此问题时,检索该内容的唯一方法是通过无头浏览器 ,其中包括一个javascript引擎。 一个流行的图书馆是selenium webdriver 。 为了确定您尝试解析的内容是在服务器(静态内容)还是在客户端(生成的动态内容-javascript)中生成,您可以执行以下操作: 访问您要解析的页面 按Ctrl + U. 上面的步骤将打开一个新选项卡,其中包含jsoup收到的内容。 如果你需要的内容不存在,那么 ... -
使用jQuery在表中基于`td`的值隐藏`tr`(Hide a `tr` based on the values of `td` in the table using jQuery)[2023-09-28]
你可以这样做 : $('tr').each(function(){ var tr = $(this); if (tr.find('td:eq(0)').text()=="0" && tr.find('td:eq(1)').text()=="0" && tr.find('td:eq(2)').text()=="0" ) tr.addClass('hidden'); }); 演示 (隐藏的类将颜色更改为红色,更清晰......) 根据您的需要,您可能需要 ... -
如何使用jsoup提取
的值?(How to extract value of using jsoup ?)[2022-01-30] import java.io.IOException; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; public class Main { public static void main(String[] args) { // SET the URL Strin ...以下源代码中清楚地描述了所有内容。 private static String test(String htmlFile) { File input = null; Document doc = null; Elements tdEles = null; Element table = null; String tdContents = ""; try { input = new File(htmlFile); doc = J ...在一个TR中加上TD(Sum TD in one TR)[2022-08-15]
你的代码应该像这样。 你需要用问题中的特定类遍历td并总结这些值。 然后将该值分配给您所指的输入。 $('tr.here').each(function(){ var sum = 0; $('.two, .three, .four', this).each(function() { sum += parseFloat(this.value); }); $('.sum', this).val(sum); }) 检查小提琴 Your code should l ...我猜这段代码足够自我解释。 XPath使用了三次:用于查找所有表行,获取标签以及获取所有输入值。 foreach($xpath->query('.//tbody/tr[@class="rowData"]') as $row) { echo '\n"; foreach($xpath->query('td[position() > 1]/div/ ...表格问题与
(Table issues with )[2022-05-28] 您需要考虑具有五列的每一行,然后使用colspan,其中一行中的单元格跨越多列。 例如: