Github user geobmx540 commented on the issue:

    https://github.com/apache/lucenenet/pull/207
  
    Is our reference only an `IndexSearcher` and it's descendants? I'm partial 
to the `Context` language - I'm using EF as my implementation reference because 
I think it's widely known, accepted and pretty well architected. `DbContext` is 
well known, just as perhaps `LuceneContext` could be very intuitive (as the 
class) with the method 'Context()'.
    
    We could also overload  `ReferenceContext.cs` (or `LuceneContext`) to have 
pass through methods directly to the context/reference IndexSearch to avoid the 
extra method call to get the Reference. This would require an additional 
constraint on `T`
    
    ```
    using (var context = searcherManager.Context()) 
    {
          // General use case
         var topDocs = context.Search(query, 10);
    
         // Cast if you're trying to reach a descendant class type with 
additional methods / properties
         BetterIndexSearcher searcher = (BetterIndexSearcher)context.Context;
         var betterTopDocs = searcher.BetterSearch(query,10);
    }
    ```
    
    or alternatively,
    
    using (var context = (BetterIndexSearcher)searcherManager.Context()) 
    {
          var topDocs = context.BetterSearch(query, 10);
    }
    ```



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to