Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm implementing a full text search on list contents.

Is it more efficient to fire a SPSiteDataQuery on every request with a dynamically built CAML-Query, to filter the items?

Or is it better to fetch the data once, store it in e.g. HttpRuntime.Cache and filter the data somehow in code (maybe via DataTable.Select or something...didn't try this).

What do you think?

share|improve this question
    
How much data are we talking? –  Mike Oryszak Jan 10 '12 at 20:05
    
about 200 - 300 items stored in 2 lists –  HutzelGutzel Jan 10 '12 at 22:43
    
hmm, 200-300 items in 2 lists. Do they have (multi-)lookup fields? –  Bas Lijten Jan 11 '12 at 8:40
    
No. The items are in the standard pages list (PublishingPages) and a custom document library (Documents with some additional metadata). Data of the items from both lists will be displayed in one result list. –  HutzelGutzel Jan 11 '12 at 8:48
add comment

2 Answers 2

I would go with the first option, as the SPSiteDataQuery already makes use of caching, if you use it correctly. It's fast as hell ;)

check my blogpost about it: http://bloggingabout.net/blogs/bas/archive/2009/03/27/using-the-crosslistqueryinfo-and-crosslistquerycache.aspx

Steve peschka wrote a document on it in the past: http://go.microsoft.com/fwlink/?LinkId=95450&clcid=0x409

MSDN: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsitedataquery.aspx

share|improve this answer
    
In your blog you're talking about CrossListQueryCache. When the query changes (which does, because the CAML is created dynamically to filter the items), does it clear the cache and fetch new results? The document from Steve Peschka doesn't help because it is about SPQuery and PortalSiteMapProvider. –  HutzelGutzel Jan 11 '12 at 8:13
    
no, the items are cached, not the query with its items. –  Bas Lijten Jan 22 '12 at 19:07
    
so then CrossListQueryCache isn't capable for a full text search. If the query changes there MUST be only the new requested items. –  HutzelGutzel Jan 25 '12 at 16:14
    
Is using search an option, then?! –  Bas Lijten Jan 25 '12 at 17:12
    
No, unfortunately that's not an option. So I'll stick with an SPSiteDataQuery on every request. –  HutzelGutzel Jan 25 '12 at 19:33
show 1 more comment

If you want SPSiteDataQuery functionality along with caching, better to use CrossListQueryCache and CrossListQueryInfo classes.

Check here for excellent details : http://extreme-sharepoint.com/2012/07/17/data-access-via-caml-queries/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.