solr data-config.xml配置文件的见解mysql数据源
来源:互联网 发布:redis可视化工具linux 编辑:程序博客网 时间:2024/04/30 11:57
陆续完善:
http://localhost:8080/solr 进行DataImport时 找不到数据库中的entity
检查一下dataSource中的url
<dataSource type="JdbcDataSource" name="chishang" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://xxx.mysql.rds.aliyuncs.com/wjs?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8" user="xxxx" password="xxxx" />
一般都能用。如果不能用 将后面的编码格式去掉 试试看
<dataSource type="JdbcDataSource" name="chishang" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://xxxxx.mysql.rds.aliyuncs.com/wjs" user="xxxx" password="xxxx" />
data-config.xml配置文件
<entity name="product" dataSource="chishang"query="select id,'艺术品' cat,artists,content 'introduction',DATE_FORMAT(last_modified,'%Y-%m-%d') last_modified,focus,price,size,title,weight,proClassId,cast(concat('p',id) as char) as dockey from product where deleted=false"deltaImportQuery="select id,'艺术品' cat,artists,content 'introduction',DATE_FORMAT(last_modified,'%Y-%m-%d') last_modified,focus,price,size,title,weight,proClassId,cast(concat('p',id) as char) as dockey from product where cast(concat('p',id) as char)='${dih.delta.dockey}'"
deltaQuery="select cast(concat('p',id) as char) as dockey from product where cast(concat('p',id) as char) in (select cast(concat('p',id) as char) from product_class where
last_modified>'${dih.last_index_time}') or last_modified > '${dih.last_index_time}'"> //注意这里才是entity的结束括号
<entity name="product_picture" query="select path 'icon' from product_picture_tbl where productId='${product.id}'"> </entity>
</entity>
解释说明
(1):query中select哪些字段 a.为产品product表中哪些字段需要作为搜索的内容
b.内嵌的entity中需要用到的字段如:<entity name="product_picture" query="select path 'icon' from product_picture_tbl where productId='${product.id}'"></entity> 中的'${product.id}'中的id,必须在query 进行select的时候筛选出来。
deltaQuery="select cast(concat('p',id) as char) as dockey from product where cast(concat('p',id) as char) in (select cast(concat('p',id) as char) from product_class where
last_modified>'${dih.last_index_time}') or last_modified > '${dih.last_index_time}'"> product表中的last_modified>'${dih.last_index_time} 同时product_class表中的
last_modified>'${dih.last_index_time} 可能有点难理解,可以看solr官网。
deltaImportQuery="select id,'艺术品' cat,artists,content 'introduction',DATE_FORMAT(last_modified,'%Y-%m-%d') last_modified,focus,price,size,title,weight,proClassId,cast(concat('p',id) as char) as dockey from product wherecast(concat('p',id) as char)='${dih.delta.dockey}'"
${dih.delta.dockey} 中的dockey为deltaquery查询时的主键
deltaQuery是用来确认有没有记录要导入的,一般只返回记录ID.
deltaImportQuery是已经确认有记录要导入的情况下,用来获取要导入的记录所有属性的,是依据deltaQuery的ID来确定的。
意味着:deltaQuery返回了多少个ID,就会执行多少次deltaImportQuery
- solr data-config.xml配置文件的见解mysql数据源
- solr data-config.xml配置
- Solr 配置文件之core.properties、solr.xml和Config Sets
- Solr 配置文件之core.properties、solr.xml和Config Sets
- 关于solr中data-config.xml里面的各种Query的执行过程的学习
- 以mysql为数据源的Solr配置
- Solr之配置文件solr.xml。
- solr schema.xml配置文件的理解
- solr 的schema.xml配置文件详解
- Struts的核心struts-config.xml配置文件
- Struts的核心struts-config.xml配置文件
- 比较完整的Struts-config.xml配置文件
- 比较完整的Struts-config.xml配置文件
- mybatis的mybatis-config.xml配置文件详解
- struts-config.xml配置文件的scope
- struts-config.xml配置文件的scope
- Mybatis+mysql动态分页查询数据案例——Mybatis的配置文件(mybatis-config.xml)
- struts-config.xml配置文件
- flex 组件显示手型 光标
- svn回滚操作(撤销修改)
- ios 绘图
- 指针 数组
- Differences between Datasource and XADatasource
- solr data-config.xml配置文件的见解mysql数据源
- qt5 deploy 部署 双击 myProgram.exe时 提示找不着 ...windows 不能运行
- 让我们摸清楚多表连接的原理
- Spring 3 Ioc 容器装在bean
- 谈学习和比较
- android view或button的setVisibility方法值的意思
- VC++中List Control控件的使用方法介绍
- 不通尺寸的手机,文字大小设置
- Oracle创建数据库databaselink