lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Bongiorno <>
Subject term query boost problem
Date Wed, 12 Aug 2009 19:46:39 GMT
I have a situation where I have a series of terms queries as part of a


term: 'sole type' -> leather
term: 'title' -> 'Men's Golf shoes'

But, some terms are incredibly powerful indicators of match
term: 'band type' -> 'gold'

Normally, I would set this as a field boost in the query. Problem is, it
isn't producing ANY changes even when I set the boost score absurdly high. I
have also tried to set the BooleanClause.MUST on my really important term
and I get no results at all.

I tried a simple TermQuery for that (no clause) and got no results. Below is
a code snippet. I checked through the recent archives discussing field
boosts and I am pretty confident I am doing it right. So, now I am presuming
it's a problem with my query.

    private Query buildQuery(Map<String, String> CatalogInfo) {
        if (CatalogInfo != null && CatalogInfo.size() > 0) {
            BooleanQuery booleanQuery = new BooleanQuery();
            for (Map.Entry<String, String> attributeValue :
CatalogInfo.entrySet()) {
                String attributeName = attributeValue.getKey();
                String[] attributeValues;
                if (attributeValue.getValue().indexOf(VALUES_DELIMITER) ==
-1) {
                    attributeValues = new String[]
                } else {
                    attributeValues =
                for (String attributeValue : attributeValues) {
                    String escapedValue =
                    TermQuery termQuery = new TermQuery(new
Term(attributeName, escapedValue));

                    Float boostNumber = _boostMap.get(attributeName); //
this is where 'band type' gets it's boost
                    if (boostNumber != null) {
                        LOG.warn("Boost value found: " + boostNumber);
                    booleanQuery.add(termQuery, BooleanClause.Occur.SHOULD);
            LOG.warn("Boolean query: " + booleanQuery.toString());
            return booleanQuery;
        return null;
Christian Bongiorno

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message