-->
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.  [ 4 posts ] 
Author Message
 Post subject: Query time boosting on numeric fields
PostPosted: Thu Dec 21, 2017 12:29 am 
Newbie

Joined: Sat Feb 27, 2016 1:47 am
Posts: 16
Hello, it would seem that boosts are not working for me on numeric fields.

My use case is that I have a product database, and some products are only available to specific countries or regions. If a user selects a region, then products in that region should be boosted to the top, with products available countrywide given a little boost, and worldwide products not boosted.

So my query looks like:

Code:
qb.bool()
    .must(qb.keyword()
   .onFields("name").boostedTo(5f)
   .andField("description")
   .matching(searchText).createQuery()
    )
    .must(
        qb.bool()
       .should(qb.keyword()
      .onField("regions.regionId").boostedTo(50f).matching(regionId).createQuery())
            .should(qb.keyword()
      .onField("countries.countryId").boostedTo(10f).matching(countryId).createQuery())
            .should(qb.keyword()
      .onField("worldwide").matching(true).createQuery()).createQuery()
    )
.createQuery();


However the boosts on the regionId and countryId appear to do nothing.

when I print out the query using toString(), I get:

Code:
(
   +(
      RemoteMatchQuery<:searchterm^5.0,  originalAnalyzer=...ScopedElasticsearchAnalyzerReference@4189c5b1, queryAnalyzer=...ScopedElasticsearchAnalyzerReference@3b3799b2>
      RemoteMatchQuery<:searchterm, originalAnalyzer=...ScopedElasticsearchAnalyzerReference@4189c5b1, queryAnalyzer=...ScopedElasticsearchAnalyzerReference@3b3799b2>
   )
   +(
      (
          regions.regionId:[2645 TO 2645]
          countries.countryId:[91 TO 91]
          worldwide:true
      )^10.0
   )
)


Which looks like the individual boosts are ok for the search term matching, but it's only using the last one for the entire region/country sub clause? Note I've tried using createQuery().boostedTo(...) as well with no change.

Does this appear to be a bug? Or am I just misunderstanding how boosts work...

Cheers

Note: I'm using hibernate search 5.8.2 with elasticsearch


Top
 Profile  
 
 Post subject: Re: Query time boosting on numeric fields
PostPosted: Tue Jan 02, 2018 11:04 am 
Hibernate Team
Hibernate Team

Joined: Thu Jan 05, 2017 6:04 am
Posts: 13
Hi,

Thanks for the very thorough report and sorry for the delay (the entire team was on vacation during the holidays).

You're right, we have a bug here. I created https://hibernate.atlassian.net/browse/HSEARCH-2983 to track it.

That being said, I haven't reproduced the fact that you have the ^10 global boost on the second part of the query. I don't have any boost at all (which is expected considering the code base). Are you sure it's this exact DSL call that generated this query?

BTW, we are not sure we should consider backporting this, considering how old this behavior is, would you mind if we only fix it in the upcoming 5.9 release?

Thanks for your feedback.


Top
 Profile  
 
 Post subject: Re: Query time boosting on numeric fields
PostPosted: Wed Jan 03, 2018 12:39 pm 
Hibernate Team
Hibernate Team

Joined: Thu Jan 05, 2017 6:04 am
Posts: 13
Issue fixed for the upcoming 5.9.0.Beta2.


Top
 Profile  
 
 Post subject: Re: Query time boosting on numeric fields
PostPosted: Sun Jan 07, 2018 5:55 pm 
Newbie

Joined: Sat Feb 27, 2016 1:47 am
Posts: 16
gsmet wrote:
Hi,

Thanks for the very thorough report and sorry for the delay (the entire team was on vacation during the holidays).

You're right, we have a bug here. I created https://hibernate.atlassian.net/browse/HSEARCH-2983 to track it.

That being said, I haven't reproduced the fact that you have the ^10 global boost on the second part of the query. I don't have any boost at all (which is expected considering the code base). Are you sure it's this exact DSL call that generated this query?

BTW, we are not sure we should consider backporting this, considering how old this behavior is, would you mind if we only fix it in the upcoming 5.9 release?

Thanks for your feedback.


Thanks I have just got back from vacation myself. The DSL/query example given above was simplified from my actual dsl, which may explain why you couldn't reproduce that global boost value. Though I do remember being very confused as to how that global boost was being calculated as it was not a number I was giving it.

Thanks for resolving the issue, and I look forward to the upcoming version!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.