Copied to clipboard

Flag this post as spam?

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

  • tofu 9 posts 89 karma points
    Oct 11, 2018 @ 08:33

    documentation of Umbraco.Search?

    Hi, thank you for continued support by you guys. This time, I'm creating some sort of blog post (classic...) and with some tags embedded below for each post.

    From the blog post page, there will be a link to "search" page, in which all the posts with the same tag will be displayed in the form of list.

    [Blog Post Side]
        var tags = Model.GetPropertyValue<string[]>("tagName");
        @foreach (var tag in tags)
                <a href=@(String.Format("{0}{1}", "/Search?query=",tag))>  @tag</a>

    and then the link generated above will lead to the following search result screen.

    [Search Result Screen]
        var searchQuery = Request.QueryString["query"];
        if (!string.IsNullOrEmpty(searchQuery))    
            <div class="searchresults">
                <p>Posts matching @searchQuery are as follows: <strong></strong></p>
                    @foreach (var result in Umbraco.Search(searchQuery))
                            <a href="@result.Url">@result.Name</a>

    The problem here is that this code seems to count in matches with non-intended fields, such as the creator of the post, which is not ideal. Could you tell us how to apply some sort of properties, or where the general documentation is? I looked around for a while and really didn't find any official document, so I don't know how to do this.


  • Søren Gregersen 280 posts 1136 karma points MVP c-trib
    Oct 11, 2018 @ 09:14
  • Ismail Mayat 4253 posts 9078 karma points MVP 2x admin c-trib
    Oct 11, 2018 @ 10:01
    Ismail Mayat

    Umbraco.Search out of the box will search over all fields. I believe you can pass in your own examine query as there is overload. So you would have to create your own examine query


    You can then pass that query into Umbraco.Search



  • tofu 9 posts 89 karma points
    Oct 12, 2018 @ 07:01

    Thanks everyone for letting me know, I configured it according the documentation you informed me of, and successfully put the searching function! (I forgot to delete the indexing after changing it and was wondering why it won't chage...)

    In the course of it, I encountered these two other searching methods, what are they in relation to the Examine class you guys introduced to me? (such as, "this is obsolete/deprecated, or performance-wise not recommended, in terms of security it's better so on and so on)

    I understand Examine is much faster than the other two thanks to Mr.Dennis but is there anything more to it?

    string searchQuery="something";

    Thanks in advance

Please Sign in or register to post replies

Write your reply to: