-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Phrase Search including wildcards
PostPosted: Mon Feb 07, 2011 6:43 am 
Newbie

Joined: Fri Jan 28, 2011 6:08 am
Posts: 3
Hello !

I have seen that phrase search is not compatible with wildcards (reading Lucene FAQ).

Will this be possible one day with Hibernate-Search ?

Has already someone by-passed this limitation ? What would be the way to achieve this ?

Thanks !


Top
 Profile  
 
 Post subject: Re: Phrase Search including wildcards
PostPosted: Mon Feb 07, 2011 9:25 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

if we are looking at the same FAQ - http://wiki.apache.org/lucene-java/LuceneFAQ - it is saying that you can use a MultiPhraseQuery as work around. Is this what you are after.
If not, can you describe your use case in more detail and what you expect Hibernate Search to do?

--Hardy


Top
 Profile  
 
 Post subject: Re: Phrase Search including wildcards
PostPosted: Tue Feb 08, 2011 4:54 am 
Newbie

Joined: Fri Jan 28, 2011 6:08 am
Posts: 3
hardy.ferentschik wrote:
Hi,

if we are looking at the same FAQ - http://wiki.apache.org/lucene-java/LuceneFAQ - it is saying that you can use a MultiPhraseQuery as work around. Is this what you are after.
If not, can you describe your use case in more detail and what you expect Hibernate Search to do?

--Hardy


What I would like to do is search on the following type of string : "hell* mis*". This is not possible using Hibernate Search API. I did the following but I guess this is not the optimal way :

Code:
String[] searchTerms = searchString.split(" ");
      BooleanQuery orQuery = new BooleanQuery();

      for (String searchTerm : searchTerms) {
         Query query = builder
               .keyword()
               .wildcard()
               .onField(TraductionPhrase.TEXT + "." + TextTraduction.VALUE)
               .matching(searchTerm).createQuery();
         orQuery.add(query, Occur.SHOULD);
      }


And doing it this way, I loose the phrase method options (such as slop).


Top
 Profile  
 
 Post subject: Re: Phrase Search including wildcards
PostPosted: Tue Feb 08, 2011 5:11 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

so you are talking about the Hibernate Search query DSL. You are right that the DSL does not support phrase queries with wildcards.The DSL is still work in progress and we are working on extending it foe the use cases you mentioned.
You can expect some changes/additions to the query DSL over the next few releases.

--Hardy


Top
 Profile  
 
 Post subject: Re: Phrase Search including wildcards
PostPosted: Tue Feb 08, 2011 6:25 am 
Newbie

Joined: Fri Jan 28, 2011 6:08 am
Posts: 3
hardy.ferentschik wrote:
Hi,

so you are talking about the Hibernate Search query DSL. You are right that the DSL does not support phrase queries with wildcards.The DSL is still work in progress and we are working on extending it foe the use cases you mentioned.
You can expect some changes/additions to the query DSL over the next few releases.

--Hardy


Thank you Hardy. This would be a great feature for Hibernate Search ;)


Top
 Profile  
 
 Post subject: Re: Phrase Search including wildcards
PostPosted: Wed Feb 09, 2011 9:42 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
While the DSL can be improved, I think that the code you posted should work fine.
Also about efficiency, the QueryParser would output a very similarly Query if it supported wildcards.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.