Copied to clipboard

Flag this post as spam?

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

  • Gayathri 55 posts 175 karma points
    Nov 20, 2020 @ 01:29

    Search content based on Parent node id or the current id of the page

    Hi All,

    I would like to implement a search functionality not the entire site search but the search contents based on the node id .

    for example the below is search code

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage

        var searchQuery = Request.QueryString["query"];
        if (!string.IsNullOrEmpty(searchQuery))    
            <div class="searchresults">
                <p class="intro-para">Your search results for <strong>"@searchQuery"</strong></p>
                    @foreach (var result in Umbraco.Search(searchQuery))
                        if([email protected]){
                                <a class="heading1 inline-link" href="@result.Url">@result.Name</a>
                                <div  class="heading2">Created Date : @result.CreateDate.ToLongDateString()</div>
                                <div  class="heading2">Updated Date : @result.updateDate.ToLongDateString()</div>

    from the above Umbraco.Search(searchQuery) this will search the entire website inside content.

    is there any way i can search like this belwo

    Umbraco.Search(searchQuery , "Nodeid")

    for example

     Umbraco.Search("home loans", "1011")

    like this ?

  • Steve Morgan 1280 posts 4218 karma points c-trib
    Nov 20, 2020 @ 07:39
    Steve Morgan


    I think you want to look at Examine.

    There are umpteen tutorials out there but it will quickly let you do what you want:

    It's not as simple as Umbraco.Search but, as usual, Paul Seal has done a nice intro for you here:

  • Gayathri 55 posts 175 karma points
    Nov 26, 2020 @ 02:08

    Hi Steve,

    I would like to get it achieve by using Umbraco.Search("home loans", "1011")

    Like this :(

    Or similar like this with the same

Please Sign in or register to post replies

Write your reply to: