TLDR;
I think you need to change your .Where()
syntax to q.Where(w => w.WhereLike(‘field1’, ‘value’).Or().WhereLike(‘field2’, ‘value’));
I just tried an example query using Xperience v29.5.0 and the Dancing Goat sample project.
var builder = new ContentItemQueryBuilder()
.ForContentTypes(q => q
.OfContentType(ArticlePage.CONTENT_TYPE_NAME)
.WithContentTypeFields())
.Parameters(q => q
.Where(w => w.WhereGreater(nameof(ArticlePage.ArticlePagePublishDate), "2023/08/12")
.And()
.Where(w => w
.WhereStartsWith(nameof(ArticlePage.ArticleTitle), "o")
.Or()
.WhereStartsWith(nameof(ArticlePage.ArticleTitle), "coffee"))))
.InLanguage("en");
var options = new ContentQueryExecutionOptions
{
ForPreview = false,
IncludeSecuredItems = true
};
var pages = await executor.GetMappedWebPageResult<ArticlePage>(
builder,
options);
foreach (var p in pages)
{
Console.WriteLine(p.ArticleTitle);
}
This prints the following titles:
Coffee Beverages Explained
Coffee processing techniques
Origins of Arabica Bourbon
Using the following SQL (with some SELECT
columns removed for brevity)
SELECT [ArticleTitle], [CMS_T]
FROM (
SELECT [ArticleTitle], [ArticlePagePublishDate], ('DancingGoat.ArticlePage') AS [CMS_T]
FROM CMS_ContentItem
INNER JOIN CMS_ContentItemCommonData
ON [CMS_ContentItem].[ContentItemID] = [CMS_ContentItemCommonData].[ContentItemCommonDataContentItemID]
INNER JOIN DancingGoat_ArticlePage
ON [CMS_ContentItemCommonData].[ContentItemCommonDataID] = [DancingGoat_ArticlePage].[ContentItemDataCommonDataID]
WHERE [ContentItemCommonDataContentLanguageID] = 1 AND [ContentItemCommonDataVersionStatus] = 2
) AS SubData
WHERE [ArticlePagePublishDate] > '2023/08/12' AND ([ArticleTitle] LIKE 'o%' OR [ArticleTitle] LIKE 'coffee%')
This all looks correct to me!