Question

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);

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top