Help

The first beta of Hibernate Search 3.3 is out. We had several goals in mind.

One of them is to morph the project into a more independent piece of software for Infinispan. We have a lot of exciting developments around Infinispan, search and persistence. But that's the subject of another post. On to the meat now.

Hibernate Search query DSL

Probably the most visible feature is the new Hibernate Search query DSL.

Writing Lucene queries is not easy, either you use the query parser limiting yourself to fairly simple queries and manipulating strings or you use the Lucene programmatic query API which is quite verbose and contains a myriad of settings and alternatives.

On top of that, you need to make sure you apply the same magic at query and indexing time: if you don't the index key you look for will not match and you will return no result. This is particularly true in an object world where two transformations occur:

  • the object is transformed in a string via the Hibernate Search FieldBridge
  • the string is transformed into terms via the analyzer

Each property can have different combinations of field bridge and analyzer.

Hibernate Search solves these problems by transparently applying the appropriate FieldBridge and analyzer of a given researched property. It's also built around a fluent API to make queries very easy to write and more importantly easier to read.

QueryBuilder mythQB = searchFactory.buildQueryBuilder().forEntity( Myth.class ).get();

//look for popular modern myths that are not urban
Date twentiethCentury = ...;
Query luceneQuery = mythQB
    .bool()
      .must( mythQB.keyword().onField("description_stem").matching("urban").createQuery() )
        .not()
      .must( mythQB
        .range()
        .onField("starred")
        .from(3).excludeLimit()
        .to(5)
        .createQuery() )
      .must( mythQB
        .range()
        .onField("creationDate")
        .above(twentiethCentury)
        .createQuery() )
    .createQuery();

This example shows many things:

  • the fluent API in action (you've got to admit that it's more readable than a raw Lucene query)
  • you pass objects and not string representations (Date and number in this case)
  • description_stem uses a stemming analyzer (eg. transforming loving in its root word love): no need to apply it yourself before passing the matching string, the query DSL does that for you.

I will blog in more details about Hibernate Seach query DSL shortly.

Hibernate Core 3.6

This release is compatible with Hibernate Core 3.6 (in Beta3 at the time of writing). A side effect is that manual configuration of the event listeners is no longer necessary even when only using hbm.xml files.

Statistics

Hardy has been busy designing a statistics API (available from the SearchFactory). It gives you a lot of information about Hibernate Search:

  • average and max time for a Lucene query execution
  • average and max time for the object loading process following a Lucene query execution
  • slowest query
  • number of entities indexed of a given type
  • and many more

Again, a more detailed blog post should come soon.

Integration tests for JTA and Spring

We have added integration tests for both Spring Framework and JTA. On the JTA side, we are testing against Bitronix and JBoss Transactions standalone.

Mutable SearchFactory

While not a public feature yet, Hibernate Search now has the ability to add new entity types on the fly.

From the ground up, we have made sure that Hibernate Search is extremely fast and efficient at runtime. To achieve that we have been using an immutable design for the SearchFactory: we pre-compute and store metadata to make indexing and querying efficient. and that forced us to know the list of indexed entity types ahead of time.

Infinispan, however, does not know necessarily knows the list of entities ahead of time. The new design uses a copy-on-change approach to keep the benefits of the immutable model while offering the ability to add new entities. As a user, you won't notice it but as a framework using Hibernate Search, you will :)

Bug fixes

Of course we also fix bugs :)

Check out the new release on JBoss.org's Maven repository or download the distribution. You can also read the documentation here. Be aware that this version breaks a couple of SPIs, make sure to check the migration guide.

52 comments:
 
25. Aug 2010, 17:18 CET | Link
Georges

The fluent api looks really nice - great work!!

ReplyQuote
28. Aug 2010, 11:22 CET | Link
Gabriel

I used the new DSL in my code and indeed it is shorter and more readable now. Great work!

I have a two questions I didn't find answers to in the documentation:

1) I want to query for a specific numeric or date value. Is there a way to do it directly instead of using range()...from()...to().. ? Should I use keyword()...matching() for that?

2) Is there a way to use the or operator in the DSL? Since I didn't find out how to do it, I used a BooleanQuery for that part.

Thanks.

 
30. Aug 2010, 15:03 CET | Link

I beg to differ, even though generally I'm a fan of fluent interfaces. Maybe the example would be more expressive, if the subqueries would have been refactored into own variables, but judging from the code as it is quoted above I would prefer SQL or DB4O-like native queries. All these long expressions like keyword().onField("..") matching(".."), .from(3).excludeLimit().to(5), etc. are a huge load of clutter compared to a simple:

where description_stem = "urban" and starred between 4 and 5

Why replace something that simple with something less readable? For the compile time checking? I'd rather have an SQL-syntax checker in my IDE that can be activated with an annotation on the string: @SQL String q = "select ...."; alongside dropping support for raw statements, which are prone to SQL injections. Plus any decent SQL-IDE gets you better support when designing your database queries. I do think that this fluent interface is a waste of time, both for those who implemented and support it (apart from the learning aspect) as for those who will have to deal with it.

30. Aug 2010, 16:54 CET | Link

Hi Gabriel,

1. yes use keyword().onField("creationDate").matching(date); If you have a better name for keyword, I am all ears.

2. The closest to or is should(). There is no strict equivalent of or in Lucene. You've done the right thing.

 
30. Aug 2010, 17:11 CET | Link

Hi Wanja,

String based queries are good but fail short for the numerous options that full-text queries offer (boost, prefix length, fuzzy factory, analyzer to use etc etc). They also become horrible for more complex queries encompassing several levels of boolean queries.

Hibernate Search query DSL aims at simplifying these kind of more complex and custom queries.

It's a bit like JP-QL vs the Criteria API but with a stronger advantage towards the programmatic approach in the Hibernate Search case.

 
30. Sep 2010, 02:12 CET | Link

Quick question, does this beta or any future version of Hibernate Search support the ability to configure the indexing via XML instead of annotations? Thanks!

 
04. Oct 2010, 09:46 CET | Link

Hi Augusto, We do not support XML in a built-in way but we have a much better solution. You can define your metamodel programmatically. Read more here.

 
22. Nov 2010, 19:01 CET | Link
This is really nice! You mentioned that you'd be blogging more details about the DSL shortly - did I miss it? Just looking for more good info about the DSL.. thanks
 
13. Dec 2010, 17:39 CET | Link

You did not miss it. I never got the chance to write the entry. The reference documentation has a section dedicated to it though. Let us know if you have questions by opening a JIRA.

17. Jun 2014, 15:48 CET | Link

The fact is, there are no studies connecting muscle soreness to hypertrophy. Okay, don’t stop reading yet; you will get some good stuff from being a bit sore–and you’ll probably even want to strive for it. But first you need to know what causes muscle soreness.rebel-mouse

18. Jun 2014, 13:13 CET | Link

If you choose the other options, go to Gmail Contacts on the left upper corner, and when the left sidebar appear click Import Contacts. In this case Gmail will ask you to select a file CSV files for example. This is when you have, for example, an Outlook account and you want to import the contacts from there.how to create gmail account

18. Jun 2014, 14:12 CET | Link

The world of bodybuilding is filled with marketers claiming to make the best workout supplements to build lean muscle, increase strength, and help with recovery. Most of this is just hype. But there is a simple formula for muscle growth and significant strength increases, while getting ripped at the same time.Efficient Gains

18. Jun 2014, 15:25 CET | Link

The foundation of our philosophy is that technology should enhance your enjoyment of your home, but should not heavily impact the look. To this end we work closely with architects, builders, interior designers and decorators to achieve a seamless installation that both meets your home entertainment needs but also keeps technology where it belongs; in the background.Innovative Sight and Sound

19. Jun 2014, 09:33 CET | Link

Than Just Friends review, ebook FAQ, and PDF download guide that provides an insider's look at the program and answers frequently asked questions about Rebecca Mercy's unique and highly popular relationship guide.more than just friends

21. Jun 2014, 05:48 CET | Link

Learning styles are various approaches or ways of learning. They involve educating methods, particular to an individual that are presumed to allow that individual to learn best. Most children favor some particular method of interacting with processing information.Dermatoglyphics Multiple Intelligence Test

21. Jun 2014, 07:42 CET | Link

At this time, we are able to easily find fashionable and ready-made fir pit kits, which we are able to purchase, and in many cases carry around with us even when camping or enjoying the outdoors anywhere.Compra Con Un Click

21. Jun 2014, 15:19 CET | Link

There are no side-affects and this is created in a lab and is certified. Natural extract of HCA have proved to accelerate the rate of metabolism and this have become an agent which helps to lose weight and burns all the excess fat that has been stored over a period of time.Steven Bailey

21. Jun 2014, 15:56 CET | Link

Miracle Garcinia Cambogia is a natural ingredient which helps to lose weight immediately without the need of dieting and exercising. This has got a special extract known as HCA that can help to lose weight. This is available over the counter without even the need of getting a prescription. Walmart, medical pharmacy and other retail store has this product that is certified. This supplement can also be purchased from online stores. Jon Medina

22. Jun 2014, 14:11 CET | Link

The River Thames is an iconic part of London, meandering through the heart of the city and offering fantastic sightseeing from Tower Bridge to the London Eye and even the historic Houses of Parliament.good website

23. Jun 2014, 18:28 CET | Link

This is an exclusive fruit-based medication course, which helps you overcome from the problem from excessive weight and other related issues caused by fatty cells. An interesting fact in this case is that this type of course will not only help you to save your money involved in surgical procedure and complex diagnose, but also prevent you from the surgical process. Perry Dennis

23. Jun 2014, 19:20 CET | Link

The purpose of field service management software is to assist officers in service delivery to the people. Therefore, one should choose one that avails information that will lead to more growth of the business. Provide your customers with valuable data and most certainly, there will be increased customers to your business.Programare.org

24. Jun 2014, 12:03 CET | Link

This social networking giant has altered, in very short order the way we handle all of interactions, including communications, promotions and general management of our lives. The promotion and sharing of all things we do, be it through our work, our personal project or just our shared scheduling is conducted through Facebook.buyfansandfollowers.net/buy-facebook-fans.html

24. Jun 2014, 13:08 CET | Link

The kingdom of Goa is the most important in India…It is civilized, having famous orchards and water. It is the coolest place in India and it is the most plentiful in foodstuffs. ‘The white people make a practice of going to the kingdom of Goa to enjoy the shade and the groves of trees and to savour the sweet betel.http://www.embarquement.net

 
11. Jul 2014, 11:51 CET | Link

Very well written article. It seems that the author has done a solid job, and needs good comments. Learn Java in Surat

 
14. Jul 2014, 07:42 CET | Link

Awesome and interesting article.DMIT India

 
08. Aug 2014, 10:20 CET | Link

Very well written article. It seems that the author has done a solid job, and needs good comments. Indian jewelry online

10. Sep 2014, 21:25 CET | Link
asadalikhatri

Well, this got me thinking what other workouts are good for those of us who find ourselves on the road or have limited equipment options.PDF

16. Sep 2014, 08:50 CET | Link
michael kors outlet online sale,michael kors,kors outlet,michael kors outlet,michael kors handbags,michael kors outlet online,michael kors handbags clearance,michael kors purses,michaelkors.com,michael kors bags,michael kors shoes,michaelkors,cheap michael kors

, oakley vault,oakley sunglasses,oakleys,oakley sunglasses cheap,oakley.com,sunglasses outlet,cheap oakley,cheap oakley sunglasses,oakley outlet,cheap sunglasses,oakley prescription glasses,fake oakleys,oakley sunglasses outlet,oakley glasses,oakley store,fake oakley,oakley sale,cheap oakleys,discount oakley sunglasses, tory burch outlet,tory burch,tory burch handbags,tory burch shoes,tory burch sale,toryburch,tory burch sandals,toryburch.com,tory burch flip flops, ray ban sunglasses outlet,ray ban,ray ban sunglasses,rayban,ray bans,ray ban outlet,ray-ban,raybans,ray ban wayfarer,ray-ban sunglasses,raybans.com,rayban sunglasses,cheap ray ban, oakley sunglasses,oakley vault,oakleys,oakley sunglasses cheap,oakley.com,sunglasses outlet,cheap oakley,cheap oakley sunglasses,oakley outlet,cheap sunglasses,oakley prescription glasses,fake oakleys,oakley sunglasses outlet,oakley glasses,oakley store,fake oakley,oakley sale,cheap oakleys,discount oakley sunglasses, burberry outlet online,burberry,burberry outlet,burberry handbags,burberry factory outlet,burberry sale, polo ralph lauren outlet online,ralph lauren,polo ralph,polo ralph lauren,ralph lauren outlet,polo shirts,ralph lauren outlet online,polo ralph lauren outlet,ralphlauren.com,polo outlet,ralph lauren polo, gucci outlet,gucci handbags,gucci belts,gucci shoes,gucci,gucci belt,gucci sunglasses,gucci bags,cheap gucci, polo ralph lauren outlet,ralph lauren,polo ralph,polo ralph lauren,ralph lauren outlet,polo shirts,ralph lauren outlet online,polo ralph lauren outlet online,ralphlauren.com,polo outlet,ralph lauren polo, michael kors outlet,michael kors,kors outlet,michael kors handbags,michael kors outlet online,michael kors outlet online sale,michael kors handbags clearance,michael kors purses,michaelkors.com,michael kors bags,michael kors shoes,michaelkors,cheap michael kors, toms shoes,toms outlet,toms shoes outlet,toms.com,tom shoes, cheap oakley sunglasses,oakley sunglasses,oakley vault,oakleys,oakley sunglasses cheap,oakley.com,sunglasses outlet,cheap oakley,oakley outlet,cheap sunglasses,oakley prescription glasses,fake oakleys,oakley sunglasses outlet,oakley glasses,oakley store,fake oakley,oakley sale,cheap oakleys,discount oakley sunglasses, louboutin,christian louboutin,red bottom shoes,louboutin shoes,red bottoms,louboutin outlet,christian louboutin shoes,christian louboutin outlet,red bottom shoes for women,louboutins, michael kors outlet online,michael kors,kors outlet,michael kors outlet,michael kors handbags,michael kors outlet online sale,michael kors handbags clearance,michael kors purses,michaelkors.com,michael kors bags,michael kors shoes,michaelkors,cheap michael kors, michael kors outlet,michael kors outlet online,michael kors,kors outlet,michael kors handbags,michael kors outlet online sale,michael kors handbags clearance,michael kors purses,michaelkors.com,michael kors bags,michael kors shoes,michaelkors,cheap michael kors, ray ban sunglasses,ray ban,rayban,ray bans,ray ban outlet,ray-ban,raybans,ray ban wayfarer,ray-ban sunglasses,raybans.com,ray ban sunglasses outlet,rayban sunglasses,cheap ray ban, louboutin outlet,louboutin,christian louboutin,red bottom shoes,louboutin shoes,red bottoms,christian louboutin shoes,christian louboutin outlet,red bottom shoes for women,louboutins, michael kors handbags clearance,michael kors handbags,michael kors bags,michael kors purses

20. Sep 2014, 07:43 CET | Link

At the end of this post, I have also placed some important consumer alerts about various schemes I've found from dodgy websites promoting Fibroids Miracle (FM) with absolutely no knowledge of the product and that may have ulterior motives to try and trick you into visiting their sites. https://www.rebelmouse.com/amandaletofibroidsmiracle/

 
20. Sep 2014, 08:21 CET | Link
Home warranty Jacksonville | webseobuy65(AT)yahoo.com

This is so cool. I am such a huge fan of their work. Home warranty San Antonio Home warranty Jacksonville

04. Oct 2014, 08:31 CET | Link

The Tinnitus Remedy book is only available online through Ian McCall's website and is NOT sold through Amazon, Barnes and Noble, or other traditional book sellers.what really works for tinnitus

09. Oct 2014, 16:30 CET | Link

Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon.video shooting surabaya

22. Oct 2014, 09:52 CET | Link

This review may be slightly different in nature than other reviews of Loyal 9 but it is the same in one regard - that it gives 5 stars for expertise and excellent .loyal 9 scam

23. Oct 2014, 06:45 CET | Link

Written for consumers by a consumer, this fan site includes a fun and informative MI40 Xtreme review, ebook FAQ, and PDF download guide that provides an insider's look at the program and answers frequently asked questions about Ben Pakulski's unique and highly popular muscle building guide.https://rebelmouse.com/mi40xtremereviews/

 
23. Oct 2014, 13:49 CET | Link
asad

Great post! I am actually getting ready to across this information, is very helpful my friend. Also great blog here with all of the valuable information you have. Keep up the good work you are doing here.logo design

 
01. Nov 2014, 08:02 CET | Link

You can't really say what is beautiful about a place, but the image of the place will remain vividly with you. personal trainer berlin

 
06. Nov 2014, 06:09 CET | Link
www.garciniacambogiaofficial.com.au official website

HCA promotes your serotonin scales, which have been interconnected to feelings of happiness and craving reduction. By enhancing serotonin amounts, it enhances your mood plus reduces your cravings for sugary foods. Thus, you’ll lose fat without any dieting or exercise. www.garciniacambogiaofficial.com.au official website

 
12. Nov 2014, 09:02 CET | Link
check this site out

However, the most fulfilling aspect in woodworking is being able to add a individual touch to tasks and make them one of a kind. check this site out

13. Nov 2014, 12:35 CET | Link

Today at Joystiq Deals, we're giving you control over your very own camera-equipped drone. The Limited Edition Code Black Drone is up for pre-order at $89 today, saving you more than $100 on its launch price. Fitted with an HD camera, the Black Hawk Drone features a six-axis flight control system, making a solid pick for beginners and aerial craft enthusiasts alike.

 
14. Nov 2014, 08:22 CET | Link
find here

Using a college of motoring, you know that you are certified to successfully pass your analyze as well as becoming a secure car owner. find here

 
16. Nov 2014, 13:21 CET | Link
there that

A trip to the Amazon at the start of his career taught him this lesson, he said, as he saw there that the only useful way to protect the environment is to take care of the people who depend on it. He said incentive programs like the Salmon Safe label are one way to do that here. he has a good point

 
16. Nov 2014, 14:57 CET | Link
environmental

In his 15 years of experience in environmental work, Nussbaum said he has changed his approach. In the beginning he was more of an environmental activist, but has started to see that more can be gained by collaborating with landowners and businesses, he said. you can check here

 
16. Nov 2014, 17:04 CET | Link
paleo snack ideas

There are many paleo snack ideas available, but all that remains is for one to decide on which ones best suit his/her diet. The snacks can be delicious, but at the same time they need to be healthy.paleo snack ideas

 
18. Nov 2014, 09:13 CET | Link
check this site out

Once a cellphone remains based, a gamer can therefore change a crack device in a way that the device can see all the material such as the protection measures of the games application. check this site out

 
18. Nov 2014, 11:28 CET | Link
underway

Nussbaum said fundraising efforts are underway to create a similar program next year for 25 farms in the Snoqualmie, Skagit and other watersheds. go to website

 
19. Nov 2014, 07:45 CET | Link
some situations

Which can give the engaged place the appearence of scaliness and in some situations can convert the epidermis yellow-colored in shade and is usually frequent around the go, throat and experience. use this link

 
25. Nov 2014, 13:47 CET | Link
click here to investigate

For operations there's the opportunity to definitely look for for prospective applicants, delivering out invites to them to implement for your available roles if you feel they satisfy your preferred requirements. click here to investigate

 
26. Nov 2014, 15:12 CET | Link
internet type

You would complete a short on the internet type, which will often pull in details from elsewhere, and allow you to publish details you already have on pc to save your efforts and effort. check my source

 
04. Dec 2014, 14:23 CET | Link
why not try here

So you've designed your website, you know the fundamentals of how a website goes to one, you know if you add the rule that makes an extra internet browser, you must add the rule labels. why not try here

 
09. Dec 2014, 09:56 CET | Link
more learn

Then why are you unaware regarding your teeth you need to search for recommendations from a dental professional at least every three several weeks and go for frequent check-up. more learn

 
13. Dec 2014, 11:48 CET | Link
click to read

Obviously, gambling houses are always seeking individuals doing techniques like these. Which is why if you're captured counting cards, you'll be brought out unglamorously by the men in dark . click to read

 
15. Dec 2014, 09:44 CET | Link
try this web-site

They can be a part of on the internet gambling houses sites that allow them to weblink to certain gambling houses. try this web-site

Post Comment