`

Solr 4.0: Realtime GET

 
阅读更多

he next functionality I decided to look at, from the upcoming Solr 4.0, is the so called “Realtime Get”. It allows you to see the data even though it was not yet added to the index, thus before the commit operation being sent to Solr. Let’s see how it works.

Some theory

Data update in Lucene and Solr has one disadvantage – when you submit index updates they can’t be seen until commit operation is run. The problem is that commit is costly in terms of performance and intense commiting may cause performance problems. So, when you need your data to be visible right after being change you may be forced to choose – either performance, or fast updates. In order to address that Lucene and Solr are working towards enabling Near Real Time (NRT) searching. In Lucene we have that possibility, in Solr 4.0 we will also be able to use that and not only that.

Configuration

In order to use Realtime Get functionality we need to configure the following Solr features:

Transaction log

The first thing to configure is the transaction log writing. In order to do that you need to add the following to your updateHandler configuration:

1 <updateLog>
2   <str name="dir">${solr.data.dir:}</str>
3 </updateLog>

The above entry says, that the directory holding transaction log will be located in the same directory where the index directory is located.

Realtime Get handler

The second thing that needs to be done, to see the Realtime Get in action, is the appropriate handler configuration (or adding component to your already defined handler). To do that add the following to your solrconfig.xml file:

1 <requestHandler name="/get" class="solr.RealTimeGetHandler">
2   <lst name="defaults">
3     <str name="omitHeader">true</str>
4   </lst>
5 </requestHandler>

The above entry it’s nothing unusual – it just add a new request handler implementing solr.RealTimeGetHandler class, which enables checking the transaction log.

Action

To check how Realtime Get works I decided to do a simple test. The first thing I did is indexing one file (from the ones that are available in the exampledocs directory) with the use of the following bash command:

1 curl 'http://localhost:8983/solr/update' -d @hd.xml -H 'Content-type:application/xml'

Of course I did not send the commit operation after indexing. As we could expect the following query:

didn’t return search results. So let’s check, if the handler registered as /get will be able to get us some results. In order to do that I send the following query:

And in result I got the following document:

01 <?xml version="1.0" encoding="UTF-8"?>
02 <response>
03 <doc name="doc">
04   <str name="id">SP2514N</str>
05   <str name="name">Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133</str>
06   <str name="manu">Samsung Electronics Co. Ltd.</str>
07   <str name="manu_id_s">samsung</str>
08   <arr name="cat">
09     <str>electronics</str>
10     <str>hard drive</str>
11   </arr>
12   <arr name="features">
13     <str>7200RPM, 8MB cache, IDE Ultra ATA-133</str>
14     <str>NoiseGuard, SilentSeek technology, Fluid Dynamic Bearing (FDB) motor</str>
15   </arr>
16   <float name="price">92.0</float>
17   <int name="popularity">6</int>
18   <bool name="inStock">true</bool>
19   <date name="manufacturedate_dt">2006-02-13T15:26:37Z</date>
20   <str name="store">35.0752,-97.032</str></doc>
21 </response>

So Solr returned the result that wasn’t added to the index – nice !

Usage possibilities

You probably noticed, that in order to fetch a document with /get handler I needed to provide it’s unique identifier (or identifiers list). That’s true, Realtime Get doesn’t support searching, because it was not created to support full searching. This functionality is able to show us the updates of the documents which identifiers are known (so for example the ones in the index) – in example by adding the component used in solr.RealTimeGetHandler to any of your defined handler. And the good news is – you don’t have to worry update performance – solr.RealTimeGet is very fast. So, if one of your problems is frequent updated you can look in the future with a smile :)

Last few words

The Realtime Get functionality brings new possibilities when it comes to Solr and also on the road to the SolrCloud. With the use of transaction log one can implement automatic cluster node restore or instance NRT instance updates. As you can see Solr 4.0 is not only about search, but also about data store and bringing Solr closer to NoSQL solutions.

 

 

转自:http://solr.pl/en/2012/01/09/solr-4-0-realtime-get-2/

分享到:
评论

相关推荐

    Solr 4.0 源代码实例

    附件包含100个以上示例,包括solr.xml、solrconfig.xml等在Jetty、Tomcat等应用服务器下的详细配置。

    Solr 4.0 cook book

    基于最新的Solr 4.0搜索引擎教程,包含大量示例讲解,是学习Solr4不可多得的教程。

    (solr系列:五) solr定时实时重建索引和增量更新-附件资源

    (solr系列:五) solr定时实时重建索引和增量更新-附件资源

    SolrSearch:将支持Solr的搜索界面添加到Omeka

    SolrSearch用由提供支持的...要使用该插件,您需要访问Solr 4.0+的安装,该安装运行solr-core/omeka下的插件源代码中包含solr-core/omeka 。 有关如何使用Solr进行启动和运行的一般信息,请查看官方。 安装 Solr核心 要

    node-solr:Node.js 的 Solr 模块

    Node.js 的 Solr 模块参考Node.js: : Solr: : 使用npm test运行测试。 如果您没有在 127.0.0.1:8983 上运行 Solr,请编辑“test/common.js”。使用示例请参阅使用测试。 这是一个快速示例: var solr = require ( ...

    puppet-ispconfig_solr:在 IspConfig 环境中使用的 solr 包装器

    puppet-ispconfig_solr == 定义:ispconfig_solr::instance 这个定义是 solr::instance 的包装器。 它创建一个 solr 实例并配置它以在 IspConfig 环境中使用 == 参数: [ instance_name ] solr 实例的名称。 实例...

    apache-solr-4.0.0-ALPHA-src.gz官方包

    apache官方的solr4.0的源代码包,可以通过分析源代码提高理解,或者通过编译源码进行二次开发

    java8看不到源码-ansible-role-solr:yauh.solr-用于设置Solr的Ansible角色

    看不到源码Solr 引导程序 设置 Solr 搜索平台的 Ansible 角色 要求 系统上需要有Java,推荐角色yauh.java8。 角色变量 以下变量可与 solr 角色一起使用: solr_source: http://apache.openmirror.de/lucene/solr # ...

    Solr4.3.1:配置好的Solr,分词器使用IK

    Solr4.3.1配置好的Solr,分词器使用IK。使用步骤:拷贝solr目录到web服务器,如:tomcat的webapp目录下。拷贝solr_home到任意目录,如:/home目录下。修改solr目录中的web.xml,配置solr home的路径为:/home/solr_...

    Laravel-4-Solr:Apache Solr简单查询客户端

    Laravel 4 Apache Solr Laravel 4软件包提供了一个接口,用于通过其静态接口使用(查询) 。安装首先通过Composer安装此软件包。 编辑项目的composer.json文件,以要求davispeixoto/laravel-4-solr 。 "require": {...

    solr -8.11.1.zip 文件

    solr -8.11.1.zip 文件

    Solr参考书籍

    包括两本官方推荐的书籍,solr in action 2014和apache_solr4_cookbook。基于solr 4.0以上的,正好做个对solr入门。英文经典版本。

    lucene-solr:Apache Lucene和Solr开源搜索软件

    Apache Lucene和Solr Apache Lucene是用Java编写的高性能,功能齐全的文本搜索引擎库。 Apache Solr是使用Java编写并使用Apache Lucene的企业搜索平台。 主要功能包括全文搜索,索引复制和分片以及结果分面和突出...

    solr入门学习

    运行容器:Tomcat6.0.20 Solr版本:apache-solr-1.4.0 分词器:mmseg4j-1.6.2 词库:sogou-dic

    datagov-deploy-solr

    datagov-deploy-solr 该项目是一部分。 部署solr的角色。 用法 将此角色包括在您的requirements.yml 。 - src : https://github.com/gsa/datagov-deploy-solr.git 该角色取决于是否已安装Java。 我们建议在solr...

    开源bbs源码java-solr:索尔

    安装好ik分词器与拼音分词器的solr 版本: jdk1.8 solr6.0.1 tomcat8 使用说明 clone 代码 https://github.com/tomoya92/solr.git 打开 apache-tomcat-8.0.35/webapps/solr/WEB-INF/web.xml 修改 {solr_home} 为...

    SOLR搭建企业搜索平台

    主要介绍了如和用solr搭建搜索平台的详细步骤,同时对配置文件进行了详细介绍。 运行容器:Tomcat6.0.20 Solr版本:apache-solr-1.4.0 分词器:mmseg4j-1.6.2 词库:sogou-dic

    springboot-solr-demo:Solr单机版配置,以及springboot和solr集成

    springboot-solr-demoSolr单机版配置,以及springboot和solr集成solr-4.10.3solr4.10.31: 安装说明,以及中文词库配置说明等solr:webapp,将该目录放到tomcat webapps 下可以直接运行无需过多配置。solr-6.6.6solr...

    docker-compose 构建以solr8.11.1为基础的含中文分词器的镜像

    以solr8.11.1为基础镜像,使用docker-compose构建含中文分词器的新的镜像 文件夹内含有docker-compose.yml脚本、Dockerfile脚本以及构建镜像所需中文分词器ik-analyzer-8.5.0.jar、所有扩展词和停用词相关的配置文件...

Global site tag (gtag.js) - Google Analytics