OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.43k stars 2.4k forks source link

Unable to get search page via Lucene #10604

Closed sergeor closed 3 years ago

sergeor commented 3 years ago

Discussed in https://github.com/OrchardCMS/OrchardCore/discussions/10600

When recipe blank site used, the search page return error «Search is not configured».

Originally posted by **sergeor** October 31, 2021 **when I try to access the search page, I get the message «Search is not configured».** I will describe to you exactly what I do - I am creating a new ASP.NET Core empty project. I add reference to `OrchardCore.Application.Cms.Targets` - I fill the setup page with the recipe `blank site` - I'm adding a new Content Type with name `Article`. Add to this, `Title` and `HtmlBody`. Check in Full-text the `Include display text` and `Include body parts`. Also, in HtmlBody check the `Include this element in the index`, `Stored`, `Analyzed` - I Create a new Content Type with name `Articles` and I add `title` `HtmlBody` and `List or Article`. I also check all the search related fields as above. - In the Search section in Lucene Indices, add an index with name Search, standardanalyzer, Any Culture and check Article and Articles - In search settings, the index is Search and the Default searched fields is `Content.ContentItem.FullText`. The Allow Lucene queries in search forms is checked The Run Lucene Query seems to work well. As I get some results In security Anonymous role I have give access with check the Query Lucene Search Index and Query Lucene Api Now when I try to access the search page, I get the message **«Search is not configured».** After some digging I found in `OrchardCore.Modules\OrchardCore.Lucene\Controllers\SearchController.cs` that the `searchSettings.SearchIndex` is null Any help? What I'm doing Wrong
Skrypt commented 3 years ago

We may want to prevent saving the form data when there is no index created beforehand in this case or display a better error message on the search form.

Skrypt commented 3 years ago

See misleading notifications here :

image

It says the settings have been saved successfully but there is no search index saved.

sergeor commented 3 years ago

Is there an issue or not?

Skrypt commented 3 years ago

The search should work, so it's just adjustments on how we handle the form validations and notifications here.