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>
<ul>
@foreach (var result in Umbraco.Search(searchQuery))
{
<li>
<a href="@result.Url">@result.Name</a>
</li>
}
</ul>
</div>
}
}
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.
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
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?
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.
and then the link generated above will lead to the following search result screen.
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.
Thanks,
Hi,
May I suggest you read https://our.umbraco.com/documentation/Reference/Searching/
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
see https://our.umbraco.com/Documentation/Reference/Searching/Examine/overview-explanation
You can then pass that query into Umbraco.Search
Regards
Ismail
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?
Thanks in advance
is working on a reply...