I've implemented simple search by query in my sitecore application. Locally it works perfectly with solr, but when solution is deployed to an Azure environment that is using Azure Search it doesn't work with query more than 5 letters. What can be reason for that?

code of my search expression:

    protected override Expression<Func<ArticleSearchItem, bool>> GetPredicateExpression(ArticleSearchParameters searchParameters)
        var articleSearchQuery = PredicateBuilder.True<ArticleSearchItem>();

        if (!string.IsNullOrEmpty(searchParameters.Query))
            articleSearchQuery = articleSearchQuery.Or(i => i.Title.Contains(searchParameters.Query.ToLower()));
            articleSearchQuery = articleSearchQuery.Or(i => i.Text.Contains(searchParameters.Query.ToLower()));
            articleSearchQuery = articleSearchQuery.Or(i => i.PreviewTitle.Contains(searchParameters.Query.ToLower()));
            articleSearchQuery = articleSearchQuery.Or(i => i.PreviewText.Contains(searchParameters.Query.ToLower()));

        articleSearchQuery = articleSearchQuery.And(i => i.TemplateId == searchParameters.TemplateId && i.Paths.Contains(searchParameters.SiteRootId));

        return articleSearchQuery;
  • 4
    Can you add more info.. logs containing the query on Solr and Azure to start with?
    – Gatogordo
    Commented Oct 25, 2018 at 8:11
  • @Gatogordo unfortunately, I am not able to get Azure search log.
    – Val Yar
    Commented Oct 25, 2018 at 9:17
  • Could you connect to Azure Search from the local instance? Using fiddler you can see all the Azure Requests outbound and see what HTTP Status is coming back for your query. If its using a GET request to search and the PredicateBuilder is constructing a query that is too long. This could be your issue.
    – TomT
    Commented Nov 12, 2018 at 0:11


Your Answer

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

Browse other questions tagged or ask your own question.