Selecting simalar-looking items with HQL
I have a form that makes widgets, if a user is trying to make a widget that's similar to one already in the database I'd like to let them know by showing them a list of possible duplicates. However when I use like
hibernate only selects exact matches. How can I look through the database to see if any widget n开发者_如何学Pythonames are very similar to the one that's currently being made? Thanks,
213897
It's more a Lucene's kind of work... I think you can try Hibernate Search, which nicely integrates Hibernate (which you are already using) and index search like the one you would need.
You could also use a similarity search engine (http://obsearch.net) with a distance function to achieve this. It depends on how you represent a "widget". Can you elaborate more on the properties that you consider relevant of a widget? (size color, or position, or just that it uses a similar number of components)
精彩评论