i tried to create a search result page and display searchresults. Regarding to the Examine settings page and the result i get on "ExternalIndex" i am expecting to get the same on my search result page.
My code:
@if (!string.IsNullOrEmpty(Request.QueryString["query"]))
{
<div>Query: @(Request.QueryString["query"])</div>
{
var results = Umbraco.ContentQuery.Search(Request.QueryString["query"], 0, 10, out var amount);
<div>amount: @amount</div>
<ul>
@foreach (var result in results)
{
<li>
<a href="@result.Content.Url">@result.Content.Name</a>
</li>
}
</ul>
}
}
I tried a lot of different parameters, but no results found. Is there any documentation? Or maybe a simple failure on my side?
Can you check that Examine works as expected in your project? Can you go to the developers section - Examine management and test queries there. Also, try to rebuild indexes.
Did you set field aliases in ExamineIndex.config that you are searching for?
Searching not working with ContentQuery.Search
Hi @all,
i tried to create a search result page and display searchresults. Regarding to the Examine settings page and the result i get on "ExternalIndex" i am expecting to get the same on my search result page.
My code:
I tried a lot of different parameters, but no results found. Is there any documentation? Or maybe a simple failure on my side?
Best Thobias
Hi
Can you check that Examine works as expected in your project? Can you go to the developers section - Examine management and test queries there. Also, try to rebuild indexes.
Did you set field aliases in ExamineIndex.config that you are searching for?
Read more about Examine - https://our.umbraco.com/documentation/Reference/Config/ExamineIndex/
Thanks,
Alex
Try to provide an empty string for the culture in your Search:
Umbraco.ContentQuery.Search("test", 0, 10, out var amount, string.Empty);
Thank you so much! Its working now
is working on a reply...