Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I best apply Hibernate-Search in this case?
    primarykey
    data
    text
    <p>I have a <code>Product</code> entity and table and would like the database design to allow finding a product by different keywords on top of its name, that is, like using a thesaurus e.g. product name "HDR-TD20V" should also be found by keywords "camcorder", "camera", "video camera", etc. Note that this same mechanics can be used to locate the same record from different input languages e.g. looking for "camara de video" (Spanish) or "videokamera" (German) should also find the same record.</p> <p>Assuming that I am using Hibernate-search i.e. Lucene I have the following two design choices:</p> <ol> <li><strong>De-normalized approach</strong>: <code>Product</code> table has a <code>keywords</code> column that contain comma separated keywords for that product. This clearly violates the <a href="http://en.wikipedia.org/wiki/First_normal_form" rel="nofollow">First Normal Form</a> "... the value of each attribute contains only a single value from that domain.". However, this would integrate nicely with Hibernate-search.</li> <li><strong>Normalized approach</strong>: Define a <code>Keyword</code> entity table i.e. <code>Keyword(id,keyword,languageId)</code> and the many-to-many association <code>ProductKeyword(productId,keywordId)</code> but the integration with Hibernate-Search is not so intuitive anymore ... unless e.g. I create a materialized view i.e. <code>select * from Product p, Keyword k, ProductKeyword pk where p.id=pk.productId and k.id=pk.keywordId</code> and index this materialized view.</li> </ol> <p>I would of course prefer the choice 2 but I am not sure how Hibernate-search would optimally cover this use-case. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload