Update Lucene docs with recipe steps, .NET Foundation most active community projects 2023 - This week in Orchard (26/01/2024)

Gábor Domonkos's avatar
Announcement, Documentation, This week in Orchard, Resource manifest

Update ResourceManager to better handle resources that don't specify a version, update Lucene docs with recipe steps, and Orchard Core is in the top 10 of the list of .NET Foundation's most active community projects of 2023! Without any further ado, let's get started!

Orchard Core updates

Update Lucene docs

The Lucene module allows you to manage Lucene indices. This module contains a Lucene Worker feature, which creates a background task that will keep the local file system index synchronized with other instances that could have their local index. It is recommended to use it only if you are running the same tenant on multiple instances (farm) and using a Lucene file system index. The module also provides a management UI and APIs for querying Lucene data using ElasticSearch Queries. And of course, Lucene indices can be created during recipe execution using the ElasticIndexSettings step. The documentation of this module has been updated with these recipe steps to describe how to set the default search settings, how to restart the indexing process from the beginning to update current content items, or how to rebuild a Lucene index.

Update Lucene docs

Update ResourceManager to better handle resources that don't specify a version

Let's say we have two scripts defined. A "default" version that doesn't specify a version. In another module, we define an override of that resource by defining a resource with the same name and specifying a version number. When we run the site, the script resources fail to load due to an ArgumentNullException.

The issue lies in ResourceManager.FindMatchingResource, because when evaluating the second match, resource.Version is null, which causes a new Version(resource.Version) to throw the ArgumentNullException. Note that earlier in the method, the code takes care to avoid the ArgumentNullException by checking for null.

A workaround for this issue is to just make sure that all resources specify a version, but since the version is not required by the API, it should handle null gracefully.

You can reproduce this issue by following these steps:

  1. In an IConfigureOptions<ResourceManagementOptions>, register a new resource. For example, a script called "MyScript". Don't specify a version.
  2. Additionally, register a second resource with the same name, and this time also call SetVersion with a valid version number. For example, "MyScript" with a version of "1.0.0".
  3. Require the resource. For example, in Layout.cshtml, use the script tag helper to require "MyScript" and don't specify a version.
  4. Run the site and notice that the script doesn't load (in fact, no scripts load). Also, notice that you receive an ArgumentNullException in the log.

The expectation would be that version 1.0.0 of the resource to be loaded on the page (winning out over the one without a version, and not throwing an error). So, this change is about updating the ResourceManager.cs to better handle resources that don't specify a version.

Update ResourceManager to better handle resources that don't specify a version

News from the community

.NET Foundation most active community projects 2023

Shaun Walker shared this image on X that contains the most active community projects based on the number of pull requests, the number of commits, and the number of new contributors.

As you can see, Orchard has 1136 pull requests in 2023, which is great. Orchard has 854 commits, which is weird. Why do we have more pull requests than commits? Do we close that many pull requests? The reason for that could be that we have some mini PRs created by Dependabot.

And we haven't talked about which projects are using squash and merge and which aren't. But it's still a nice thing to be able to see Orchard in the top 10 again! And don't forget about the fact that Orchard Core recently reached 7000 stars on GitHub!

.NET Foundation Most Active Community Projects 2023

Orchard Dojo Newsletter

Lombiq's Orchard Dojo Newsletter has 481 subscribers! We have started this newsletter to inform the community around Orchard of the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course.

Do you know of other Orchard enthusiasts who would like to read our weekly articles? Tell them to subscribe here!

If you are interested in more news about Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

No Comments

Add a Comment