---
title: "solr 的 Distributed Searching 试用"
author: "chenlb"
date: "2008-08-07T18:31:00Z"
tags: []
slug: "solr-distributed-searching"
draft: false
lastmod: "2008-08-07T18:31:00Z"
id: 227181
url: "https://chenlb.iteye.com/blog/227181"
---

一直想了解分布搜索与索引。Lucene有MultiSearcher，solr1.2的只能有单个索引，现在1.3可以有Distributed Searching这玩意。可以从多个索引里搜索出并合并结果返回给你。这些索引不是replication的，是分割的。可以先%num方式索引在num台机器上，然后用solr的shards参数。

如：

shards=localhost:8080/use-solr1.3,localhost:9080/use-solr1.3&q=chenlb

测试后可以返回结果，但合并的时候发了点时间，我的机子上40-60ms，单个搜索基本是0ms

测试数据是14W结果，分开索引到两个tomcat里。看了后台，一个搜索有两次请求，其中合并的那机子是三次请求。时间可能花在请求里，还有就是合并可能缓存不到。

官方建议：如果单个solr足够快的话没有必要搞Distributed Searching，如果再高点要求可以index repliction。

当索引很大的时候可能Distributed Searching用的上场， 个人之见。

参考：[http://wiki.apache.org/solr/DistributedSearch](http://wiki.apache.org/solr/DistributedSearch)