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 Derek Poh <dp...@globalsources.com> on 2015/03/31 02:43:01 UTC

Collapse and Expand behaviour on result with 1 document.

Hi

I have a query which return 1 document.
When I add the collapse and expand parameters to it, 
"&expand=true&expand.rows=5&fq={!collapse%20field=P_SupplierId}", the 
expanded section is empty (<lst name="expanded"/>).

Is this the behaviour of collapse and expand parameters on result which 
contain only 1 document?

-Derek



Re: Collapse and Expand behaviour on result with 1 document.

Posted by Derek Poh <dp...@globalsources.com>.
There is only 1 document in the main result set.The expanded section is 
empty.


On 3/31/2015 7:37 PM, Joel Bernstein wrote:
> You should be able to use collapse/expand with one result.
>
> Does the document in the main result set have group members that aren't
> being expanded?
>
>
>
> Joel Bernstein
> http://joelsolr.blogspot.com/
>
> On Tue, Mar 31, 2015 at 2:00 AM, Derek Poh <dp...@globalsources.com> wrote:
>
>> If I want to group the results (by a certain field) even if there is only
>> 1 document, I should use the group parameter instead?
>> The requirement is to group the result of product documents by their
>> supplier id.
>> "&group=true&group.field=P_SupplierId&group.limit=5"
>>
>> Is it true that the performance of collapse is better than group parameter
>> on large data set, say 10-20 million documents?
>>
>> -Derek
>>
>>
>> On 3/31/2015 10:03 AM, Joel Bernstein wrote:
>>
>>> The expanded section will only include groups that have expanded
>>> documents.
>>>
>>> So, if the document that in the main result set has no documents to
>>> expand,
>>> then this is working as expected.
>>>
>>>
>>>
>>> Joel Bernstein
>>> http://joelsolr.blogspot.com/
>>>
>>> On Mon, Mar 30, 2015 at 8:43 PM, Derek Poh <dp...@globalsources.com>
>>> wrote:
>>>
>>>   Hi
>>>> I have a query which return 1 document.
>>>> When I add the collapse and expand parameters to it,
>>>> "&expand=true&expand.rows=5&fq={!collapse%20field=P_SupplierId}", the
>>>> expanded section is empty (<lst name="expanded"/>).
>>>>
>>>> Is this the behaviour of collapse and expand parameters on result which
>>>> contain only 1 document?
>>>>
>>>> -Derek
>>>>
>>>>
>>>>
>>>>


Re: Collapse and Expand behaviour on result with 1 document.

Posted by Joel Bernstein <jo...@gmail.com>.
I believe currently issuing another query will be necessary to get the
count of the expanded result set.

I think it does make sense to include this information as part of the
ExpandComponent output. So feel free to create a jira ticket for this and
we should be able to get this into a future release.

Joel Bernstein
http://joelsolr.blogspot.com/

On Tue, Apr 7, 2015 at 3:27 AM, Derek Poh <dp...@globalsources.com> wrote:

> Hi Joel
>
> Is the number of documents info available when using collapse and expand
> parameters?
>
> I can't seem to find it in the return xml.
> I know the numFound in the the main result set (<result
> maxScore="6.470696" name="response" numFound="27" start="0">) refer to the
> number of collapse groups.
>
> I need to issue another query without the collapse and expand parameters
> to get the total number of documents?
> Or is there any fieldor parameter that indicate the number of documents
> that can be return through 'fl' parameter?
>
> I am trying to display such info on the front-end,
>
> 571 "led" results from 240 suppliers.
>
>
>
> On 4/1/2015 7:05 PM, Joel Bernstein wrote:
>
>> Exactly correct.
>>
>> Joel Bernstein
>> http://joelsolr.blogspot.com/
>>
>> On Wed, Apr 1, 2015 at 5:44 AM, Derek Poh <dp...@globalsources.com> wrote:
>>
>>  Hi Joel
>>>
>>> Correct me if my understanding is wrong.
>>> Using supplier id as the field to collapse on.
>>>
>>> - If thecollapse group heads inthe main result set has only 1document in
>>> each group, the expanded section will be empty since there are no
>>> documents
>>> to expandfor each collapse group.
>>> - To render the page, I need to iterate the main result set. For each
>>> document I have to check if there is an expanded group with the same
>>> supplier id.
>>> - The facets counts is based on the number of collapse groupsin the main
>>> result set (<result maxScore="6.470696" name="response" numFound="27"
>>> start="0">)
>>>
>>> -Derek
>>>
>>>
>>> On 3/31/2015 7:43 PM, Joel Bernstein wrote:
>>>
>>>  The way that collapse/expand is designed to be used is as follows:
>>>>
>>>> The main result set will contain the collapsed group heads.
>>>>
>>>> The expanded section will contain the expanded groups for the page of
>>>> results.
>>>>
>>>> To render the page you iterate the main result set. For each document
>>>> check
>>>> to see if there is an expanded group.
>>>>
>>>>
>>>>
>>>>
>>>> Joel Bernstein
>>>> http://joelsolr.blogspot.com/
>>>>
>>>> On Tue, Mar 31, 2015 at 7:37 AM, Joel Bernstein <jo...@gmail.com>
>>>> wrote:
>>>>
>>>>   You should be able to use collapse/expand with one result.
>>>>
>>>>> Does the document in the main result set have group members that aren't
>>>>> being expanded?
>>>>>
>>>>>
>>>>>
>>>>> Joel Bernstein
>>>>> http://joelsolr.blogspot.com/
>>>>>
>>>>> On Tue, Mar 31, 2015 at 2:00 AM, Derek Poh <dp...@globalsources.com>
>>>>> wrote:
>>>>>
>>>>>   If I want to group the results (by a certain field) even if there is
>>>>>
>>>>>> only
>>>>>> 1 document, I should use the group parameter instead?
>>>>>> The requirement is to group the result of product documents by their
>>>>>> supplier id.
>>>>>> "&group=true&group.field=P_SupplierId&group.limit=5"
>>>>>>
>>>>>> Is it true that the performance of collapse is better than group
>>>>>> parameter on large data set, say 10-20 million documents?
>>>>>>
>>>>>> -Derek
>>>>>>
>>>>>>
>>>>>> On 3/31/2015 10:03 AM, Joel Bernstein wrote:
>>>>>>
>>>>>>   The expanded section will only include groups that have expanded
>>>>>>
>>>>>>> documents.
>>>>>>>
>>>>>>> So, if the document that in the main result set has no documents to
>>>>>>> expand,
>>>>>>> then this is working as expected.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Joel Bernstein
>>>>>>> http://joelsolr.blogspot.com/
>>>>>>>
>>>>>>> On Mon, Mar 30, 2015 at 8:43 PM, Derek Poh <dp...@globalsources.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>    Hi
>>>>>>>
>>>>>>>  I have a query which return 1 document.
>>>>>>>> When I add the collapse and expand parameters to it,
>>>>>>>> "&expand=true&expand.rows=5&fq={!collapse%20field=P_SupplierId}",
>>>>>>>> the
>>>>>>>> expanded section is empty (<lst name="expanded"/>).
>>>>>>>>
>>>>>>>> Is this the behaviour of collapse and expand parameters on result
>>>>>>>> which
>>>>>>>> contain only 1 document?
>>>>>>>>
>>>>>>>> -Derek
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>

Re: Collapse and Expand behaviour on result with 1 document.

Posted by Derek Poh <dp...@globalsources.com>.
Hi Joel

Is the number of documents info available when using collapse and expand 
parameters?

I can't seem to find it in the return xml.
I know the numFound in the the main result set (<result 
maxScore="6.470696" name="response" numFound="27" start="0">) refer to 
the number of collapse groups.

I need to issue another query without the collapse and expand parameters 
to get the total number of documents?
Or is there any fieldor parameter that indicate the number of documents 
that can be return through 'fl' parameter?

I am trying to display such info on the front-end,

571 "led" results from 240 suppliers.


On 4/1/2015 7:05 PM, Joel Bernstein wrote:
> Exactly correct.
>
> Joel Bernstein
> http://joelsolr.blogspot.com/
>
> On Wed, Apr 1, 2015 at 5:44 AM, Derek Poh <dp...@globalsources.com> wrote:
>
>> Hi Joel
>>
>> Correct me if my understanding is wrong.
>> Using supplier id as the field to collapse on.
>>
>> - If thecollapse group heads inthe main result set has only 1document in
>> each group, the expanded section will be empty since there are no documents
>> to expandfor each collapse group.
>> - To render the page, I need to iterate the main result set. For each
>> document I have to check if there is an expanded group with the same
>> supplier id.
>> - The facets counts is based on the number of collapse groupsin the main
>> result set (<result maxScore="6.470696" name="response" numFound="27"
>> start="0">)
>>
>> -Derek
>>
>>
>> On 3/31/2015 7:43 PM, Joel Bernstein wrote:
>>
>>> The way that collapse/expand is designed to be used is as follows:
>>>
>>> The main result set will contain the collapsed group heads.
>>>
>>> The expanded section will contain the expanded groups for the page of
>>> results.
>>>
>>> To render the page you iterate the main result set. For each document
>>> check
>>> to see if there is an expanded group.
>>>
>>>
>>>
>>>
>>> Joel Bernstein
>>> http://joelsolr.blogspot.com/
>>>
>>> On Tue, Mar 31, 2015 at 7:37 AM, Joel Bernstein <jo...@gmail.com>
>>> wrote:
>>>
>>>   You should be able to use collapse/expand with one result.
>>>> Does the document in the main result set have group members that aren't
>>>> being expanded?
>>>>
>>>>
>>>>
>>>> Joel Bernstein
>>>> http://joelsolr.blogspot.com/
>>>>
>>>> On Tue, Mar 31, 2015 at 2:00 AM, Derek Poh <dp...@globalsources.com>
>>>> wrote:
>>>>
>>>>   If I want to group the results (by a certain field) even if there is
>>>>> only
>>>>> 1 document, I should use the group parameter instead?
>>>>> The requirement is to group the result of product documents by their
>>>>> supplier id.
>>>>> "&group=true&group.field=P_SupplierId&group.limit=5"
>>>>>
>>>>> Is it true that the performance of collapse is better than group
>>>>> parameter on large data set, say 10-20 million documents?
>>>>>
>>>>> -Derek
>>>>>
>>>>>
>>>>> On 3/31/2015 10:03 AM, Joel Bernstein wrote:
>>>>>
>>>>>   The expanded section will only include groups that have expanded
>>>>>> documents.
>>>>>>
>>>>>> So, if the document that in the main result set has no documents to
>>>>>> expand,
>>>>>> then this is working as expected.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Joel Bernstein
>>>>>> http://joelsolr.blogspot.com/
>>>>>>
>>>>>> On Mon, Mar 30, 2015 at 8:43 PM, Derek Poh <dp...@globalsources.com>
>>>>>> wrote:
>>>>>>
>>>>>>    Hi
>>>>>>
>>>>>>> I have a query which return 1 document.
>>>>>>> When I add the collapse and expand parameters to it,
>>>>>>> "&expand=true&expand.rows=5&fq={!collapse%20field=P_SupplierId}", the
>>>>>>> expanded section is empty (<lst name="expanded"/>).
>>>>>>>
>>>>>>> Is this the behaviour of collapse and expand parameters on result
>>>>>>> which
>>>>>>> contain only 1 document?
>>>>>>>
>>>>>>> -Derek
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>


Re: Collapse and Expand behaviour on result with 1 document.

Posted by Joel Bernstein <jo...@gmail.com>.
Exactly correct.

Joel Bernstein
http://joelsolr.blogspot.com/

On Wed, Apr 1, 2015 at 5:44 AM, Derek Poh <dp...@globalsources.com> wrote:

> Hi Joel
>
> Correct me if my understanding is wrong.
> Using supplier id as the field to collapse on.
>
> - If thecollapse group heads inthe main result set has only 1document in
> each group, the expanded section will be empty since there are no documents
> to expandfor each collapse group.
> - To render the page, I need to iterate the main result set. For each
> document I have to check if there is an expanded group with the same
> supplier id.
> - The facets counts is based on the number of collapse groupsin the main
> result set (<result maxScore="6.470696" name="response" numFound="27"
> start="0">)
>
> -Derek
>
>
> On 3/31/2015 7:43 PM, Joel Bernstein wrote:
>
>> The way that collapse/expand is designed to be used is as follows:
>>
>> The main result set will contain the collapsed group heads.
>>
>> The expanded section will contain the expanded groups for the page of
>> results.
>>
>> To render the page you iterate the main result set. For each document
>> check
>> to see if there is an expanded group.
>>
>>
>>
>>
>> Joel Bernstein
>> http://joelsolr.blogspot.com/
>>
>> On Tue, Mar 31, 2015 at 7:37 AM, Joel Bernstein <jo...@gmail.com>
>> wrote:
>>
>>  You should be able to use collapse/expand with one result.
>>>
>>> Does the document in the main result set have group members that aren't
>>> being expanded?
>>>
>>>
>>>
>>> Joel Bernstein
>>> http://joelsolr.blogspot.com/
>>>
>>> On Tue, Mar 31, 2015 at 2:00 AM, Derek Poh <dp...@globalsources.com>
>>> wrote:
>>>
>>>  If I want to group the results (by a certain field) even if there is
>>>> only
>>>> 1 document, I should use the group parameter instead?
>>>> The requirement is to group the result of product documents by their
>>>> supplier id.
>>>> "&group=true&group.field=P_SupplierId&group.limit=5"
>>>>
>>>> Is it true that the performance of collapse is better than group
>>>> parameter on large data set, say 10-20 million documents?
>>>>
>>>> -Derek
>>>>
>>>>
>>>> On 3/31/2015 10:03 AM, Joel Bernstein wrote:
>>>>
>>>>  The expanded section will only include groups that have expanded
>>>>> documents.
>>>>>
>>>>> So, if the document that in the main result set has no documents to
>>>>> expand,
>>>>> then this is working as expected.
>>>>>
>>>>>
>>>>>
>>>>> Joel Bernstein
>>>>> http://joelsolr.blogspot.com/
>>>>>
>>>>> On Mon, Mar 30, 2015 at 8:43 PM, Derek Poh <dp...@globalsources.com>
>>>>> wrote:
>>>>>
>>>>>   Hi
>>>>>
>>>>>> I have a query which return 1 document.
>>>>>> When I add the collapse and expand parameters to it,
>>>>>> "&expand=true&expand.rows=5&fq={!collapse%20field=P_SupplierId}", the
>>>>>> expanded section is empty (<lst name="expanded"/>).
>>>>>>
>>>>>> Is this the behaviour of collapse and expand parameters on result
>>>>>> which
>>>>>> contain only 1 document?
>>>>>>
>>>>>> -Derek
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>

Re: Collapse and Expand behaviour on result with 1 document.

Posted by Derek Poh <dp...@globalsources.com>.
Hi Joel

Correct me if my understanding is wrong.
Using supplier id as the field to collapse on.

- If thecollapse group heads inthe main result set has only 1document in 
each group, the expanded section will be empty since there are no 
documents to expandfor each collapse group.
- To render the page, I need to iterate the main result set. For each 
document I have to check if there is an expanded group with the same 
supplier id.
- The facets counts is based on the number of collapse groupsin the main 
result set (<result maxScore="6.470696" name="response" numFound="27" 
start="0">)

-Derek

On 3/31/2015 7:43 PM, Joel Bernstein wrote:
> The way that collapse/expand is designed to be used is as follows:
>
> The main result set will contain the collapsed group heads.
>
> The expanded section will contain the expanded groups for the page of
> results.
>
> To render the page you iterate the main result set. For each document check
> to see if there is an expanded group.
>
>
>
>
> Joel Bernstein
> http://joelsolr.blogspot.com/
>
> On Tue, Mar 31, 2015 at 7:37 AM, Joel Bernstein <jo...@gmail.com> wrote:
>
>> You should be able to use collapse/expand with one result.
>>
>> Does the document in the main result set have group members that aren't
>> being expanded?
>>
>>
>>
>> Joel Bernstein
>> http://joelsolr.blogspot.com/
>>
>> On Tue, Mar 31, 2015 at 2:00 AM, Derek Poh <dp...@globalsources.com> wrote:
>>
>>> If I want to group the results (by a certain field) even if there is only
>>> 1 document, I should use the group parameter instead?
>>> The requirement is to group the result of product documents by their
>>> supplier id.
>>> "&group=true&group.field=P_SupplierId&group.limit=5"
>>>
>>> Is it true that the performance of collapse is better than group
>>> parameter on large data set, say 10-20 million documents?
>>>
>>> -Derek
>>>
>>>
>>> On 3/31/2015 10:03 AM, Joel Bernstein wrote:
>>>
>>>> The expanded section will only include groups that have expanded
>>>> documents.
>>>>
>>>> So, if the document that in the main result set has no documents to
>>>> expand,
>>>> then this is working as expected.
>>>>
>>>>
>>>>
>>>> Joel Bernstein
>>>> http://joelsolr.blogspot.com/
>>>>
>>>> On Mon, Mar 30, 2015 at 8:43 PM, Derek Poh <dp...@globalsources.com>
>>>> wrote:
>>>>
>>>>   Hi
>>>>> I have a query which return 1 document.
>>>>> When I add the collapse and expand parameters to it,
>>>>> "&expand=true&expand.rows=5&fq={!collapse%20field=P_SupplierId}", the
>>>>> expanded section is empty (<lst name="expanded"/>).
>>>>>
>>>>> Is this the behaviour of collapse and expand parameters on result which
>>>>> contain only 1 document?
>>>>>
>>>>> -Derek
>>>>>
>>>>>
>>>>>
>>>>>


Re: Collapse and Expand behaviour on result with 1 document.

Posted by Joel Bernstein <jo...@gmail.com>.
The way that collapse/expand is designed to be used is as follows:

The main result set will contain the collapsed group heads.

The expanded section will contain the expanded groups for the page of
results.

To render the page you iterate the main result set. For each document check
to see if there is an expanded group.




Joel Bernstein
http://joelsolr.blogspot.com/

On Tue, Mar 31, 2015 at 7:37 AM, Joel Bernstein <jo...@gmail.com> wrote:

> You should be able to use collapse/expand with one result.
>
> Does the document in the main result set have group members that aren't
> being expanded?
>
>
>
> Joel Bernstein
> http://joelsolr.blogspot.com/
>
> On Tue, Mar 31, 2015 at 2:00 AM, Derek Poh <dp...@globalsources.com> wrote:
>
>> If I want to group the results (by a certain field) even if there is only
>> 1 document, I should use the group parameter instead?
>> The requirement is to group the result of product documents by their
>> supplier id.
>> "&group=true&group.field=P_SupplierId&group.limit=5"
>>
>> Is it true that the performance of collapse is better than group
>> parameter on large data set, say 10-20 million documents?
>>
>> -Derek
>>
>>
>> On 3/31/2015 10:03 AM, Joel Bernstein wrote:
>>
>>> The expanded section will only include groups that have expanded
>>> documents.
>>>
>>> So, if the document that in the main result set has no documents to
>>> expand,
>>> then this is working as expected.
>>>
>>>
>>>
>>> Joel Bernstein
>>> http://joelsolr.blogspot.com/
>>>
>>> On Mon, Mar 30, 2015 at 8:43 PM, Derek Poh <dp...@globalsources.com>
>>> wrote:
>>>
>>>  Hi
>>>>
>>>> I have a query which return 1 document.
>>>> When I add the collapse and expand parameters to it,
>>>> "&expand=true&expand.rows=5&fq={!collapse%20field=P_SupplierId}", the
>>>> expanded section is empty (<lst name="expanded"/>).
>>>>
>>>> Is this the behaviour of collapse and expand parameters on result which
>>>> contain only 1 document?
>>>>
>>>> -Derek
>>>>
>>>>
>>>>
>>>>
>>
>

Re: Collapse and Expand behaviour on result with 1 document.

Posted by Joel Bernstein <jo...@gmail.com>.
You should be able to use collapse/expand with one result.

Does the document in the main result set have group members that aren't
being expanded?



Joel Bernstein
http://joelsolr.blogspot.com/

On Tue, Mar 31, 2015 at 2:00 AM, Derek Poh <dp...@globalsources.com> wrote:

> If I want to group the results (by a certain field) even if there is only
> 1 document, I should use the group parameter instead?
> The requirement is to group the result of product documents by their
> supplier id.
> "&group=true&group.field=P_SupplierId&group.limit=5"
>
> Is it true that the performance of collapse is better than group parameter
> on large data set, say 10-20 million documents?
>
> -Derek
>
>
> On 3/31/2015 10:03 AM, Joel Bernstein wrote:
>
>> The expanded section will only include groups that have expanded
>> documents.
>>
>> So, if the document that in the main result set has no documents to
>> expand,
>> then this is working as expected.
>>
>>
>>
>> Joel Bernstein
>> http://joelsolr.blogspot.com/
>>
>> On Mon, Mar 30, 2015 at 8:43 PM, Derek Poh <dp...@globalsources.com>
>> wrote:
>>
>>  Hi
>>>
>>> I have a query which return 1 document.
>>> When I add the collapse and expand parameters to it,
>>> "&expand=true&expand.rows=5&fq={!collapse%20field=P_SupplierId}", the
>>> expanded section is empty (<lst name="expanded"/>).
>>>
>>> Is this the behaviour of collapse and expand parameters on result which
>>> contain only 1 document?
>>>
>>> -Derek
>>>
>>>
>>>
>>>
>

Re: Collapse and Expand behaviour on result with 1 document.

Posted by Derek Poh <dp...@globalsources.com>.
If I want to group the results (by a certain field) even if there is 
only 1 document, I should use the group parameter instead?
The requirement is to group the result of product documents by their 
supplier id.
"&group=true&group.field=P_SupplierId&group.limit=5"

Is it true that the performance of collapse is better than group 
parameter on large data set, say 10-20 million documents?

-Derek

On 3/31/2015 10:03 AM, Joel Bernstein wrote:
> The expanded section will only include groups that have expanded documents.
>
> So, if the document that in the main result set has no documents to expand,
> then this is working as expected.
>
>
>
> Joel Bernstein
> http://joelsolr.blogspot.com/
>
> On Mon, Mar 30, 2015 at 8:43 PM, Derek Poh <dp...@globalsources.com> wrote:
>
>> Hi
>>
>> I have a query which return 1 document.
>> When I add the collapse and expand parameters to it,
>> "&expand=true&expand.rows=5&fq={!collapse%20field=P_SupplierId}", the
>> expanded section is empty (<lst name="expanded"/>).
>>
>> Is this the behaviour of collapse and expand parameters on result which
>> contain only 1 document?
>>
>> -Derek
>>
>>
>>


Re: Collapse and Expand behaviour on result with 1 document.

Posted by Joel Bernstein <jo...@gmail.com>.
The expanded section will only include groups that have expanded documents.

So, if the document that in the main result set has no documents to expand,
then this is working as expected.



Joel Bernstein
http://joelsolr.blogspot.com/

On Mon, Mar 30, 2015 at 8:43 PM, Derek Poh <dp...@globalsources.com> wrote:

> Hi
>
> I have a query which return 1 document.
> When I add the collapse and expand parameters to it,
> "&expand=true&expand.rows=5&fq={!collapse%20field=P_SupplierId}", the
> expanded section is empty (<lst name="expanded"/>).
>
> Is this the behaviour of collapse and expand parameters on result which
> contain only 1 document?
>
> -Derek
>
>
>