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>
}
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.
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
Hi Kusum
Can you share all the code please?
Where did you use @node.upload ?
Thanks,
Alex
Hi Kusum
It will be nice to know, did you find a solution?
Thanks,
Alex
Hello Alex,
Thanks for replying.
I want to modify the code :
to
(but this is not working)
Thanks,
kusum
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)
Then, in you foreach (same view), you do this:
Best of luck to you.
Hello Dennis,
Thank you so much. It works fine :).
Awesome k! That makes me very happy!
Have a great day!!
Hello Dennis,
I wanted to know if it is possible to find range of values using simplistic search ?
Thanking you for your help.
kusum
Hi again.
Im sorry but I dont think I quite understand the question..
Do you mean like a pager?
Hello,
I mean I wanted to use simplistic search to search nodes using the below exemple :
Is it possible ?
Thanks,
k
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/
Thank you for your suggestion. Will use ezsearch for my website search.
Thanks,
kusum
Thank you k. Have a great day!
is working on a reply...