开发者

How is site specific search done?

开发者 https://www.devze.com 2022-12-31 13:21 出处:网络
Can someone please tell how site specific searches are done. For examp开发者_开发百科le, search in the stackoverflow.com

Can someone please tell how site specific searches are done. For examp开发者_开发百科le, search in the stackoverflow.com

Thanks


The search here on Stackoverflow is, as I can recall, done using Lucene.

You build an index with details you want to search through and link these to the posts / other things you want the search to find.

More details here: http://en.wikipedia.org/wiki/Lucene

They have used the SQL server search algorithm but were not really satisfied with it, if I remember correctly.

Here is the blog post by Jeff: https://blog.stackoverflow.com/2008/11/sql-2008-full-text-search-problems/


Depending on what you want you can build your own implementation to search trough a database or use Google Custom Search on Google CSE


Google, Bing, and Yahoo it is done as:

c++ site:stackoverflow.com


Search Google for "site:stackoverflow.com [SEARCH STRING]". This will only return pages that are hosted through *.stackoverflow.com.

Or, like Rob said, if you're looking to setup your own custom in-site search bar, you can use Google CSE.

If you're interested in the nuts-and bolts of "how site-specific searches are done" (your words), then you can take heart in that it is very easy; the URLs' host names ("http://www.example.com/path/to/page" => "www.example.com") are matched against the domain being searched.

Something that will really mess this up, though is the existence of DNS aliases and duplicate entries.

0

精彩评论

暂无评论...
验证码 换一张
取 消