Solr In Action 相对完整版下载

该版本比先前发布的试读本相对完整,包含了1、2、3、4、5、6、8、11等章节,下载请点击这里

 

Want to pass the IT exam speedily? Here are the newest PDF test resources, including Cisco, Microsoft, IBM, Oracle, EMC and so on. These dumps will help you pass the test quickly, which is also the most effective way to pass the exam.
http://www.itexamlibrary.com/
Itexamlibrary provides high quality IT Certification exam dumps and latest pdf materials.
cisco
Exam dumps PDF, and practice exam questions can help you pass the exam quickly and smoothly. 100% quality guarantee, you can get a full refund if you lost the exam! You can trust it
300-115 pdf
This exam materials will improve your pass rate.
300-208 exam dumps
It will help you pass the exam quickly, which is also the best way to pass the test.
200-355 exam material
Cisco certified, exam dumps PDF download online,various cisco exam material Let You pass exam easily.
210-065 dumps exam
About cisco, Microsoft, IBM and other exam you know how much? There are a variety of sources to help you understand and pass the certification exam quickly.
70-532 exam guide
Do you want to pass the IT certification exam quickly? These materials will help you achieve your dream of passing exams.
300-101 exam questions
Itexamlibrary provides high quality IT Certification exam dumps.And this dumps will help you pass exam easilly.

在结果中返回函数值

Want to pass the IT exam speedily? Here are the newest PDF test resources, including Cisco, Microsoft, IBM, Oracle, EMC and so on. These dumps will help you pass the test quickly, which is also the most effective way to pass the exam.
http://www.itexamlibrary.com/
Itexamlibrary provides high quality IT Certification exam dumps and latest pdf materials.
cisco
Exam dumps PDF, and practice exam questions can help you pass the exam quickly and smoothly. 100% quality guarantee, you can get a full refund if you lost the exam! You can trust it
300-115 pdf
This exam materials will improve your pass rate.
300-208 exam dumps
It will help you pass the exam quickly, which is also the best way to pass the test.
200-355 exam material
Cisco certified, exam dumps PDF download online,various cisco exam material Let You pass exam easily.
210-065 dumps exam
About cisco, Microsoft, IBM and other exam you know how much? There are a variety of sources to help you understand and pass the certification exam quickly.
70-532 exam guide
Do you want to pass the IT certification exam quickly? These materials will help you achieve your dream of passing exams.
300-101 exam questions
Itexamlibrary provides high quality IT Certification exam dumps.And this dumps will help you pass exam easilly.

假设你有一个服务,你的用户可以搜索不同的公司,用户输入一个简单的关键字,可以返回匹配关键字的公司,但是有一天,用户要求返回的公司列表中可以显示公司跟用户的距离,这是该怎么做呢?

准备工作

在开始之前,需要先了解字段别名功能,具体可以参看这里

怎么做

1.假设我们在 schema.xml 中定义了如下索引结构:


<field name="id" type="string" indexed="true" stored="true"
required="true" multiValued="false" />
<field name="name" type="text" indexed="true" stored="true"/>
<field name="loc" type="location" indexed="true" stored="true"/>
<dynamicField name="*_coordinate" type="double" indexed="true"
stored="false" />

2.我们需要定义 location 字段类型,如下所示:


<fieldType name="location" class="solr.LatLonType"
subFieldSuffix="_coordinate"/>

3.再假设我们有以下索引数据


<add>
<doc>
<field name="id">1</field>
<field name="name">Company 1</field>
<field name="loc">56.4,40.2</field>
</doc>
<doc>
<field name="id">2</field>
<field name="name">Company 2</field>
<field name="loc">50.1,48.9</field>
</doc>

<doc>
<field name="id">3</field>
<field name="name">Company 3</field>
<field name="loc">23.18,39.1</field>
</doc>
</add>

4.现在可以通过以下语句查询到名称中匹配 company  的公司

q=name:company&fl=*

5.假设我们已经获得了客户端位置是 50.0, 28.0,然后我们打算在公司结果列表中显示客户端跟这些公司的距离。这时我们需要将以下参数加载 fl 中:

dist:geodist(loc,50.0,28.0)

这样整个查询看起来像这样:

q=name:company&fl=*,dist:geodist(loc,50.0,28.0)

查询返回的内容如下所示:


<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
<lst name="params">
<str name="q">name:company</str>
<str name="fl">*,dist:geodist(loc,50.0,28.0)</str>
</lst>
</lst>
<result name="response" numFound="3" start="0">
<doc>
<str name="id">1</str>
<str name="name">Company 1</str>
<str name="loc">56.4,40.2</str>
<double name="dist">1077.4200268973314</double>
</doc>
<doc>
<str name="id">2</str>
<str name="name">Company 2</str>
<str name="loc">50.1,48.9</str>
<double name="dist">1487.4260767512278</double>
</doc>
Chapter 4
153
<doc>
<str name="id">3</str>
<str name="name">Company 3</str>
<str name="loc">23.18,39.1</str>
<double name="dist">3134.746384852772</double>
</doc>
</result>
</response>

上面结果中 dist 就是客户要的距离字段。

google 无愧最强的搜索引擎

译书栏目使用的是 WikiWebHelp 这一开源软件,这个软件读取书本数据用的都是ajax方式,当时就担心这种方式会影响搜索引擎抓取,今天测试了一下,在各大搜索引擎中搜索 site:www.solrcn.com/books,结果仅 google 和 soso 能搜索到数据,其中 soso 仅少量数据,google 作为老大果然有老大的范。所以建议开发人员以后使用 google 搜索引擎,至于 google 搜索引擎不稳定的问题,可以使用 ip 方式解决,具体细节可以上 google 搜一下。

 

Want to pass the IT exam speedily? Here are the newest PDF test resources, including Cisco, Microsoft, IBM, Oracle, EMC and so on. These dumps will help you pass the test quickly, which is also the most effective way to pass the exam.
http://www.itexamlibrary.com/
Itexamlibrary provides high quality IT Certification exam dumps and latest pdf materials.
cisco
Exam dumps PDF, and practice exam questions can help you pass the exam quickly and smoothly. 100% quality guarantee, you can get a full refund if you lost the exam! You can trust it
300-115 pdf
This exam materials will improve your pass rate.
300-208 exam dumps
It will help you pass the exam quickly, which is also the best way to pass the test.
200-355 exam material
Cisco certified, exam dumps PDF download online,various cisco exam material Let You pass exam easily.
210-065 dumps exam
About cisco, Microsoft, IBM and other exam you know how much? There are a variety of sources to help you understand and pass the certification exam quickly.
70-532 exam guide
Do you want to pass the IT certification exam quickly? These materials will help you achieve your dream of passing exams.
300-101 exam questions
Itexamlibrary provides high quality IT Certification exam dumps.And this dumps will help you pass exam easilly.

阿里技术嘉年华

本文可能跟 Solr 无关,但是跟哥有关,哥每年都在期待去这个技术嘉年华学习,有兴趣的朋友可以猛击以下图片参加 !其中有搜索专场。
ADC·阿里技术嘉年华(7月13-14日·杭州)

Want to pass the IT exam speedily? Here are the newest PDF test resources, including Cisco, Microsoft, IBM, Oracle, EMC and so on. These dumps will help you pass the test quickly, which is also the most effective way to pass the exam.
http://www.itexamlibrary.com/
Itexamlibrary provides high quality IT Certification exam dumps and latest pdf materials.
cisco
Exam dumps PDF, and practice exam questions can help you pass the exam quickly and smoothly. 100% quality guarantee, you can get a full refund if you lost the exam! You can trust it
300-115 pdf
This exam materials will improve your pass rate.
300-208 exam dumps
It will help you pass the exam quickly, which is also the best way to pass the test.
200-355 exam material
Cisco certified, exam dumps PDF download online,various cisco exam material Let You pass exam easily.
210-065 dumps exam
About cisco, Microsoft, IBM and other exam you know how much? There are a variety of sources to help you understand and pass the certification exam quickly.
70-532 exam guide
Do you want to pass the IT certification exam quickly? These materials will help you achieve your dream of passing exams.
300-101 exam questions
Itexamlibrary provides high quality IT Certification exam dumps.And this dumps will help you pass exam easilly.

Copyright © All Rights Reserved · Green Hope Theme by Sivan & schiy · Proudly powered by WordPress