Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ravinder Sandhu 1 post 71 karma points
    Jul 24, 2024 @ 21:15
    Ravinder Sandhu
    0

    IQuery custom field search

    I'm using Umbraco 13.4.0 and I have a content type called 'landingPage' that has different fields like 'Description', 'City', etc. I'm using the code below to query for names, but how can I query for custom fields, like city, etc?

    IQuery<IContent> query = null;
    
    if (!string.IsNullOrEmpty(name))
    {
        query = new Query<IContent>(sqlContext).Where(u => u.Name.Contains(name, StringComparison.CurrentCultureIgnoreCase));
    }
    
     var result = contentService.GetPagedOfTypes(["landingPage"], 1, 50, out long totalRecords, query, ordering);
     return new(result, totalRecords);
    
Please Sign in or register to post replies

Write your reply to:

Draft