solr的索引数据可以存放到数据库索引怎么用吗

16:29 提问
求问为什么solr增量更新之后只有改变的数据
本人是solr初学者,在使用的时候发现增量更新之后,数据只存在修改过的数据,没修改的数据不见了,一直没发现是什么问题。
下面是全量索引:一共是7条数据
修改其中一条数据之后进行增量索引(删除3条是因为有三条被标注删除了)
Execute之后点击Query就只有这条修改过的数据了,其他没修改的数据都不见了
以下是我的配置:
data-config.xml:
schema.xml:
按时间排序
要是我没记错,勾选clean会清除之前建的索引。
clean Default is true. Tells whether to clean up the index before the indexing is started.
谢谢,之前一直以为是配置的原因
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐清除回答草稿
&&&您需要以后才能回答,未注册用户请先。博客分类:
在一次技术群中,中听到一位sina的架构师,他们是采用基于lucene做的搜索服务,索引在20多G数据量,差不多是在亿的级别上,PV量在500万 /天左右,高峰时期500个并发量/s,采用的是增量索引 ,读写索引都在同一台机上。他们并没有采用分布式,而是采用单机提供服务,主要是在配置上内存提高 到32-64G,再加cpu:32个core.
到底他们在架构上采取了什么样的优化,并不得而知。但从中可以得知,采取大内存的处理比使用硬盘的快1000倍左右。所以我们也测试 了一下采用大内存的设计。使用的机器配置是32G,4个core CPU。
使用的搜索服务是用solr搭建的,主要修改它的索引目录位置,将索引目录设置为内存(在linux中,可以将内存映射为硬盘),然后关掉了其它8 台大索引的服务,即是将主要的搜索服务都分给新配置的机器。测试了几天,它的性能果真是好很多。平均响应时间是30ms。在取文档的时间上几乎为0ms, 主要消耗的时间在计算跟排序上,由于排序时用了六个索引字段,动态计算bf分数,这里才是费了最多时间的。而这里其实也可以优化的,即在建索引的时候,就 先计算好每个文档的bf分数(有时间再做优化)。相信可以提高到10ms左右的响应时间 。
solr的本身设计也是多线程,高峰的时候有几十条线程并发,负载到了4左右,现在单机的瓶颈在CPU上,如果cpu再高些,基本上就可以安稳地顶起高峰时期,或者再多台同样配置的机器负载。
现在的索引只有8G,如果到了20G(一亿左右的数据量)的话,不知道会怎么样,请拭目以待。
原文:http://blog.csdn.net/duck_genuine/article/details/6103088
浏览: 1651719 次
来自: 杭州
,默认是netty还是hassion?
课程——基于Python数据分析与机器学习案例实战教程分享网盘 ...
leibnitz 写道hi,我想知道,无论在92还是94版本, ...
hi,我想知道,无论在92还是94版本,更新时(如Puts)都 ...
不错,谢谢!
(window.slotbydup=window.slotbydup || []).push({
id: '4773203',
container: s,
size: '200,200',
display: 'inlay-fix'solr的用法-存储数据到索引库
之前简单的介绍了一下solr的功能已经部署成功以后的用法,现在就讲解一下具体怎么样去通过配置和编写代码实现吧数据存储到索引库
这里以商品为例,一把我们在实际项目中特别是商城经常需要对商品进行全文检索
配置:需要存储的数据结构(字段)
&schema name="example" version="1.5"&
&field name="_version_" type="long" indexed="true" stored="true"/&
&field name="_root_" type="string" indexed="true" stored="false"/&
&field name="id" type="long" indexed="true" stored="true" required="true" multiValued="false" /&
&field name="title" type="text_ik" indexed="true" stored="true" required="true" multiValued="false" /&
&field name="sellPoint" type="text_ik" indexed="true" stored="true" required="true" multiValued="false" /&
&field name="price" type="long" indexed="true" stored="true" required="true" multiValued="false" /&
&field name="image" type="string" indexed="true" stored="true" required="true" multiValued="false" /&
&field name="cid" type="long" indexed="true" stored="true" required="true" multiValued="false" /&
&field name="status" type="int" indexed="true" stored="true" required="true" multiValued="false" /&
&uniqueKey&id&/uniqueKey&
&fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/&
&fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/&
&fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/&
&fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/&
&fieldType name="string" class="solr.StrField" sortMissingLast="true" /&
&fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0"/&
&fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/&
&fieldType name="text_ik" class="solr.TextField"&
&analyzer class="org.wltea.analyzer.lucene.IKAnalyzer"/&
&/fieldType&这里做一下简单的介绍:
field标签就是属性(字段),一个field标签就是一个属性,标签里面也有属性name字段名、 type字段类型、indexed是否支持索引(通过该字段查询),stored是否存储(有些字段不需要存储)、 required存储是是否能为空null(类似数据库的非空约束)、multiValued是否有多个值。
field的定义是比较重要,有几个技巧需注意一下,对可能存在多值得字段尽量设置 multiValued属性为true,避免建索引是抛出错误;如果不需要存储相应字段值,尽量将stored属性设为false。
fieldType便签就是数据类型,索引库的数据类型,就像我们java 数据库都有自己的数据类型,那么这里索引库也是有自己的数据类型的,java中的基本的一些数据类型在索引库都能找到对应的。这里就不一一做介绍了
索引库的配置这方面做好以后就需要去编写java对象了
package com.tiantian.search.
import org.apache.solr.client.solrj.beans.F
public class Item
//商品标题
//商品卖点
private String sellP
//商品价格
//商品库存
//商品条形码
//商品图片(路径)
//商品所属类目
//状态 1-正常,2-下架,3-删除'
public Long getId() {
public void setId(Long id) {
public String getTitle() {
public void setTitle(String title) {
this.title =
public String getSellPoint() {
return sellP
public void setSellPoint(String sellPoint) {
this.sellPoint = sellP
public Long getPrice() {
public void setPrice(Long price) {
this.price =
public Integer getNum() {
public void setNum(Integer num) {
this.num =
public String getBarcode() {
public void setBarcode(String barcode) {
this.barcode =
public String getImage() {
public void setImage(String image) {
this.image =
public Long getCid() {
public void setCid(Long cid) {
this.cid =
public Integer getStatus() {
public void setStatus(Integer status) {
this.status =
就是这样的一个javaBean 和配置一一对应以后就可以对索引库进行存储和删除org.apache.solr.client.solrj.impl.HttpSolrServer //操作索引库的对象
httpSolrServer.addBean(item);//新增和修改
httpSolrServer.deleteById(itemId);//删除
httpSolrServer.commit();//提交跟新
使用solrj操作solr索引库
Solr-6.5.1搭建索引库
solr索引库添加
认识solr结构,了解核心的文件目录
solr索引如何存储
solr索引库总结
Solr调研总结(很详细很全面)
实现Solr索引数据存放到HDFS下
转:solr 从数据库导入数据,全量索引和增量索引(实例&配置&原理)
solr 学习之路 如何将数据库中大量的数据导入solr
没有更多推荐了,扫一扫体验手机阅读
solr导入数据的高效方法
<span type="1" blog_id="1403656" userid='
184篇文章,109W+人气,18粉丝
大数据时代的微服务之路
¥51.00488人订阅
<span type="1" blog_id="1403656" userid='

我要回帖

更多关于 数据库索引使用 的文章

 

随机推荐