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