Let's assume that enterprise and fast search are not an option. Are CAML queries (with CONTAINS operator) a proper way to do a full text search in fields of a publishing page? Or is that for any reason not recommendable?

The approach would be something like:
String query = "<Where><Contains><FieldRef Name="Title" /><Value Type=""Text"">searchText</Value></Contains></Where>";
PublishingPageCollection pages = publishingWeb.GetPublishingPages(query);

  • What other way is there? ;) Seems perfectly acceptable to me.
    – James Love
    Nov 29, 2011 at 9:17
  • Another way could be, to fetch all publishing pages and filter the pages in code (add only matching pages to result list). But that only if something speaks against CAML
    – Tom Bola
    Nov 29, 2011 at 9:59
  • 2
    CAML is fed directly to the COM objects which call stored procedures in the DB, trying to filter the pages in code is nowhere near as efficient is that.
    – James Love
    Nov 29, 2011 at 10:18
  • OK convinced! That possiblity was only a fallback if something had spoke against CAML. Thanks.
    – Tom Bola
    Nov 29, 2011 at 12:54

1 Answer 1


When executing CAML queries, the number of results returned will be determined by the throttle settings. The default throttle limit is 5000.

One more interesting point against CAML if you use indexed fields : SharePoint 2010 CAML Query fails when indexed columns used ( I am not sure if this problem is real)

Having said that, If you need results as PublishingPage objects ( I see you use publishingWeb.GetPublishingPages(query)), CAML is the only good way to do that.

  • Like I said in the comment there, I've never had an issue using CAML against indexed fields, and I'm certain I've seen the SP object model query against indexed fields, also...
    – James Love
    Nov 29, 2011 at 14:47

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.