使用Lucene提高基于位置的搜索的性能 [英] Improving performance of Location based search using Lucene

查看:80
本文介绍了使用Lucene提高基于位置的搜索的性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Lucene用于使用.net的求职门户. 在以下用例中面临一些与性能相关的问题. 用例是: 在进行求职时,用户可以选择工作位置(例如,乔治亚州亚特兰大)并选择径向距离(例如50英里).从Lucene返回求职结果所需的时间相当长.

I'm using Lucene for a job search portal using .net. Am facing some performance related issues in the following use case. Use case is: When doing job search, user can select job location(for exameple:Atlanta,GA) and select radial distance (say 50 miles).The time required to return job search results from Lucene is pretty high.

仅供参考,我们正在维护一个sql server 2005数据库,用于存储美国和加拿大的城市,州,经度和纬度.(总共约有100万条记录).

FYI,we are maintaining a sql server 2005 database where we store US and Canada based city,state,longitude and latitude.(contains a total of about 1 million records).

无论如何,我是否可以改善这种基于位置的求职的表现?

Is there anyway I can improve the performace of this location based job search?

推荐答案

基本上,您有两种类型的搜索参数:文本搜索和空间搜索. 您可能可以使用一种类型来过滤从另一种类型获得的结果. 例如,某人正在寻找佐治亚州亚特兰大附近的.NET开发人员工作. 您可以先检索所有.NET开发人员作业,然后过滤位置, 或检索亚特兰大附近的所有工作,并过滤.NET开发人员的工作. 我相信第一个应该更快. 您也可以将工作地点直接存储在Lucene中,并将其合并到搜索中. 粗略的草稿是: 索引: 1.收到新的需要的"广告时,请使用数据库查找其地理位置. 2.将位置存储为广告文档中的Lucene字段. 恢复: 1.根据文本匹配检索所有作业. 2.使用几何计算来查找用户的位置与工作位置之间的距离. 3.根据距离过滤作业.

Basically, you have two types of search parameters: textual and spatial. You can probably use one type to filter the results you got from the other. For example, for someone looking for a .NET developer job near Atlanta, GA you could either first retrieve all the .NET developer jobs and filter for location, or retrieve all jobs around Atlanta and filter for .NET developer ones. I believe the first should be faster. You can also store the job locations directly in Lucene, and incorporate them in the search. A rough draft is: Indexing: 1. When you receive a new 'wanted' ad, find its geo-location using the database. 2. Store the location as a Lucene field in the ad's document. Retrieval: 1. Retrieve all jobs according to textual matches. 2. Use geometrical calculations for finding distances between the user's place and the job location. 3. Filter jobs according to distance.

Lucene在行动中有一个本质上类似于空间搜索的示例. 正在制作第二版.另外,请查看 Sujit Pal关于使用Lucene进行空间搜索的建议 Patrick O'Leary的框架.还有 Locallucene

Lucene in Action has an example of spatial search similar in spirit. A second edition is in the making. Also, check out Sujit Pal's suggestions for spatial search with Lucene and Patrick O'Leary's framework. There are also Locallucene and LocalSolr, but I do not know how mature they are.

这篇关于使用Lucene提高基于位置的搜索的性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆