Friday, January 27, 2012

How Foundation Search Shows Results

To understand better how search works see the image below. Lets assume we have three site collections with different number of webs in each site collection.

Now if we do search for "Mydoc" file at different site levels we will get different results. 

If search is performed at Top Level Site Collection (S1): Search will be performed at each site collection level and each web.We will get results from all site collections and all webs.

If search is performed at W1: We will get results from W1 and W1a

If search is performed at W2: We will get result only from W2

If search is performed at Site collection 2(S2): We will get results from W3 and W4.

If search is performed at W3: We will get results from W3.

Similarly if we perform search at Site Collection 3(S3): We will get results from only W5. 

If you have noticed in above only Top level site collection returns results from all sites and webs. Where as from all other locations results are returned only from that location and down the tree.

Now the question arises why Top level site collection behaves different from all other levels?
If you see URL for search results at top level site collection it will look something like:
http://anmol/_layouts/searchresults.aspx?k=MyDoc&u=http%3A%2F%2Fanmol

There are two parameters k=MyDoc and u=http%3A%2F%2Fanmol, this means we are doing a search for MyDoc and return all documents that start with http://anmol

As every site collection and every web starts with this URL so we will get results from all locations when search is performed at top level.

1 comment:

  1. I liked this post. Keep doing good work. Thanks :)

    ReplyDelete

Popular Posts