1 2 Previous Next 17 Replies Latest reply on Aug 17, 2007 2:21 AM by Christian Bauer

    Seam/hibernate search

    Fredric Newbie

      I am trying to integrate the Lucene search engine into a Seam application and found Hiberante search to help me with the task. This seems to work, but the implementation got a bit messy. I read that Seam 1.3 could have support for Hibernate Search which would be great.

      Do you guys have any clues when the 1.3 version is due? Before summer, next year? It would be nice to know if I could wait or continue with the "messy" solution I'm working on currently.

      //Frippe

        • 1. Re: Seam/hibernate search
          Gavin King Master

          What's messy about it?

          • 2. Re: Seam/hibernate search
            Emmanuel Bernard Master

            What do you mean by messy?

            • 3. Re: Seam/hibernate search
              Fredric Newbie

              I guess "messy" was the wrong word for this context. What I was referring to was; to day I need to combine the use of Seam annotations and functionality with hibernate sessions to get the indexing up and running. If would be nice to keep the code clean from hibernate sessions when it's not being used anywhere else in the same application.

              What I was was hoping for was a Seam version or a very tight integration of the hibernate search. But perhaps I am hoping to much for Seam wonders in areas where I should make an effort myself.

              //Frippe

              • 4. Re: Seam/hibernate search
                Milli Coelho Newbie

                Frippe,

                I know it is kind of an old thread. Were you able to use hibernate search in seam? If so, could you provide information on how to configure it?

                Is anyone else using hibernate search in seam?

                • 5. Re: Seam/hibernate search
                  Vladimir Kovalyuk Apprentice

                  Milli
                  please check out dvdstore example that is shipped with seam 2.0beta1.
                  I remember seeing that it was configured in persistence.xml.

                  • 6. Re: Seam/hibernate search
                    Norman Richards Master

                    A couple of the example apps use hibernate search. The dvd store uses it now, and the integration is relatively smooth. (though I must say I find the search syntax way to rigid)

                    • 7. Re: Seam/hibernate search
                      Emmanuel Bernard Master

                      I think we should write a lucene query parser with a decent syntax and a seam context injection

                      If someone has ideas about the syntax, open a jira issue and write them down

                      • 8. Re: Seam/hibernate search
                        Christian Bauer Master

                        I don't think query string parsers are the way to go. If I'm a user I don't want to learn another query syntax just because I want a "whole phrase" search or a simple AND. So any website that targets endusers (not something like JIRA) will have its own control boxes and dropdowns etc. on the search page.

                        So what we could do is come up with something like I did for the wiki, a small framework that makes it easier to build such search masks.

                        • 9. Re: Seam/hibernate search
                          Norman Richards Master

                          I agree with Christian 100% on this. I don't want anything more complex than google. I can handle quotes, but anything more than that should be strictly for the power users. I particularly dislike the need to use "*" for partial matches.

                          • 10. Re: Seam/hibernate search
                            Milli Coelho Newbie

                            Thanks guys I will check out. Meanwhile after posting it here, I tried configuring it and I kind of got it working. But I will look in to the examples to see how it is done and used.

                            I still use 1.2.1 and examples for reference so I did not see it used anywhere.

                            • 11. Re: Seam/hibernate search
                              Matt Drees Master

                               

                              "christian.bauer@jboss.com" wrote:
                              So what we could do is come up with something like I did for the wiki, a small framework that makes it easier to build such search masks.


                              +1

                              • 12. Re: Seam/hibernate search
                                Emmanuel Bernard Master

                                 

                                "norman.richards@jboss.com" wrote:
                                I agree with Christian 100% on this. I don't want anything more complex than google. I can handle quotes, but anything more than that should be strictly for the power users. I particularly dislike the need to use "*" for partial matches.


                                one-box dump user search mask are not that simple to build. The way to achieve it is to have a simpler grammar for the query (like the one you describe), and do a multi layer search (eg. first all exact terms with AND, then exact term with OR then approximate term etc)
                                The problem is that such multi layer search engines are very very business and data specific and there is no real way to have a decent off the shelves solution. It needs customization.

                                • 13. Re: Seam/hibernate search
                                  Christian Bauer Master

                                  But Lucene has its own QueryParser already, why would we write another syntax and another parser? Yes, it is not very stable and throws exceptions all the time (fun on JIRA which uses it). I see more chance improving the Lucene criteria API though by abstracting it a little. For example:

                                  @org.hibernate.search.annotations.Indexed
                                  @Entity
                                  @Searchable(description = "Documents")
                                  public class Document {
                                  
                                   @org.hibernate.search.annotations.Field(index = org.hibernate.search.annotations.Index.TOKENIZED)
                                   @Searchable(description = "Content")
                                   private String content;
                                  
                                   @org.hibernate.search.annotations.Field(
                                   index = org.hibernate.search.annotations.Index.UN_TOKENIZED,
                                   store = org.hibernate.search.annotations.Store.YES
                                   )
                                   @org.hibernate.search.annotations.DateBridge(resolution = org.hibernate.search.annotations.Resolution.DAY)
                                   @Searchable(description = "Modified", type = SearchableType.PASTDATE)
                                   protected Date lastModifiedOn;
                                  
                                  }
                                  


                                  The @Searchable annotation is mine. With this I can:

                                  - build an internal metamodel of searchable entities and properties

                                  - build a UI from this metamodel (I have the description text)

                                  - generate a compound Lucene query with AND/OR semantics (depending on users choice) from the UI input, using some generic value holders to transport the search strings

                                  I think this can be made generic enough to justify inclusion in Hibernate Search and Seam (for the UI part).


                                  • 14. Re: Seam/hibernate search
                                    Emmanuel Bernard Master

                                    You need a parser one way or another to split words of your query
                                    'java Hibernate'
                                    Should end up being 'Java' and 'Hibernate'
                                    Then from those you can do (by priority layer)
                                    Java AND Hibernate
                                    Java OR Hibernate
                                    Java~ OR Hibernate
                                    Java OR Hibernate~
                                    etc

                                    If you reuse the Lucene query parser, you end up losing the ability to define those layers

                                    PS I haven't looked yet at the @Searchable framwork you did for the Wiki

                                    1 2 Previous Next