Copied to clipboard

Flag this post as spam?

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


  • k 256 posts 654 karma points
    Feb 27, 2017 @ 10:28
    k
    0

    Simplistic search

    Hello,

    I want to call a property alias in simplistic search Ex : I have changed @node.Name to @node.upload , but I am getting an error.

    Can someone please help.

    thanks,

    kusum

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Feb 27, 2017 @ 11:13
    Alex Skrypnyk
    0

    Hi Kusum

    Can you share all the code please?

    Where did you use @node.upload ?

    Thanks,

    Alex

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Feb 28, 2017 @ 13:42
    Alex Skrypnyk
    0

    Hi Kusum

    It will be nice to know, did you find a solution?

    Thanks,

    Alex

  • k 256 posts 654 karma points
    Mar 01, 2017 @ 05:35
    k
    0

    Hello Alex,

    Thanks for replying.

    I want to modify the code :

    <h4><a href="@node.Url">@node.Name</a></h4>
    

    to

    <h4><a href="@node.Url">@node.upload</a></h4>
    

    (but this is not working)

    Thanks,

    kusum

  • Dennis Adolfi 1082 posts 6449 karma points MVP 6x c-trib
    Mar 01, 2017 @ 07:23
    Dennis Adolfi
    100

    Hi k.

    The list that loops out your search result is of type SearchResultItem, which is not dynamic, its a ViewModel with set properties. That's why you can't write @node.upload (node in this context is not dynamic).

    However, the SearchResultItem object has a property @node.Id which is the id of the Umbraco content node, and using the UmbracoHelper, you can get any property you like to display.

    So, in the SimplisticSearchResultView.cshtml file, first create an instance of the UmbracoHelper. (Outside of the foreach)

    @{
            var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
        }
    

    Then, in you foreach (same view), you do this:

     @foreach (var node in searchResults)
            {
                var content = umbracoHelper.TypedContent(node.Id);
    
                <li>
                    <h4><a href="@node.Url">@(content.GetPropertyValue<string>("upload"))</a></h4>
                    <p>@(node.Description ?? "")</p>
                </li>
            }
    

    Best of luck to you.

  • k 256 posts 654 karma points
    Mar 02, 2017 @ 07:11
    k
    0

    Hello Dennis,

    Thank you so much. It works fine :).

  • Dennis Adolfi 1082 posts 6449 karma points MVP 6x c-trib
    Mar 02, 2017 @ 07:13
    Dennis Adolfi
    0

    Awesome k! That makes me very happy!

    Have a great day!!

  • k 256 posts 654 karma points
    Mar 02, 2017 @ 07:32
    k
    0

    Hello Dennis,

    I wanted to know if it is possible to find range of values using simplistic search ?

    that is search between 100 and 1000
    

    Thanking you for your help.

    kusum

  • Dennis Adolfi 1082 posts 6449 karma points MVP 6x c-trib
    Mar 02, 2017 @ 07:41
    Dennis Adolfi
    0

    Hi again.

    Im sorry but I dont think I quite understand the question..

    Do you mean like a pager?

  • k 256 posts 654 karma points
    Mar 02, 2017 @ 08:54
    k
    0

    Hello,

    I mean I wanted to use simplistic search to search nodes using the below exemple :

    <select>
                              <option>CC</option>
                              <option>Less than 125cc</option>
                              <option>More than 125cc</option>
                            </select>
    
                            <select>
                              <option>Price</option>
                              <option>Rs 20 000 - Rs 30 000</option>
     </select>
    

    Is it possible ?

    Thanks,

    k

  • Dennis Adolfi 1082 posts 6449 karma points MVP 6x c-trib
    Mar 02, 2017 @ 10:08
    Dennis Adolfi
    0

    Hi k.

    No this is not a possible feature out of the box. This package is deprecated and you should have a look at ezSearch, it is a much faster and more configurable search package.

    https://our.umbraco.org/projects/website-utilities/ezsearch/

  • k 256 posts 654 karma points
    Mar 02, 2017 @ 10:42
    k
    1

    Thank you for your suggestion. Will use ezsearch for my website search.

    Thanks,

    kusum

  • Dennis Adolfi 1082 posts 6449 karma points MVP 6x c-trib
    Mar 02, 2017 @ 10:46
    Dennis Adolfi
    0

    Thank you k. Have a great day!

Please Sign in or register to post replies

Write your reply to:

Draft