You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Kirill Lykov <ly...@gmail.com> on 2011/09/12 12:21:11 UTC

Problem with SolrJ and Grouping

I found that SolrQuery doesn’t work with grouping.
I constructed SolrQuery this way:

solrQuery = constructFullSearchQuery(searchParams);
solrQuery.set("group", true);
solrQuery.set("group.field", "GeonameId");

Solr successfully handles request and writes about that in log:

INFO: [] webapp=/solr path=/select
params={start=1&q=*:*&timeAllowed=1500&group.field=GeonameId&group=true&wt=xml&rows=20&version=2.2}
hits=12099579 status=0 QTime=2968

The error occurs when SolrJ tries to parse
XMLResponseParser.processResponse (line 324), where builder stores
“</lst>”:

        Object val = type.read( builder.toString().trim() );
        if( val == null && type != KnownType.NULL) {
          throw new XMLStreamException( "error reading value:"+type,
parser.getLocation() );
        }
        vals.add( val );
        break;

The problem is - val is null. It happens because handler for the type
LST returns null(line 178 in the same file):

LST    (false) { @Override public Object read( String txt ) { return null; } },

I don’t understand why it works this way. Xml which was returned by
Solr is valid.
If any I attached response xml to the letter. The error occures in the
line 3, column 14 661.
I use apache solr 3.3.0 and the same SolrJ.
-- 
Best regards,
Kirill Lykov,
Software Engineer,
Data East LLC,
tel.:+79133816052,
LinkedIn profile: http://www.linkedin.com/pub/kirill-lykov/12/860/16

Re: Problem with SolrJ and Grouping

Posted by Martijn v Groningen <ma...@gmail.com>.
The changes to that class were minor. There is only support for
parsing a grouped response. Check the QueryResponse class there is a
method getGroupResponse()
I ran into similar exceptions when creating the
QueryResponseTest#testGroupResponse test. The test use a xml response
from a file.

On 12 September 2011 15:38, Kirill Lykov <ly...@gmail.com> wrote:
> Martijn,
>
> I can't find the fixed version.
> I've got the last version of SolrJ but I see only minor changes in
> XMLResponseParser.java. And it doesn't support grouping yet. I also
> checked branch_3x, branch for 3.4.
>
> On Mon, Sep 12, 2011 at 5:45 PM, Martijn v Groningen
> <ma...@gmail.com> wrote:
>> Also the error you described when wt=xml and using SolrJ is also fixed
>> in 3.4 (and in trunk / branch3x).
>> You can wait for the 3.4 release of use a night 3x build.
>>
>> Martijn
>>
>> On 12 September 2011 12:41, Sanal K Stephen <sa...@gmail.com> wrote:
>>> Kirill,
>>>
>>>         Parsing the grouped result using SolrJ is not released yet I
>>> think..its going to release with Solr 3.4.0.SolrJ client cannot parse
>>> grouped and range facets results SOLR-2523.
>>>
>>> see the release notes of Solr 3.4.0
>>> http://wiki.apache.org/solr/ReleaseNote34
>>>
>>>
>>> On Mon, Sep 12, 2011 at 3:51 PM, Kirill Lykov <ly...@gmail.com>wrote:
>>>
>>>> I found that SolrQuery doesn’t work with grouping.
>>>> I constructed SolrQuery this way:
>>>>
>>>> solrQuery = constructFullSearchQuery(searchParams);
>>>> solrQuery.set("group", true);
>>>> solrQuery.set("group.field", "GeonameId");
>>>>
>>>> Solr successfully handles request and writes about that in log:
>>>>
>>>> INFO: [] webapp=/solr path=/select
>>>>
>>>> params={start=1&q=*:*&timeAllowed=1500&group.field=GeonameId&group=true&wt=xml&rows=20&version=2.2}
>>>> hits=12099579 status=0 QTime=2968
>>>>
>>>> The error occurs when SolrJ tries to parse
>>>> XMLResponseParser.processResponse (line 324), where builder stores
>>>> “</lst>”:
>>>>
>>>>        Object val = type.read( builder.toString().trim() );
>>>>        if( val == null && type != KnownType.NULL) {
>>>>          throw new XMLStreamException( "error reading value:"+type,
>>>> parser.getLocation() );
>>>>        }
>>>>        vals.add( val );
>>>>        break;
>>>>
>>>> The problem is - val is null. It happens because handler for the type
>>>> LST returns null(line 178 in the same file):
>>>>
>>>> LST    (false) { @Override public Object read( String txt ) { return null;
>>>> } },
>>>>
>>>> I don’t understand why it works this way. Xml which was returned by
>>>> Solr is valid.
>>>> If any I attached response xml to the letter. The error occures in the
>>>> line 3, column 14 661.
>>>> I use apache solr 3.3.0 and the same SolrJ.
>>>> --
>>>> Best regards,
>>>> Kirill Lykov,
>>>> Software Engineer,
>>>> Data East LLC,
>>>> tel.:+79133816052,
>>>> LinkedIn profile: http://www.linkedin.com/pub/kirill-lykov/12/860/16
>>>>
>>>
>>>
>>>
>>> --
>>> Regards,
>>> Sanal Kannappilly Stephen
>>>
>>
>>
>>
>> --
>> Met vriendelijke groet,
>>
>> Martijn van Groningen
>>
>
>
>
> --
> Best regards,
> Kirill Lykov,
> Software Engineer,
> Data East LLC,
> tel.:+79133816052,
> LinkedIn profile: http://www.linkedin.com/pub/kirill-lykov/12/860/16
>



-- 
Met vriendelijke groet,

Martijn van Groningen

Re: Problem with SolrJ and Grouping

Posted by Kirill Lykov <ly...@gmail.com>.
Martijn,

I can't find the fixed version.
I've got the last version of SolrJ but I see only minor changes in
XMLResponseParser.java. And it doesn't support grouping yet. I also
checked branch_3x, branch for 3.4.

On Mon, Sep 12, 2011 at 5:45 PM, Martijn v Groningen
<ma...@gmail.com> wrote:
> Also the error you described when wt=xml and using SolrJ is also fixed
> in 3.4 (and in trunk / branch3x).
> You can wait for the 3.4 release of use a night 3x build.
>
> Martijn
>
> On 12 September 2011 12:41, Sanal K Stephen <sa...@gmail.com> wrote:
>> Kirill,
>>
>>         Parsing the grouped result using SolrJ is not released yet I
>> think..its going to release with Solr 3.4.0.SolrJ client cannot parse
>> grouped and range facets results SOLR-2523.
>>
>> see the release notes of Solr 3.4.0
>> http://wiki.apache.org/solr/ReleaseNote34
>>
>>
>> On Mon, Sep 12, 2011 at 3:51 PM, Kirill Lykov <ly...@gmail.com>wrote:
>>
>>> I found that SolrQuery doesn’t work with grouping.
>>> I constructed SolrQuery this way:
>>>
>>> solrQuery = constructFullSearchQuery(searchParams);
>>> solrQuery.set("group", true);
>>> solrQuery.set("group.field", "GeonameId");
>>>
>>> Solr successfully handles request and writes about that in log:
>>>
>>> INFO: [] webapp=/solr path=/select
>>>
>>> params={start=1&q=*:*&timeAllowed=1500&group.field=GeonameId&group=true&wt=xml&rows=20&version=2.2}
>>> hits=12099579 status=0 QTime=2968
>>>
>>> The error occurs when SolrJ tries to parse
>>> XMLResponseParser.processResponse (line 324), where builder stores
>>> “</lst>”:
>>>
>>>        Object val = type.read( builder.toString().trim() );
>>>        if( val == null && type != KnownType.NULL) {
>>>          throw new XMLStreamException( "error reading value:"+type,
>>> parser.getLocation() );
>>>        }
>>>        vals.add( val );
>>>        break;
>>>
>>> The problem is - val is null. It happens because handler for the type
>>> LST returns null(line 178 in the same file):
>>>
>>> LST    (false) { @Override public Object read( String txt ) { return null;
>>> } },
>>>
>>> I don’t understand why it works this way. Xml which was returned by
>>> Solr is valid.
>>> If any I attached response xml to the letter. The error occures in the
>>> line 3, column 14 661.
>>> I use apache solr 3.3.0 and the same SolrJ.
>>> --
>>> Best regards,
>>> Kirill Lykov,
>>> Software Engineer,
>>> Data East LLC,
>>> tel.:+79133816052,
>>> LinkedIn profile: http://www.linkedin.com/pub/kirill-lykov/12/860/16
>>>
>>
>>
>>
>> --
>> Regards,
>> Sanal Kannappilly Stephen
>>
>
>
>
> --
> Met vriendelijke groet,
>
> Martijn van Groningen
>



-- 
Best regards,
Kirill Lykov,
Software Engineer,
Data East LLC,
tel.:+79133816052,
LinkedIn profile: http://www.linkedin.com/pub/kirill-lykov/12/860/16

Re: Problem with SolrJ and Grouping

Posted by Martijn v Groningen <ma...@gmail.com>.
Also the error you described when wt=xml and using SolrJ is also fixed
in 3.4 (and in trunk / branch3x).
You can wait for the 3.4 release of use a night 3x build.

Martijn

On 12 September 2011 12:41, Sanal K Stephen <sa...@gmail.com> wrote:
> Kirill,
>
>         Parsing the grouped result using SolrJ is not released yet I
> think..its going to release with Solr 3.4.0.SolrJ client cannot parse
> grouped and range facets results SOLR-2523.
>
> see the release notes of Solr 3.4.0
> http://wiki.apache.org/solr/ReleaseNote34
>
>
> On Mon, Sep 12, 2011 at 3:51 PM, Kirill Lykov <ly...@gmail.com>wrote:
>
>> I found that SolrQuery doesn’t work with grouping.
>> I constructed SolrQuery this way:
>>
>> solrQuery = constructFullSearchQuery(searchParams);
>> solrQuery.set("group", true);
>> solrQuery.set("group.field", "GeonameId");
>>
>> Solr successfully handles request and writes about that in log:
>>
>> INFO: [] webapp=/solr path=/select
>>
>> params={start=1&q=*:*&timeAllowed=1500&group.field=GeonameId&group=true&wt=xml&rows=20&version=2.2}
>> hits=12099579 status=0 QTime=2968
>>
>> The error occurs when SolrJ tries to parse
>> XMLResponseParser.processResponse (line 324), where builder stores
>> “</lst>”:
>>
>>        Object val = type.read( builder.toString().trim() );
>>        if( val == null && type != KnownType.NULL) {
>>          throw new XMLStreamException( "error reading value:"+type,
>> parser.getLocation() );
>>        }
>>        vals.add( val );
>>        break;
>>
>> The problem is - val is null. It happens because handler for the type
>> LST returns null(line 178 in the same file):
>>
>> LST    (false) { @Override public Object read( String txt ) { return null;
>> } },
>>
>> I don’t understand why it works this way. Xml which was returned by
>> Solr is valid.
>> If any I attached response xml to the letter. The error occures in the
>> line 3, column 14 661.
>> I use apache solr 3.3.0 and the same SolrJ.
>> --
>> Best regards,
>> Kirill Lykov,
>> Software Engineer,
>> Data East LLC,
>> tel.:+79133816052,
>> LinkedIn profile: http://www.linkedin.com/pub/kirill-lykov/12/860/16
>>
>
>
>
> --
> Regards,
> Sanal Kannappilly Stephen
>



-- 
Met vriendelijke groet,

Martijn van Groningen

Re: Problem with SolrJ and Grouping

Posted by Sanal K Stephen <sa...@gmail.com>.
Kirill,

         Parsing the grouped result using SolrJ is not released yet I
think..its going to release with Solr 3.4.0.SolrJ client cannot parse
grouped and range facets results SOLR-2523.

see the release notes of Solr 3.4.0
http://wiki.apache.org/solr/ReleaseNote34


On Mon, Sep 12, 2011 at 3:51 PM, Kirill Lykov <ly...@gmail.com>wrote:

> I found that SolrQuery doesn’t work with grouping.
> I constructed SolrQuery this way:
>
> solrQuery = constructFullSearchQuery(searchParams);
> solrQuery.set("group", true);
> solrQuery.set("group.field", "GeonameId");
>
> Solr successfully handles request and writes about that in log:
>
> INFO: [] webapp=/solr path=/select
>
> params={start=1&q=*:*&timeAllowed=1500&group.field=GeonameId&group=true&wt=xml&rows=20&version=2.2}
> hits=12099579 status=0 QTime=2968
>
> The error occurs when SolrJ tries to parse
> XMLResponseParser.processResponse (line 324), where builder stores
> “</lst>”:
>
>        Object val = type.read( builder.toString().trim() );
>        if( val == null && type != KnownType.NULL) {
>          throw new XMLStreamException( "error reading value:"+type,
> parser.getLocation() );
>        }
>        vals.add( val );
>        break;
>
> The problem is - val is null. It happens because handler for the type
> LST returns null(line 178 in the same file):
>
> LST    (false) { @Override public Object read( String txt ) { return null;
> } },
>
> I don’t understand why it works this way. Xml which was returned by
> Solr is valid.
> If any I attached response xml to the letter. The error occures in the
> line 3, column 14 661.
> I use apache solr 3.3.0 and the same SolrJ.
> --
> Best regards,
> Kirill Lykov,
> Software Engineer,
> Data East LLC,
> tel.:+79133816052,
> LinkedIn profile: http://www.linkedin.com/pub/kirill-lykov/12/860/16
>



-- 
Regards,
Sanal Kannappilly Stephen