My application creates BoolQueryBuilder objects using Java API. Now I need to cache these in Jedis for reuse. Jedis only allows String type objects to be stored in it. So I convert the BoolQueryBuilder objects to String objects and store it. But how do I get BoolQueryBuilder objects back from these String objects? An example String representation is:
I can convert this String to a BooleanQuery using QueryParser parse method. But then how do I convert this BooleanQuery back to a BoolQueryBuilder? I need a BoolQueryBuilder object because my SearchRequestBuilder expects a builder object, not the query itself.
On Thursday, August 2, 2012 10:33:51 PM UTC-4, bilash wrote:
> My application creates BoolQueryBuilder objects using Java API. Now I need > to cache these in Jedis for reuse. Jedis only allows String type objects to > be stored in it. So I convert the BoolQueryBuilder objects to String > objects and store it. But how do I get BoolQueryBuilder objects back from > these String objects? An example String representation is:
> I can convert this String to a BooleanQuery using QueryParser parse > method. But then how do I convert this BooleanQuery back to a > BoolQueryBuilder? I need a BoolQueryBuilder object because my > SearchRequestBuilder expects a builder object, not the query itself.
Actually I am using prepareSearch which seems to only accept a QueryBuilder objects as arguments. Is there a way I could pass a String query to prepareSearch?
Here query is a custom query object that basically encapsulates a BoolQueryBuilder. Is there any other way I could execute the above search with a String query?
On Friday, August 3, 2012 9:32:16 PM UTC-4, Igor Motov wrote:
> Are you using some custom version > of SearchRequestBuilder? The standard SearchRequestBuilder object actually > accepts String as a query.
> On Thursday, August 2, 2012 10:33:51 PM UTC-4, bilash wrote:
>> My application creates BoolQueryBuilder objects using Java API. Now I >> need to cache these in Jedis for reuse. Jedis only allows String type >> objects to be stored in it. So I convert the BoolQueryBuilder objects to >> String objects and store it. But how do I get BoolQueryBuilder objects back >> from these String objects? An example String representation is:
>> I can convert this String to a BooleanQuery using QueryParser parse >> method. But then how do I convert this BooleanQuery back to a >> BoolQueryBuilder? I need a BoolQueryBuilder object because my >> SearchRequestBuilder expects a builder object, not the query itself.
The prepareSearch function that you are referring to is probably your internal function, correct? I am not sure how it's implemented and what restrictions it has.
On Friday, August 3, 2012 9:52:05 PM UTC-4, bilash wrote:
> Actually I am using prepareSearch which seems to only accept a > QueryBuilder objects as arguments. Is there a way I could pass a String > query to prepareSearch?
> Here query is a custom query object that basically encapsulates a > BoolQueryBuilder. Is there any other way I could execute the above search > with a String query?
> Thanks a lot for helping out.
> On Friday, August 3, 2012 9:32:16 PM UTC-4, Igor Motov wrote:
>> Are you using some custom version >> of SearchRequestBuilder? The standard SearchRequestBuilder object actually >> accepts String as a query.
>> On Thursday, August 2, 2012 10:33:51 PM UTC-4, bilash wrote:
>>> My application creates BoolQueryBuilder objects using Java API. Now I >>> need to cache these in Jedis for reuse. Jedis only allows String type >>> objects to be stored in it. So I convert the BoolQueryBuilder objects to >>> String objects and store it. But how do I get BoolQueryBuilder objects back >>> from these String objects? An example String representation is:
>>> I can convert this String to a BooleanQuery using QueryParser parse >>> method. But then how do I convert this BooleanQuery back to a >>> BoolQueryBuilder? I need a BoolQueryBuilder object because my >>> SearchRequestBuilder expects a builder object, not the query itself.
On Friday, August 3, 2012 10:23:26 PM UTC-4, Igor Motov wrote:
> The prepareSearch function that you are referring to is probably your > internal function, correct? I am not sure how it's implemented and what > restrictions it has.
> Here query and filter can be Builders as well as Strings.
> Igor
> On Friday, August 3, 2012 9:52:05 PM UTC-4, bilash wrote:
>> Actually I am using prepareSearch which seems to only accept a >> QueryBuilder objects as arguments. Is there a way I could pass a String >> query to prepareSearch?
>> Here query is a custom query object that basically encapsulates a >> BoolQueryBuilder. Is there any other way I could execute the above search >> with a String query?
>> Thanks a lot for helping out.
>> On Friday, August 3, 2012 9:32:16 PM UTC-4, Igor Motov wrote:
>>> Are you using some custom version >>> of SearchRequestBuilder? The standard SearchRequestBuilder object actually >>> accepts String as a query.
>>> On Thursday, August 2, 2012 10:33:51 PM UTC-4, bilash wrote:
>>>> My application creates BoolQueryBuilder objects using Java API. Now I >>>> need to cache these in Jedis for reuse. Jedis only allows String type >>>> objects to be stored in it. So I convert the BoolQueryBuilder objects to >>>> String objects and store it. But how do I get BoolQueryBuilder objects back >>>> from these String objects? An example String representation is:
>>>> I can convert this String to a BooleanQuery using QueryParser parse >>>> method. But then how do I convert this BooleanQuery back to a >>>> BoolQueryBuilder? I need a BoolQueryBuilder object because my >>>> SearchRequestBuilder expects a builder object, not the query itself.