0

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?

4
  • How much data are we talking? Commented Jan 10, 2012 at 20:05
  • about 200 - 300 items stored in 2 lists
    – Tom Bola
    Commented Jan 10, 2012 at 22:43
  • hmm, 200-300 items in 2 lists. Do they have (multi-)lookup fields?
    – Bas Lijten
    Commented Jan 11, 2012 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.
    – Tom Bola
    Commented Jan 11, 2012 at 8:48

2 Answers 2

1

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

6
  • 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.
    – Tom Bola
    Commented Jan 11, 2012 at 8:13
  • no, the items are cached, not the query with its items.
    – Bas Lijten
    Commented Jan 22, 2012 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.
    – Tom Bola
    Commented Jan 25, 2012 at 16:14
  • Is using search an option, then?!
    – Bas Lijten
    Commented Jan 25, 2012 at 17:12
  • No, unfortunately that's not an option. So I'll stick with an SPSiteDataQuery on every request.
    – Tom Bola
    Commented Jan 25, 2012 at 19:33
1

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/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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