Results 1 to 8 of 8

Thread: Lucene Integration

  1. #1
    Join Date
    Aug 2004
    Posts
    1

    Default Lucene Integration

    There is an interesting search engine (jakarta lucene) which I need to integrate with spring to put my search results into http session.

    Where should I start? Could anyone help?

  2. #2
    Join Date
    Aug 2004
    Location
    Amsterdam, Netherlands
    Posts
    450

    Default

    Could you elaborate a bit here? Specifically as to what architecture your application will have. Are you looking to use Lucene in combination with a database or files? Also, where in the process do you see Lucene coming into action?

    If you're storing things in a database I could see an interceptor processing the object before (or after) they are being saved and add to the the Lucene indices. We've done this a long time ago and it worked pretty well (although this was done without Spring).

  3. #3
    Join Date
    Sep 2004
    Location
    Recife - Pernambuco - Brazil
    Posts
    7

    Default

    Quote Originally Posted by Alef Arendsen
    If you're storing things in a database I could see an interceptor processing the object before (or after) they are being saved and add to the the Lucene indices. We've done this a long time ago and it worked pretty well (although this was done without Spring).
    Hi, I was searching for Lucene in forum and found this topic. So, I have implemented interceptors to deal with indexes in OpenNuke project:
    https://opennuke.dev.java.net/source...ke/aop/lucene/

    This works using a indexer class an process objects with processors classes that deal with domain objects. Later, full text search is used in daos to execute a query using a IN SQL clausule like made in fullTextSearch method in a basic dao class.

    I really want to listen opinions about this.

    Best Regards.
    Marcos Silva Pereira
    Recife - Pernambuco - Brazil

  4. #4
    Join Date
    Nov 2004
    Location
    Hilversum - The Netherlands
    Posts
    1,054

    Default

    I have checked your sourcecode and have a few comments:

    1) you don`t update your documents in batches. I have created a Indexer interface, and a BatchedIndexer implementation. THe last one processed new documents in batches, so you can delete a batch of documents..and write a batch of documents.

    2) you have a writer open and a reader for deletes open at the same time. Doesn`t this give problems?

    Code:
     public void updateDocument(Document doc) throws IOException {
    
            IndexWriter writer = makeWriter();
    
            deleteDocument(doc);
    
            writer.addDocument(doc);
    
            writer.optimize();
            writer.close();
    
        }
    Should be:
    Code:
     public void updateDocument(Document doc) throws IOException {
    
            deleteDocument(doc);
    
            IndexWriter writer = makeWriter();      
            writer.addDocument(doc);
            writer.optimize();
            writer.close();
    
        }
    And if you often add documents, don`t optimize all the time.


    I`m currently writing a small and light framework on top of lucene to let me work with typed documents (it wraps a lucene document). And offers a lot of ready to use services.

    @topicstarter:
    But in principle.. Spring has no influence on how you are going to use Lucene.

  5. #5
    Join Date
    Sep 2004
    Location
    Recife - Pernambuco - Brazil
    Posts
    7

    Default

    Hi, Alarmnummer, I appreciate your comments. Thanks for feedback.
    Quote Originally Posted by Alarmnummer
    1) you don`t update your documents in batches. I have created a Indexer interface, and a BatchedIndexer implementation. THe last one processed new documents in batches, so you can delete a batch of documents..and write a batch of documents.
    Some code was changed but not commited and I have implemented a Indexer interface to provides abstraction over Lucene like was made with Searcher interface. BatchedIndexer will be implemented like batches inserts and new code send to cvs.
    Quote Originally Posted by Alarmnummer
    2) you have a writer open and a reader for deletes open at the same time. Doesn`t this give problems?

    Code:
     public void updateDocument(Document doc) throws IOException {
    
            IndexWriter writer = makeWriter();
    
            deleteDocument(doc);
    
            writer.addDocument(doc);
    
            writer.optimize();
            writer.close();
    
        }
    Should be:
    Code:
     public void updateDocument(Document doc) throws IOException {
    
            deleteDocument(doc);
    
            IndexWriter writer = makeWriter();      
            writer.addDocument(doc);
            writer.optimize();
            writer.close();
    
        }
    Thanks, it is really a bug. I will fix it.
    Quote Originally Posted by Alarmnummer
    And if you often add documents, don`t optimize all the time.
    Hum, maybe a boolean flag can tell to method if it should or not make optimize? What you think about?
    Quote Originally Posted by Alarmnummer
    I`m currently writing a small and light framework on top of lucene to let me work with typed documents (it wraps a lucene document). And offers a lot of ready to use services.
    It's a open source project? Did you plan use annotations. I will refactoring some code to create processors based on annotations in domain classes. Is it a good idea?

    Best Regards.
    Marcos Silva Pereira
    Recife - Pernambuco - Brazil

  6. #6
    Join Date
    Nov 2004
    Location
    Hilversum - The Netherlands
    Posts
    1,054

    Default

    Quote Originally Posted by Marcos Silva Pereira
    Hum, maybe a boolean flag can tell to method if it should or not make optimize? What you think about?
    I have an optimize service that optimizes my lucene index once and awhile. (I use Quartz for the scheduling)

    It's a open source project?
    Maybe in the future, but not at the moment.

    Did you plan use annotations.
    annotations for what?

    I will refactoring some code to create processors based on annotations in domain classes. Is it a good idea?
    Could you elaborate?

  7. #7
    Join Date
    Sep 2004
    Location
    Recife - Pernambuco - Brazil
    Posts
    7

    Default

    Hum... use a scheduling job sounds like a good idea. I will think about it.

    Well, I plan use annotations in my pojos to create a processor that read this annotations and decides how (keyword, store, unstore and field name) to index each attribute in pojo. Actually I am using simple reflection and deals with all attributes at the same way. Seems that you are thinking in index documents but, I am concerned about index objects. Despite this, what is your opinion about use annotations to decide how each attribute will be indexed?

    Best Regards...
    Marcos Silva Pereira
    Recife - Pernambuco - Brazil

  8. #8
    Join Date
    Nov 2004
    Location
    Hilversum - The Netherlands
    Posts
    1,054

    Default

    Quote Originally Posted by Marcos Silva Pereira
    Hum... use a scheduling job sounds like a good idea. I will think about it.
    If you use the same scheduler thread for writing the index, and optimizing it.. you won`t have any problems.

    Well, I plan use annotations in my pojos to create a processor that read this annotations and decides how (keyword, store, unstore and field name) to index each attribute in pojo. Actually I am using simple reflection and deals with all attributes at the same way. Seems that you are thinking in index documents but, I am concerned about index objects. Despite this, what is your opinion about use annotations to decide how each attribute will be indexed?
    The thought has crossed my mind... But I want a typesafe document-object because the document is my main 'domain' object. I need typesafe methods on that document and therefor I have created a new document type (the basedoc) that wraps a luncene document and translates my typesafe methods to unsafe lucene methods.

    Best Regards...[/quote]

Similar Threads

  1. Replies: 5
    Last Post: Oct 30th, 2012, 01:01 PM
  2. AspectWerkz integration
    By Rod Johnson in forum AOP
    Replies: 5
    Last Post: Jul 14th, 2005, 08:15 AM
  3. Testing a View (integration tests)
    By hay7777 in forum Web
    Replies: 5
    Last Post: Jul 13th, 2005, 11:37 AM
  4. Separation of integration and unit test source
    By eliot in forum Architecture
    Replies: 4
    Last Post: Jan 30th, 2005, 01:27 PM
  5. 3rd party integration for Glazed Lists
    By swankjesse in forum Swing
    Replies: 12
    Last Post: Nov 25th, 2004, 01:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •