Skip to content

Commit

Permalink
feat(Lucene): add extensions comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bkapustik committed Apr 26, 2024
1 parent 9fc9079 commit dc55731
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
34 changes: 17 additions & 17 deletions src/Kentico.Xperience.Lucene.Core/LuceneStartupExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public static class LuceneStartupExtensions
/// <summary>
/// Adds Lucene services and custom module to application using the <see cref="DefaultLuceneIndexingStrategy"/> and <see cref="StandardAnalyzer"/> for all indexes
/// </summary>
/// <param name="serviceCollection"></param>
/// <returns></returns>
/// <param name="serviceCollection">the <see cref="IServiceCollection"/> which will be modified</param>
/// <returns>Returns this instance of <see cref="IServiceCollection"/>, allowing for further configuration in a fluent manner.</returns>
public static IServiceCollection AddKenticoLucene(this IServiceCollection serviceCollection)
{
serviceCollection.AddLuceneServicesInternal();
Expand All @@ -30,9 +30,9 @@ public static IServiceCollection AddKenticoLucene(this IServiceCollection servic
/// Adds Lucene services and custom module to application with customized options provided by the <see cref="ILuceneBuilder"/>
/// in the <paramref name="configure" /> action.
/// </summary>
/// <param name="serviceCollection"></param>
/// <param name="configure"></param>
/// <returns></returns>
/// <param name="serviceCollection">the <see cref="IServiceCollection"/> which will be modified</param>
/// <param name="configure"><see cref="Action"/> which will configure the <see cref="ILuceneBuilder"/></param>
/// <returns>Returns this instance of <see cref="IServiceCollection"/>, allowing for further configuration in a fluent manner.</returns>
public static IServiceCollection AddKenticoLucene(this IServiceCollection serviceCollection, Action<ILuceneBuilder> configure)
{
serviceCollection.AddLuceneServicesInternal();
Expand Down Expand Up @@ -79,7 +79,7 @@ public interface ILuceneBuilder
/// <exception cref="ArgumentException">
/// Thrown if a strategy has already been registered with the given <paramref name="strategyName"/>
/// </exception>
/// <returns></returns>
/// <returns>Returns this instance of <see cref="ILuceneBuilder"/>, allowing for further configuration in a fluent manner.</returns>
ILuceneBuilder RegisterStrategy<TStrategy>(string strategyName) where TStrategy : class, ILuceneIndexingStrategy;


Expand All @@ -92,16 +92,16 @@ public interface ILuceneBuilder
/// <exception cref="ArgumentException">
/// Thrown if an analyzer has already been registered with the given <paramref name="analyzerName"/>
/// </exception>
/// <returns></returns>
/// <returns>Returns this instance of <see cref="ILuceneBuilder"/>, allowing for further configuration in a fluent manner.</returns>
ILuceneBuilder RegisterAnalyzer<TAnalyzer>(string analyzerName) where TAnalyzer : Analyzer;


/// <summary>
/// Sets the <see cref="LuceneVersion"/> lucene version which will be used by <see cref="Analyzer"/> for search indexes.
/// Defaults to <c><see cref="LuceneVersion.LUCENE_48"/></c>
/// </summary>
/// <param name="matchVersion"></param>
/// <returns></returns>
/// <param name="matchVersion"><see cref="LuceneVersion"/> to be used by the <see cref="Analyzer"/></param>
/// <returns>Returns this instance of <see cref="ILuceneBuilder"/>, allowing for further configuration in a fluent manner.</returns>
ILuceneBuilder SetAnalyzerLuceneVersion(LuceneVersion matchVersion);
}

Expand Down Expand Up @@ -129,9 +129,9 @@ internal class LuceneBuilder : ILuceneBuilder
/// Registers the <see cref="ILuceneIndexingStrategy"/> strategy <typeparamref name="TStrategy" /> in DI and
/// as a selectable strategy in the Admin UI
/// </summary>
/// <typeparam name="TStrategy"></typeparam>
/// <param name="strategyName"></param>
/// <returns></returns>
/// <typeparam name="TStrategy">The custom type of <see cref="ILuceneIndexingStrategy"/> </typeparam>
/// <param name="strategyName">Used internally <typeparamref name="TStrategy" /> to enable dynamic assignment of strategies to search indexes. Names must be unique.</param>
/// <returns>Returns this instance of <see cref="ILuceneBuilder"/>, allowing for further configuration in a fluent manner.</returns>
public ILuceneBuilder RegisterStrategy<TStrategy>(string strategyName) where TStrategy : class, ILuceneIndexingStrategy
{
StrategyStorage.AddStrategy<TStrategy>(strategyName);
Expand All @@ -145,9 +145,9 @@ public ILuceneBuilder RegisterStrategy<TStrategy>(string strategyName) where TSt
/// Registers the <see cref="Analyzer"/> analyzer <typeparamref name="TAnalyzer"/>
/// as a selectable analyzer in the Admin UI. When selected this analyzer will be used to process indexed items.
/// </summary>
/// <typeparam name="TAnalyzer"></typeparam>
/// <param name="analyzerName"></param>
/// <returns></returns>
/// <typeparam name="TAnalyzer">The type of <see cref="Analyzer"/> </typeparam>
/// <param name="analyzerName">Used internally <typeparamref name="TAnalyzer"/> to enable dynamic assignment of analyzers to search indexes. Names must be unique.</param>
/// <returns>Returns this instance of <see cref="ILuceneBuilder"/>, allowing for further configuration in a fluent manner.</returns>
public ILuceneBuilder RegisterAnalyzer<TAnalyzer>(string analyzerName) where TAnalyzer : Analyzer
{
AnalyzerStorage.AddAnalyzer<TAnalyzer>(analyzerName);
Expand All @@ -160,8 +160,8 @@ public ILuceneBuilder RegisterAnalyzer<TAnalyzer>(string analyzerName) where TAn
/// Sets the <see cref="LuceneVersion"/> lucene version which will be used by <see cref="Analyzer"/> for indexing.
/// Defaults to <c><see cref="LuceneVersion.LUCENE_48"/></c>
/// </summary>
/// <param name="matchVersion"></param>
/// <returns></returns>
/// <param name="matchVersion"><see cref="LuceneVersion"/> to be used by the <see cref="Analyzer"/></param>
/// <returns>Returns this instance of <see cref="ILuceneBuilder"/>, allowing for further configuration in a fluent manner.</returns>
public ILuceneBuilder SetAnalyzerLuceneVersion(LuceneVersion matchVersion)
{
AnalyzerStorage.SetAnalyzerLuceneVersion(matchVersion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ namespace Microsoft.Extensions.DependencyInjection;
public static class ServiceProviderExtensions
{
/// <summary>
/// Returns an instance of the <see cref="ILuceneIndexingStrategy"/> assigned to the given <paramref name="index" />.
/// Used to generate instances of a <see cref="ILuceneIndexingStrategy"/> service type that can change at runtime.
/// </summary>
/// <param name="serviceProvider"></param>
Expand All @@ -15,7 +14,7 @@ public static class ServiceProviderExtensions
/// This shouldn't normally occur because we fallback to <see cref="DefaultLuceneIndexingStrategy" /> if no custom strategy is specified.
/// However, incorrect dependency management in user-code could cause issues.
/// </exception>
/// <returns></returns>
/// <returns>Returns an instance of the <see cref="ILuceneIndexingStrategy"/> assigned to the given <paramref name="index" />.</returns>
internal static ILuceneIndexingStrategy GetRequiredStrategy(this IServiceProvider serviceProvider, LuceneIndex index)
{
var strategy = serviceProvider.GetRequiredService(index.LuceneIndexingStrategyType) as ILuceneIndexingStrategy;
Expand Down

0 comments on commit dc55731

Please sign in to comment.