-->
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.  [ 1 post ] 
Author Message
 Post subject: RangeQuery with Integer value, Not giving expected result
PostPosted: Thu Jul 30, 2015 8:18 am 
Newbie

Joined: Mon Dec 02, 2013 12:32 am
Posts: 2
following are two fields defined in the entity

Code:

    @Column(name = "min_price")
    @Field(index = Index.YES, analyze = Analyze.YES, store = Store.NO)
    @NumericField
    @FieldBridge(impl = IntegerBridge.class)
    private Integer minPrice;

    @Column(name = "max_price")
    @Field(index = Index.YES, analyze = Analyze.YES, store = Store.NO)
    @NumericField
    @FieldBridge(impl = IntegerBridge.class)
    private Integer maxPrice;



full text query is generated using entityManager as following

Code:

        BooleanJunction priceBooleanJunction = queryBuilder.bool();
        //Building range query for price
        if (minPrice != null) {
            Query rangeQueryMinPrice = queryBuilder.range().onField("minPrice").above(minPrice).createQuery();
            priceBooleanJunction.must(rangeQueryMinPrice);
        }
        if (maxPrice != null) {
            Query rangeQueryMaxPrice = queryBuilder.range().onField("maxPrice").below(maxPrice).createQuery();
            priceBooleanJunction.must(rangeQueryMaxPrice);
        }

        BooleanJunction combainedBoolean = queryBuilder.bool();

        if (!priceBooleanJunction.isEmpty()) {
            combainedBoolean.must(priceBooleanJunction.createQuery());
        }

        Query searchQuery = combainedBoolean.createQuery();
        FullTextQuery query = fullTextEntityManager.createFullTextQuery(searchQuery, ServiceProvider.class);

        LOGGER.info(query.toString());


the last log prints the following for 40, 90 input

Code:
FullTextQueryImpl(+minPrice:[40 TO *] +maxPrice:[* TO 90])


database contains the values (min,max) as (50, 80) and (80, 90)

still result is empty.


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

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.