@@ -16,7 +16,7 @@ public DetailsToolHandler(
1616 ILogger < DetailsToolHandler > logger ,
1717 IOptions < NLWebOptions > options ,
1818 IQueryProcessor queryProcessor ,
19- IResultGenerator resultGenerator )
19+ IResultGenerator resultGenerator )
2020 : base ( logger , options , queryProcessor , resultGenerator )
2121 {
2222 }
@@ -28,7 +28,7 @@ public DetailsToolHandler(
2828 public override async Task < NLWebResponse > ExecuteAsync ( NLWebRequest request , CancellationToken cancellationToken = default )
2929 {
3030 var stopwatch = Stopwatch . StartNew ( ) ;
31-
31+
3232 try
3333 {
3434 Logger . LogDebug ( "Executing details tool for query: {Query}" , request . Query ) ;
@@ -45,23 +45,23 @@ public override async Task<NLWebResponse> ExecuteAsync(NLWebRequest request, Can
4545 // Create details-focused query
4646 var detailsQuery = $ "{ subject } overview definition explanation details";
4747 var processedQuery = await QueryProcessor . ProcessQueryAsync ( request , cancellationToken ) ;
48-
48+
4949 // Generate detailed results
5050 var searchResults = await ResultGenerator . GenerateListAsync ( detailsQuery , request . Site , cancellationToken ) ;
5151 var resultsList = searchResults . ToList ( ) ;
52-
52+
5353 // Enhance results for details focus
5454 var detailsResults = EnhanceDetailsResults ( resultsList , subject ) ;
55-
55+
5656 stopwatch . Stop ( ) ;
57-
57+
5858 var response = CreateSuccessResponse ( request , detailsResults , stopwatch . ElapsedMilliseconds ) ;
5959 response . ProcessedQuery = detailsQuery ;
6060 response . Summary = $ "Details retrieved for '{ subject } ' - found { detailsResults . Count } detailed results";
61-
62- Logger . LogDebug ( "Details tool completed in {ElapsedMs}ms for subject '{Subject}'" ,
61+
62+ Logger . LogDebug ( "Details tool completed in {ElapsedMs}ms for subject '{Subject}'" ,
6363 stopwatch . ElapsedMilliseconds , subject ) ;
64-
64+
6565 return response ;
6666 }
6767 catch ( Exception ex )
@@ -78,12 +78,12 @@ public override bool CanHandle(NLWebRequest request)
7878 return false ;
7979
8080 var query = request . Query ? . ToLowerInvariant ( ) ?? string . Empty ;
81-
81+
8282 // Can handle queries that ask for details, information, or descriptions
83- var detailsKeywords = new [ ]
84- {
85- "details" , "information about" , "tell me about" , "describe" ,
86- "what is" , "explain" , "definition of" , "overview of"
83+ var detailsKeywords = new [ ]
84+ {
85+ "details" , "information about" , "tell me about" , "describe" ,
86+ "what is" , "explain" , "definition of" , "overview of"
8787 } ;
8888
8989 return detailsKeywords . Any ( keyword => query . Contains ( keyword ) ) ;
@@ -93,15 +93,15 @@ public override bool CanHandle(NLWebRequest request)
9393 public override int GetPriority ( NLWebRequest request )
9494 {
9595 var query = request . Query ? . ToLowerInvariant ( ) ?? string . Empty ;
96-
96+
9797 // Higher priority for explicit details requests
9898 if ( query . StartsWith ( "tell me about" ) || query . StartsWith ( "what is" ) || query . Contains ( "details about" ) )
9999 return 90 ;
100-
100+
101101 // Medium-high priority for informational queries
102102 if ( query . Contains ( "information about" ) || query . Contains ( "describe" ) )
103103 return 75 ;
104-
104+
105105 // Default priority for details-related queries
106106 return 65 ;
107107 }
@@ -187,16 +187,16 @@ private double CalculateDetailsRelevance(NLWebResult result, string subject)
187187
188188 // Check if result contains comprehensive information
189189 var detailsIndicators = new [ ] { "overview" , "introduction" , "definition" , "explanation" , "guide" , "about" } ;
190-
190+
191191 // Name relevance with details indicators
192192 if ( ! string . IsNullOrEmpty ( result . Name ) )
193193 {
194194 var nameLower = result . Name . ToLowerInvariant ( ) ;
195-
195+
196196 // High score for exact subject match in name
197197 if ( subjectTerms . All ( term => nameLower . Contains ( term ) ) )
198198 score += 5.0 ;
199-
199+
200200 // Bonus for details indicators
201201 foreach ( var indicator in detailsIndicators )
202202 {
@@ -209,11 +209,11 @@ private double CalculateDetailsRelevance(NLWebResult result, string subject)
209209 if ( ! string . IsNullOrEmpty ( result . Description ) )
210210 {
211211 var descriptionLower = result . Description . ToLowerInvariant ( ) ;
212-
212+
213213 // Score for subject terms in description
214214 var matchingTerms = subjectTerms . Count ( term => descriptionLower . Contains ( term ) ) ;
215215 score += matchingTerms * 1.5 ;
216-
216+
217217 // Bonus for comprehensive description (longer, more detailed)
218218 if ( result . Description . Length > 100 )
219219 score += 1.0 ;
0 commit comments