You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Ashwin Karpe (JIRA)" <ji...@apache.org> on 2009/12/28 07:33:40 UTC

[jira] Issue Comment Edited: (CAMEL-1472) Lucene Component

    [ https://issues.apache.org/activemq/browse/CAMEL-1472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56667#action_56667 ] 

Ashwin Karpe edited comment on CAMEL-1472 at 12/28/09 6:32 AM:
---------------------------------------------------------------

Hi Claus, Jon & Hadrian, 

I have created a new Apache Lucene Component & Query processor and have attached a patch along with a zip file containing the code for your review.  I have also added the requisite unit tests and ensured that the code undergoes checkstyle validation.

The component works as follows

<code>
       context.addRoutes(new RouteBuilder() {
            public void configure() {
                from("direct:start").
                    to("lucene://stdQuotesIndex?analyzerRef=#stdAnalyzer&indexDir=#std&srcDir=#load_dir").
                    to("mock:result");

            }
        });
</code>

where each URI parameter setting does the following 
       - analyzerRef:  can be any valid implementation of Lucene Directory Analyzer (StandardAnalyzer, WhitespaceAnalyzer, StopAnalyzer... etc)
       - srcDir: an optional directory location for loading Text or XML documents at endpoint or Lucene Index creation.    

Since these settings cannot be directly passed into the URI, I pass them using the JNDI registry associated with the the Default Component (example shown below).  

<code>
    @Override
    protected JndiRegistry createRegistry() throws Exception {
        JndiRegistry registry = new JndiRegistry(createJndiContext());
        registry.bind("std", new File("target/stdindexDir"));
        registry.bind("load_dir", new File("src/test/resources/sources"));
        registry.bind("stdAnalyzer", new StandardAnalyzer(Version.LUCENE_CURRENT));
        return registry;
    }
</code>

I used the latest version of Lucene version 3.0 for the implementation but this can be moved up easily over time since I have no hard restrictions on Lucene versions. The API sets could be different moving backwards though. I have not verified this.... Lucene has undergone a lot of change in each subsequent version it seems :).

Please find attached the patch as well as a zip file containing the code.

Can you please review and please let me know what you think. I would be happy to update the documentation once I get your feedback and am happy to make any needed changes.

Cheers,

Ashwin...

      was (Author: akarpe):
    Hi Claus, Jon & Hadrian, 

I have created a new Apache Lucene Component & Query processor and have attached a patch along with a zip file containing the code for your review.  I have also added the requisite unit tests and ensured that the code undergoes checkstyle validation.

The component works as follows

       context.addRoutes(new RouteBuilder() {
            public void configure() {
                from("direct:start").
                    to("lucene://stdQuotesIndex?analyzerRef=#stdAnalyzer&indexDir=#std&srcDir=#load_dir").
                    to("mock:result");

            }
        });

where each URI parameter setting does the following 
       - analyzerRef:  can be any valid implementation of Lucene Directory Analyzer (StandardAnalyzer, WhitespaceAnalyzer, StopAnalyzer... etc)
       - srcDir: an optional directory location for loading Text or XML documents at endpoint or Lucene Index creation.    

Since these settings cannot be directly passed into the URI, I pass them using the JNDI registry associated with the the Default Component (example shown below).  

    @Override
    protected JndiRegistry createRegistry() throws Exception {
        JndiRegistry registry = new JndiRegistry(createJndiContext());
        registry.bind("std", new File("target/stdindexDir"));
        registry.bind("load_dir", new File("src/test/resources/sources"));
        registry.bind("stdAnalyzer", new StandardAnalyzer(Version.LUCENE_CURRENT));
        return registry;
    }

I used the latest version of Lucene version 3.0 for the implementation but this can be moved up easily over time since I have no hard restrictions on Lucene versions. The API sets could be different moving backwards though. I have not verified this.... Lucene has undergone a lot of change in each subsequent version it seems :).

Please find attached the patch as well as a zip file containing the code.

Can you please review and please let me know what you think. I would be happy to update the documentation once I get your feedback and am happy to make any needed changes.

Cheers,

Ashwin...
  
> Lucene Component
> ----------------
>
>                 Key: CAMEL-1472
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1472
>             Project: Apache Camel
>          Issue Type: New Feature
>            Reporter: Claus Ibsen
>            Assignee: Ashwin Karpe
>             Fix For: Future
>
>         Attachments: camel-lucene-20091227.patch, camel-lucene.zip
>
>
> We should add a new component for Apache Lucene integration

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.