Copied to clipboard

Flag this post as spam?

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


  • skiltz 501 posts 700 karma points
    20 days ago
    skiltz
    0

    Examime + Umbraco 7 Only Search single Node Type

    Umbraco 7.

    Current query looks like this.

    var searchQuery = searchCriteria.Field("nodeName", query).Or().Field("bodyText", query).And().OrderByDescending("createDate");

    which works fine but searches all node types. I want it to only search supportDoc doc type.

    If I use this. still doesn't seem to work.

    var searchQuery = searchCriteria.Field("nodeName", query).Or().Field("bodyText", query).And().Field("nodeTypeAlias", "supportDoc").And().OrderByDescending("createDate");

  • Yakov Lebski 353 posts 1369 karma points
    20 days ago
    Yakov Lebski
    0

    you can use

    searchCriteria.NodeTypeAlias("supportDoc")
    

    you query will be

    var searchQuery = searchCriteria.Field("nodeName", query).Or().Field("bodyText", query).And().NodeTypeAlias("supportDoc").And().OrderByDescending("createDate");
    
Please Sign in or register to post replies

Write your reply to:

Draft