关于 Solr 你懂的

写代码写出法拉利 2014-03-17 05:44:03
先上 data-config.xml 内容
---------

<?xml version="1.0" encoding="utf-8"?>
<dataConfig>
<dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/test"
user="root"
password="root"/>
<document name="cms">
<entity name="view_blog" pk="id" query="select id,title,content from infos"
deltaQuery="select id,title,content from infos where last_modified > '${dataimporter.last_index_time}'" >
<field column="id" name="id" />
<field column="title" name="title" />
<field column="content" name="content" />
</entity>
<entity name="view_user" pk="uid" query="select uid,name,address from users where uid > 1"
deltaQuery="select uid,name,address from users where uid > 1 and last_modified > '${dataimporter.last_index_time}'" >
<field column="uid" name="uid_a" />
<field column="name" name="name_a" />
<field column="address" name="address_a" />
</entity>
</document>
</dataConfig>

----------------------

主要我想问下 solr 支持多列表查询吗? 我说的是 这个 entity 之间没有关联的列表, 例如我这里,上面的是用户表,下面的是信息表, 它们是单独的查询, 在用户页面里访问用户entity, 在信息页面里访问信息entity。 如果可以, 那么我在 http://127.0.0.1:8080/solr/collection1/select?q=*%3A*&wt=json&indent=true 这个查询时,怎么指定 entity 是哪个? 我现在查询只能查到一个表的。 当然有 .net 的例子最好了, 我用的是 SolrNet 库
...全文
71 回复 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复
Nutch Htmlunit Plugin 重要说明: 当前项目基于Nutch 1.X系列已停止更新维护,转向Nutch 2.x系列版本的新项目:http://www.oschina.net/p/nutch-ajax 项目简介 基于Apache Nutch 1.8和Htmlunit组件,实现对于AJAX加载类型页面的完整页面内容抓取解析。 According to the implementation of Apache Nutch 1.8, we can't get dynamic HTML information from fetch pages including AJAX requests as it will ignore all AJAX requests. This plugin will use Htmlunit to fetch whole page content with necessary dynamic AJAX requests. It developed and tested with Apache Nutch 1.8, you can try it on other Nutch version or refactor the source codes as your design. 主要特性 常规的HTML页面抓取: 对于常规的例如新闻类没有AJAX特性的页面可以直接用Nutch自带的protocol-http插件抓取。 常规的AJAX页面抓取: 对于绝大部分诸如jQuery ajax加载的页面,可以直接用protocol-htmlunit插件抓取。 特殊的AJAX请求页面抓取: 诸如淘宝/天猫的页面采用了独特的Kissy Javascript组件, 导致htmlunit无法直接感知到需要等待Kissy发起的请求完成,通过等待页面加载解析内容判断处理实现此类页面数据抓取。 基于页面滚动的AJAX请求页面抓取: 诸如淘宝/天猫的商品详情页面会基于页面滚动发起商品描述信息的加载, 通过protocol-htmlunit扩展处理可以实现此类页面数据抓取。 运行体验 由于Nutch运行是基于Unix/Linux环境的,请自行准备Unix/Linux系统或Cygwin运行环境。 git clone整个工程代码后,进行本地git下载目录: cd nutch-htmlunit/runtime/local bin/crawl urls crawl false 1 //urls参数为爬虫入库url文件目录; crawl为爬虫输出目录; false本应为solr索引url参数,此处设置为false不做solr索引处理; 1为爬虫执行回数 运行结束后可以看到天猫商品页面的价格/描述/滚动加载的图片等所有信息都已经完整获取到。 运行日志输入示例参考:http://git.oschina.net/xautlx/nutch-htmlunit/wikis/Log 扩展插件说明 protocol-htmlunit: 基于Htmlunit实现的AJAX页面Fetcher插件 parse-s2jh: 基于XPath解析页面元素内容; 基于数据库模式输出解析到结构化数据; 对于个别复杂类型AJAX页面定制判断页面加载完成的回调判断逻辑 index-s2jh: 追加设置需要额外传递给solr索引的属性数据; 设定不需要索引的页面规则; 欢迎关注作者其他项目: S2JH - 基于SSH的企业Web应用开发框架 12306 Hunter - (功能已失效不可用,不过还可以当作Swing开发样列参考只用)Java Swing C/S版本12306订票助手,用处你的 标签:nutch

10,612

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 其他
社区管理员
  • 其他
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧