lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeme <...@git.apache.org>
Subject [GitHub] lucenenet issue #209: RFC: LUCENENET-565: Porting of Lucene.Net.Replicator
Date Fri, 28 Jul 2017 10:21:53 GMT
Github user jeme commented on the issue:

    https://github.com/apache/lucenenet/pull/209
  
    So for the past week I have been trying to make a "prototype" project that integrates
this... all in all working with AspNetCore it self actually posed far more trouble than integrating
the replicator into it as an afterthought... (Which I think is what will happen in many cases)...
    
    It does have some gotchas and I am considering some changes in the HttpReplicator and
HttpClientBase as a consequence... Even though the ReplicatorService it self was super easy
to integrate, there is things I am reconsidering about it... 
    
    Here is an example of it integrated into a "Mvc"Controller:
    
    ```csharp
        [Route("api/[controller]")]
        public class ReplicateController : Controller
        {
            [HttpGet("{*path}")]
            public void Get(string path) => Index.Instance.Service.Perform(Request, Response);
        }
    ```
    
    This requires the replicator to be created as:
    ```csharp
        replicator = new LocalReplicator();
        Service = new ReplicationService(new Dictionary<string, IReplicator>()
        {
            .... indexes
        }, "/api/replicate");
    ```
    
    Most notable is the `[Route("api/[controller]")]` + the controller type that has to be
in sync with whats provided in the ReplicationService ctor: `"/api/replicate"` (replicate
because we named the controller ReplicateController.
    
    > I would expect there to be an extension method for IHostingEnvironment or IApplicationBuilder
so it could be added to the application:
    
    I don't think that would make all that much sense, there is allot more to it and I think
it would be difficult, at least at this point to make the integration so simple as the "user"
needs to manage publishing revisions etc. them self...
    
    But I also don't think "middleware" is the right place for this, instead it depends on
the kind of solution your making, often I would think that you would have some sort of web-api
along side of it, in this case it should go into a controller, much like above however it
DOES feel a bit awkward that we have a Get method that is void and doesn't have any parameters
at all.
    
    However I do think it fair to provide the signature currently given by the `Lucene.Net.Replicator.AspNetCore`
as a basic approach as that is very similar to the Java version, which means it feels familiar
and people will be able to read Java examples and somewhat translate them to .NET.
    
    However I would like to supplement this with something that felt more natural, but it
requires allot more thought, something that might be easier with a "working" solution in front
of me, which I have now... But it would still take time.
    
    So short term brings me back to that there are some minor reconsideration I wan't to take
on the HttpReplicator and HttpClientBase as well as the ReplicatorService and the abstraction.



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message