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 beccax <be...@gmail.com> on 2011/06/01 20:56:04 UTC

Newbie question: how to deal with different # of search results per page due to pagination then grouping

Apologize if this question has already been raised.  I tried searching but
couldn't find the relevant posts.

We've indexed a bunch of documents by different authors.  Then for search
results, we'd like to show the authors that have 1 or more documents
matching the search keywords.  

The problem is right now our solr search method first paginates results to
100 documents per page, then we take the results and group by authors.  This
results in different number of authors per page.  (Some authors may only
have one matching document and others 5 or 10.)

How do we change it to somehow show the same number of authors (say 25) per
page?

I mean alternatively we could just show all the documents themselves ordered
by author, but it's not the user experience we're looking for.

Thanks so much.  And please let me know if you need more details not
provided here.
B

--
View this message in context: http://lucene.472066.n3.nabble.com/Newbie-question-how-to-deal-with-different-of-search-results-per-page-due-to-pagination-then-grouping-tp3012168p3012168.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Newbie question: how to deal with different # of search results per page due to pagination then grouping

Posted by Michael Sokolov <so...@ifactory.com>.
Just keep one extra facet value hidden; ie request one more than you 
need to show the current page.  If you get it, there are more (show the 
next button), otherwise there aren't.  You can't page arbitrarily deep 
like this, but you can have a next button reliably enabled or disabled.

On 6/1/2011 5:57 PM, Robert Petersen wrote:
> Yes that is exactly the issue... we're thinking just maybe always have a
> next button and if you go too far you just get zero results.  User gets
> what the user asks for, and so user could simply back up if desired to
> where the facet still has values.  Could also detect an empty facet
> results on the front end.  You can also only expand one facet only to
> allow paging only the facet pane and not the whole page using an ajax
> call.
>
>
>
> -----Original Message-----
> From: Jonathan Rochkind [mailto:rochkind@jhu.edu]
> Sent: Wednesday, June 01, 2011 2:30 PM
> To: solr-user@lucene.apache.org
> Cc: Robert Petersen
> Subject: Re: Newbie question: how to deal with different # of search
> results per page due to pagination then grouping
>
> How do you know whether to provide a 'next' button, or whether you are
> the end of your facet list?
>
> On 6/1/2011 4:47 PM, Robert Petersen wrote:
>> I think facet.offset allows facet paging nicely by letting you index
>> into the list of facet values.  It is working for me...
>>
>> http://wiki.apache.org/solr/SimpleFacetParameters#facet.offset
>>
>>
>> -----Original Message-----
>> From: Jonathan Rochkind [mailto:rochkind@jhu.edu]
>> Sent: Wednesday, June 01, 2011 12:41 PM
>> To: solr-user@lucene.apache.org
>> Subject: Re: Newbie question: how to deal with different # of search
>> results per page due to pagination then grouping
>>
>> There's no great way to do that.
>>
>> One approach would be using facets, but that will just get you the
>> author names (as stored in fields), and not the documents under it. If
>> you really only want to show the author names, facets could work. One
>> issue with facets though is Solr won't tell you the total number of
>> facet values for your query, so it's tricky to provide next/prev
> paging
>> through them.
>>
>> There is also a 'field collapsing' feature that I think is not in a
>> released Solr, but may be in the Solr repo. I'm not sure it will quite
>> do what you want either though, although it's related and worth a
> look.
>> http://wiki.apache.org/solr/FieldCollapsing
>>
>> Another vaguely related thing that is also not yet in a released Solr,
>> is a 'join' function. That could possibly be used to do what you want,
>> although it'd be tricky too.
>> https://issues.apache.org/jira/browse/SOLR-2272
>>
>> Jonathan
>>
>> On 6/1/2011 2:56 PM, beccax wrote:
>>> Apologize if this question has already been raised.  I tried
> searching
>> but
>>> couldn't find the relevant posts.
>>>
>>> We've indexed a bunch of documents by different authors.  Then for
>> search
>>> results, we'd like to show the authors that have 1 or more documents
>>> matching the search keywords.
>>>
>>> The problem is right now our solr search method first paginates
>> results to
>>> 100 documents per page, then we take the results and group by
> authors.
>> This
>>> results in different number of authors per page.  (Some authors may
>> only
>>> have one matching document and others 5 or 10.)
>>>
>>> How do we change it to somehow show the same number of authors (say
>> 25) per
>>> page?
>>>
>>> I mean alternatively we could just show all the documents themselves
>> ordered
>>> by author, but it's not the user experience we're looking for.
>>>
>>> Thanks so much.  And please let me know if you need more details not
>>> provided here.
>>> B
>>>
>>> --
>>> View this message in context:
> http://lucene.472066.n3.nabble.com/Newbie-question-how-to-deal-with-diff
> erent-of-search-results-per-page-due-to-pagination-then-grouping-tp30121
>> 68p3012168.html
>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>


RE: Newbie question: how to deal with different # of search results per page due to pagination then grouping

Posted by Robert Petersen <ro...@buy.com>.
Yes that is exactly the issue... we're thinking just maybe always have a
next button and if you go too far you just get zero results.  User gets
what the user asks for, and so user could simply back up if desired to
where the facet still has values.  Could also detect an empty facet
results on the front end.  You can also only expand one facet only to
allow paging only the facet pane and not the whole page using an ajax
call.



-----Original Message-----
From: Jonathan Rochkind [mailto:rochkind@jhu.edu] 
Sent: Wednesday, June 01, 2011 2:30 PM
To: solr-user@lucene.apache.org
Cc: Robert Petersen
Subject: Re: Newbie question: how to deal with different # of search
results per page due to pagination then grouping

How do you know whether to provide a 'next' button, or whether you are 
the end of your facet list?

On 6/1/2011 4:47 PM, Robert Petersen wrote:
> I think facet.offset allows facet paging nicely by letting you index
> into the list of facet values.  It is working for me...
>
> http://wiki.apache.org/solr/SimpleFacetParameters#facet.offset
>
>
> -----Original Message-----
> From: Jonathan Rochkind [mailto:rochkind@jhu.edu]
> Sent: Wednesday, June 01, 2011 12:41 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Newbie question: how to deal with different # of search
> results per page due to pagination then grouping
>
> There's no great way to do that.
>
> One approach would be using facets, but that will just get you the
> author names (as stored in fields), and not the documents under it. If
> you really only want to show the author names, facets could work. One
> issue with facets though is Solr won't tell you the total number of
> facet values for your query, so it's tricky to provide next/prev
paging
> through them.
>
> There is also a 'field collapsing' feature that I think is not in a
> released Solr, but may be in the Solr repo. I'm not sure it will quite
> do what you want either though, although it's related and worth a
look.
> http://wiki.apache.org/solr/FieldCollapsing
>
> Another vaguely related thing that is also not yet in a released Solr,
> is a 'join' function. That could possibly be used to do what you want,
> although it'd be tricky too.
> https://issues.apache.org/jira/browse/SOLR-2272
>
> Jonathan
>
> On 6/1/2011 2:56 PM, beccax wrote:
>> Apologize if this question has already been raised.  I tried
searching
> but
>> couldn't find the relevant posts.
>>
>> We've indexed a bunch of documents by different authors.  Then for
> search
>> results, we'd like to show the authors that have 1 or more documents
>> matching the search keywords.
>>
>> The problem is right now our solr search method first paginates
> results to
>> 100 documents per page, then we take the results and group by
authors.
> This
>> results in different number of authors per page.  (Some authors may
> only
>> have one matching document and others 5 or 10.)
>>
>> How do we change it to somehow show the same number of authors (say
> 25) per
>> page?
>>
>> I mean alternatively we could just show all the documents themselves
> ordered
>> by author, but it's not the user experience we're looking for.
>>
>> Thanks so much.  And please let me know if you need more details not
>> provided here.
>> B
>>
>> --
>> View this message in context:
>
http://lucene.472066.n3.nabble.com/Newbie-question-how-to-deal-with-diff
>
erent-of-search-results-per-page-due-to-pagination-then-grouping-tp30121
> 68p3012168.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>

Re: Newbie question: how to deal with different # of search results per page due to pagination then grouping

Posted by Jonathan Rochkind <ro...@jhu.edu>.
How do you know whether to provide a 'next' button, or whether you are 
the end of your facet list?

On 6/1/2011 4:47 PM, Robert Petersen wrote:
> I think facet.offset allows facet paging nicely by letting you index
> into the list of facet values.  It is working for me...
>
> http://wiki.apache.org/solr/SimpleFacetParameters#facet.offset
>
>
> -----Original Message-----
> From: Jonathan Rochkind [mailto:rochkind@jhu.edu]
> Sent: Wednesday, June 01, 2011 12:41 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Newbie question: how to deal with different # of search
> results per page due to pagination then grouping
>
> There's no great way to do that.
>
> One approach would be using facets, but that will just get you the
> author names (as stored in fields), and not the documents under it. If
> you really only want to show the author names, facets could work. One
> issue with facets though is Solr won't tell you the total number of
> facet values for your query, so it's tricky to provide next/prev paging
> through them.
>
> There is also a 'field collapsing' feature that I think is not in a
> released Solr, but may be in the Solr repo. I'm not sure it will quite
> do what you want either though, although it's related and worth a look.
> http://wiki.apache.org/solr/FieldCollapsing
>
> Another vaguely related thing that is also not yet in a released Solr,
> is a 'join' function. That could possibly be used to do what you want,
> although it'd be tricky too.
> https://issues.apache.org/jira/browse/SOLR-2272
>
> Jonathan
>
> On 6/1/2011 2:56 PM, beccax wrote:
>> Apologize if this question has already been raised.  I tried searching
> but
>> couldn't find the relevant posts.
>>
>> We've indexed a bunch of documents by different authors.  Then for
> search
>> results, we'd like to show the authors that have 1 or more documents
>> matching the search keywords.
>>
>> The problem is right now our solr search method first paginates
> results to
>> 100 documents per page, then we take the results and group by authors.
> This
>> results in different number of authors per page.  (Some authors may
> only
>> have one matching document and others 5 or 10.)
>>
>> How do we change it to somehow show the same number of authors (say
> 25) per
>> page?
>>
>> I mean alternatively we could just show all the documents themselves
> ordered
>> by author, but it's not the user experience we're looking for.
>>
>> Thanks so much.  And please let me know if you need more details not
>> provided here.
>> B
>>
>> --
>> View this message in context:
> http://lucene.472066.n3.nabble.com/Newbie-question-how-to-deal-with-diff
> erent-of-search-results-per-page-due-to-pagination-then-grouping-tp30121
> 68p3012168.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>

RE: Newbie question: how to deal with different # of search results per page due to pagination then grouping

Posted by Robert Petersen <ro...@buy.com>.
I think facet.offset allows facet paging nicely by letting you index
into the list of facet values.  It is working for me...

http://wiki.apache.org/solr/SimpleFacetParameters#facet.offset


-----Original Message-----
From: Jonathan Rochkind [mailto:rochkind@jhu.edu] 
Sent: Wednesday, June 01, 2011 12:41 PM
To: solr-user@lucene.apache.org
Subject: Re: Newbie question: how to deal with different # of search
results per page due to pagination then grouping

There's no great way to do that.

One approach would be using facets, but that will just get you the 
author names (as stored in fields), and not the documents under it. If 
you really only want to show the author names, facets could work. One 
issue with facets though is Solr won't tell you the total number of 
facet values for your query, so it's tricky to provide next/prev paging 
through them.

There is also a 'field collapsing' feature that I think is not in a 
released Solr, but may be in the Solr repo. I'm not sure it will quite 
do what you want either though, although it's related and worth a look. 
http://wiki.apache.org/solr/FieldCollapsing

Another vaguely related thing that is also not yet in a released Solr, 
is a 'join' function. That could possibly be used to do what you want, 
although it'd be tricky too.
https://issues.apache.org/jira/browse/SOLR-2272

Jonathan

On 6/1/2011 2:56 PM, beccax wrote:
> Apologize if this question has already been raised.  I tried searching
but
> couldn't find the relevant posts.
>
> We've indexed a bunch of documents by different authors.  Then for
search
> results, we'd like to show the authors that have 1 or more documents
> matching the search keywords.
>
> The problem is right now our solr search method first paginates
results to
> 100 documents per page, then we take the results and group by authors.
This
> results in different number of authors per page.  (Some authors may
only
> have one matching document and others 5 or 10.)
>
> How do we change it to somehow show the same number of authors (say
25) per
> page?
>
> I mean alternatively we could just show all the documents themselves
ordered
> by author, but it's not the user experience we're looking for.
>
> Thanks so much.  And please let me know if you need more details not
> provided here.
> B
>
> --
> View this message in context:
http://lucene.472066.n3.nabble.com/Newbie-question-how-to-deal-with-diff
erent-of-search-results-per-page-due-to-pagination-then-grouping-tp30121
68p3012168.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Newbie question: how to deal with different # of search results per page due to pagination then grouping

Posted by Jonathan Rochkind <ro...@jhu.edu>.
There's no great way to do that.

One approach would be using facets, but that will just get you the 
author names (as stored in fields), and not the documents under it. If 
you really only want to show the author names, facets could work. One 
issue with facets though is Solr won't tell you the total number of 
facet values for your query, so it's tricky to provide next/prev paging 
through them.

There is also a 'field collapsing' feature that I think is not in a 
released Solr, but may be in the Solr repo. I'm not sure it will quite 
do what you want either though, although it's related and worth a look. 
http://wiki.apache.org/solr/FieldCollapsing

Another vaguely related thing that is also not yet in a released Solr, 
is a 'join' function. That could possibly be used to do what you want, 
although it'd be tricky too. https://issues.apache.org/jira/browse/SOLR-2272

Jonathan

On 6/1/2011 2:56 PM, beccax wrote:
> Apologize if this question has already been raised.  I tried searching but
> couldn't find the relevant posts.
>
> We've indexed a bunch of documents by different authors.  Then for search
> results, we'd like to show the authors that have 1 or more documents
> matching the search keywords.
>
> The problem is right now our solr search method first paginates results to
> 100 documents per page, then we take the results and group by authors.  This
> results in different number of authors per page.  (Some authors may only
> have one matching document and others 5 or 10.)
>
> How do we change it to somehow show the same number of authors (say 25) per
> page?
>
> I mean alternatively we could just show all the documents themselves ordered
> by author, but it's not the user experience we're looking for.
>
> Thanks so much.  And please let me know if you need more details not
> provided here.
> B
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Newbie-question-how-to-deal-with-different-of-search-results-per-page-due-to-pagination-then-grouping-tp3012168p3012168.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

RE: Newbie question: how to deal with different # of search results per page due to pagination then grouping

Posted by Robert Petersen <ro...@buy.com>.
Don't manually group by author from your results, the list will always
be incomplete...  use faceting instead to show the authors of the books
you have found in your search.

http://wiki.apache.org/solr/SolrFacetingOverview

-----Original Message-----
From: beccax [mailto:beccax@gmail.com] 
Sent: Wednesday, June 01, 2011 11:56 AM
To: solr-user@lucene.apache.org
Subject: Newbie question: how to deal with different # of search results
per page due to pagination then grouping

Apologize if this question has already been raised.  I tried searching
but
couldn't find the relevant posts.

We've indexed a bunch of documents by different authors.  Then for
search
results, we'd like to show the authors that have 1 or more documents
matching the search keywords.  

The problem is right now our solr search method first paginates results
to
100 documents per page, then we take the results and group by authors.
This
results in different number of authors per page.  (Some authors may only
have one matching document and others 5 or 10.)

How do we change it to somehow show the same number of authors (say 25)
per
page?

I mean alternatively we could just show all the documents themselves
ordered
by author, but it's not the user experience we're looking for.

Thanks so much.  And please let me know if you need more details not
provided here.
B

--
View this message in context:
http://lucene.472066.n3.nabble.com/Newbie-question-how-to-deal-with-diff
erent-of-search-results-per-page-due-to-pagination-then-grouping-tp30121
68p3012168.html
Sent from the Solr - User mailing list archive at Nabble.com.