FindItems returns no results when searching with meta fields

  • Updated

The article describes an issue with CatalogContext.Current.FindItems when searching with multiple meta field conditions in the SqlMetaWhereClause. In addition, if there are CatalogSearchOptions.Classes being used this will also cause issue with results.

Here is a sample code that illustrates this issue with both items.

CatalogSearchParameters pars = new CatalogSearchParameters(); 
CatalogSearchOptions options = new CatalogSearchOptions 
CacheResults = false, 
RecordsToRetrieve = 10 


pars.Language = "fr";
pars.SqlMetaWhereClause = "(META.MetaFieldName = 'Status' AND META.Number <> 300)";
pars.SqlWhereClause = "(MetaClassId=29 OR MetaClassId=30) AND IsActive = 'true'";

Entries tmpEntries = CatalogContext.Current.FindItems(pars, options, new CatalogEntryResponseGroup());

There are two issues in play here.
Unable to search for entries by multiple conditions in SqlMetaWhereClause
CatalogSearchOptions.Classes does not work

Product Development Engineeering is aware of these issues and states the following workarounds.

  • The workaround is to do multiple queries and intersect the results
  • The second component to the workaround is to match on the meta class ID instead of meta class name.