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 Zheng Lin Edwin Yeo <ed...@gmail.com> on 2017/02/17 04:00:08 UTC

Select TOP 10 items from Solr Query

Hi,

Would like to check, is it possible to do a select of say TOP 10 items from
Solr query, and use the list of the items to do another query (Eg: JSON
Facet)?

Currently, I'm using a normal facet to retrieve the list of the TOP 10 item
from the normal faceting.
After which, I have to list out all the 10 items as a filter when I do the
JSON Facet like this
q=itemNo:(001 002 003 004 005 006 007 008 009 010)

It will help if I can combine both of this into a single query.

I'm using Solr 6.4.1

Regards,
Edwin

Re: Select TOP 10 items from Solr Query

Posted by Zheng Lin Edwin Yeo <ed...@gmail.com>.
I'm fetching the data for the top 10, and pass them to the JSON Facet query
to do the calculation.

The 100 items is just an example. Some of my collections can have more than
10 million records.

Regards,
Edwin


On 17 February 2017 at 20:51, Michael Kuhlmann <ku...@solr.info> wrote:

> It's not possible to do such thing in one request with faceting only.
> The problem is that you need a fixed filter on every item when the facet
> algorithm is iterating over it; you can't look into future elements to
> find out which ones the top 10 will be.
>
> So either you stick with two queries (which may be fast enough anyway
> when you only have ca. 100 items in your collection), or you fetch the
> data for the top 10 items and do the calculation on your own.
>
> -Michael
>
> Am 17.02.2017 um 11:35 schrieb Zheng Lin Edwin Yeo:
> > I'm looking at JSON facet for both of type:terms and type:range.
> >
> > For example, I may have 100 Items in my collections, and each item can
> have
> > many transactions. But I'm only interested to look at the top 10 items
> > which has the highest transaction rate (ie the highest count)
> >
> > I'm doing a calculation of the total amount and average amount. However,
> I
> > will only want the total amount and average amount to be calculated based
> > on the top 10 items which has the highest transaction rate, and not all
> the
> > 100 items.
> >
> > For now, I need the additional query to get the top 10 items first,
> before
> > I run the JSON Facet to get the total amount and average amount for that
> 10
> > items.
> >
> > Regards,
> > Edwin
> >
> >
> > On 17 February 2017 at 18:02, alessandro.benedetti <a.benedetti@sease.io
> >
> > wrote:
> >
> >> I think we are missing something here ...
> >> You want to fetch the top 10 results for your query, and allow the user
> to
> >> navigate only those 10 results through facets ?
> >>
> >> Which facets are you interested in ?
> >> Field facets ?
> >> Whatever facet you want, calculating it in your client, on 10 results
> >> shouldn't be that problematic.
> >> Are we missing something ? Why you would need an additional query ?
> >>
> >> Cheers
> >>
> >>
> >>
> >> -----
> >> ---------------
> >> Alessandro Benedetti
> >> Search Consultant, R&D Software Engineer, Director
> >> Sease Ltd. - www.sease.io
> >> --
> >> View this message in context: http://lucene.472066.n3.
> >> nabble.com/Select-TOP-10-items-from-Solr-Query-tp4320863p4320910.html
> >> Sent from the Solr - User mailing list archive at Nabble.com.
> >>
>
>

Re: Select TOP 10 items from Solr Query

Posted by Michael Kuhlmann <ku...@solr.info>.
It's not possible to do such thing in one request with faceting only.
The problem is that you need a fixed filter on every item when the facet
algorithm is iterating over it; you can't look into future elements to
find out which ones the top 10 will be.

So either you stick with two queries (which may be fast enough anyway
when you only have ca. 100 items in your collection), or you fetch the
data for the top 10 items and do the calculation on your own.

-Michael

Am 17.02.2017 um 11:35 schrieb Zheng Lin Edwin Yeo:
> I'm looking at JSON facet for both of type:terms and type:range.
>
> For example, I may have 100 Items in my collections, and each item can have
> many transactions. But I'm only interested to look at the top 10 items
> which has the highest transaction rate (ie the highest count)
>
> I'm doing a calculation of the total amount and average amount. However, I
> will only want the total amount and average amount to be calculated based
> on the top 10 items which has the highest transaction rate, and not all the
> 100 items.
>
> For now, I need the additional query to get the top 10 items first, before
> I run the JSON Facet to get the total amount and average amount for that 10
> items.
>
> Regards,
> Edwin
>
>
> On 17 February 2017 at 18:02, alessandro.benedetti <a....@sease.io>
> wrote:
>
>> I think we are missing something here ...
>> You want to fetch the top 10 results for your query, and allow the user to
>> navigate only those 10 results through facets ?
>>
>> Which facets are you interested in ?
>> Field facets ?
>> Whatever facet you want, calculating it in your client, on 10 results
>> shouldn't be that problematic.
>> Are we missing something ? Why you would need an additional query ?
>>
>> Cheers
>>
>>
>>
>> -----
>> ---------------
>> Alessandro Benedetti
>> Search Consultant, R&D Software Engineer, Director
>> Sease Ltd. - www.sease.io
>> --
>> View this message in context: http://lucene.472066.n3.
>> nabble.com/Select-TOP-10-items-from-Solr-Query-tp4320863p4320910.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>


Re: Select TOP 10 items from Solr Query

Posted by Zheng Lin Edwin Yeo <ed...@gmail.com>.
Hi Emir,

Thanks for your suggestion.
This should meet my current needs.

Regards,
Edwin


On 20 February 2017 at 18:22, Emir Arnautovic <em...@sematext.com>
wrote:

> Json facets also have subfacets: http://yonik.com/solr-subfacets/ (check
> if something changed in version that you use)
>
> Emir
>
>
>
> On 20.02.2017 10:42, Zheng Lin Edwin Yeo wrote:
>
>> Hi Emir,
>>
>> Thanks for your suggestion.
>> But I'm not sure if this could work, as I'm using JSON Facet and not the
>> normal faceting.
>>
>> Regards,
>> Edwin
>>
>>
>> On 20 February 2017 at 17:24, Emir Arnautovic <
>> emir.arnautovic@sematext.com>
>> wrote:
>>
>> Hi Edwin,
>>>
>>> I am also bit confused but, it seems to me that you could achieve what
>>> you
>>> need with pivot faceting: https://cwiki.apache.org/confl
>>> uence/display/solr/Faceting#Faceting-Pivot(DecisionTree)Faceting
>>>
>>> HTH,
>>> Emir
>>>
>>>
>>>
>>> On 18.02.2017 08:46, Zheng Lin Edwin Yeo wrote:
>>>
>>> Although I have nested documents in the schema, but if not looking for
>>>> top
>>>> 10 parents to facet on children.
>>>>
>>>> Currently, I'm only working on the information that is available in
>>>> children. In my case, each line represents a transaction, and I'm doing
>>>> the
>>>> faceting based on these individual transaction.
>>>>
>>>> Regards,
>>>> Edwin
>>>>
>>>>
>>>> On 17 February 2017 at 22:10, Alexandre Rafalovitch <arafalov@gmail.com
>>>> >
>>>> wrote:
>>>>
>>>> Am I missing something or do you have nested documents in the schema?
>>>>
>>>>> It reads like you looking for top 10 parents and then want to facet on
>>>>> children. Is that right?
>>>>>
>>>>> Regards,
>>>>>      Alex
>>>>>
>>>>> On 17 Feb 2017 5:35 AM, "Zheng Lin Edwin Yeo" <ed...@gmail.com>
>>>>> wrote:
>>>>>
>>>>> I'm looking at JSON facet for both of type:terms and type:range.
>>>>>
>>>>> For example, I may have 100 Items in my collections, and each item can
>>>>> have
>>>>> many transactions. But I'm only interested to look at the top 10 items
>>>>> which has the highest transaction rate (ie the highest count)
>>>>>
>>>>> I'm doing a calculation of the total amount and average amount.
>>>>> However,
>>>>> I
>>>>> will only want the total amount and average amount to be calculated
>>>>> based
>>>>> on the top 10 items which has the highest transaction rate, and not all
>>>>> the
>>>>> 100 items.
>>>>>
>>>>> For now, I need the additional query to get the top 10 items first,
>>>>> before
>>>>> I run the JSON Facet to get the total amount and average amount for
>>>>> that
>>>>> 10
>>>>> items.
>>>>>
>>>>> Regards,
>>>>> Edwin
>>>>>
>>>>>
>>>>> On 17 February 2017 at 18:02, alessandro.benedetti <
>>>>> a.benedetti@sease.io
>>>>> wrote:
>>>>>
>>>>> I think we are missing something here ...
>>>>>
>>>>>> You want to fetch the top 10 results for your query, and allow the
>>>>>> user
>>>>>>
>>>>>> to
>>>>>
>>>>> navigate only those 10 results through facets ?
>>>>>>
>>>>>> Which facets are you interested in ?
>>>>>> Field facets ?
>>>>>> Whatever facet you want, calculating it in your client, on 10 results
>>>>>> shouldn't be that problematic.
>>>>>> Are we missing something ? Why you would need an additional query ?
>>>>>>
>>>>>> Cheers
>>>>>>
>>>>>>
>>>>>>
>>>>>> -----
>>>>>> ---------------
>>>>>> Alessandro Benedetti
>>>>>> Search Consultant, R&D Software Engineer, Director
>>>>>> Sease Ltd. - www.sease.io
>>>>>> --
>>>>>> View this message in context: http://lucene.472066.n3.
>>>>>> nabble.com/Select-TOP-10-items-from-Solr-Query-tp4320863p4320910.html
>>>>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>> --
>>> Monitoring * Alerting * Anomaly Detection * Centralized Log Management
>>> Solr & Elasticsearch Support * http://sematext.com/
>>>
>>>
>>>
> --
> Monitoring * Alerting * Anomaly Detection * Centralized Log Management
> Solr & Elasticsearch Support * http://sematext.com/
>
>

Re: Select TOP 10 items from Solr Query

Posted by Emir Arnautovic <em...@sematext.com>.
Json facets also have subfacets: http://yonik.com/solr-subfacets/ (check 
if something changed in version that you use)

Emir


On 20.02.2017 10:42, Zheng Lin Edwin Yeo wrote:
> Hi Emir,
>
> Thanks for your suggestion.
> But I'm not sure if this could work, as I'm using JSON Facet and not the
> normal faceting.
>
> Regards,
> Edwin
>
>
> On 20 February 2017 at 17:24, Emir Arnautovic <em...@sematext.com>
> wrote:
>
>> Hi Edwin,
>>
>> I am also bit confused but, it seems to me that you could achieve what you
>> need with pivot faceting: https://cwiki.apache.org/confl
>> uence/display/solr/Faceting#Faceting-Pivot(DecisionTree)Faceting
>>
>> HTH,
>> Emir
>>
>>
>>
>> On 18.02.2017 08:46, Zheng Lin Edwin Yeo wrote:
>>
>>> Although I have nested documents in the schema, but if not looking for top
>>> 10 parents to facet on children.
>>>
>>> Currently, I'm only working on the information that is available in
>>> children. In my case, each line represents a transaction, and I'm doing
>>> the
>>> faceting based on these individual transaction.
>>>
>>> Regards,
>>> Edwin
>>>
>>>
>>> On 17 February 2017 at 22:10, Alexandre Rafalovitch <ar...@gmail.com>
>>> wrote:
>>>
>>> Am I missing something or do you have nested documents in the schema?
>>>> It reads like you looking for top 10 parents and then want to facet on
>>>> children. Is that right?
>>>>
>>>> Regards,
>>>>      Alex
>>>>
>>>> On 17 Feb 2017 5:35 AM, "Zheng Lin Edwin Yeo" <ed...@gmail.com>
>>>> wrote:
>>>>
>>>> I'm looking at JSON facet for both of type:terms and type:range.
>>>>
>>>> For example, I may have 100 Items in my collections, and each item can
>>>> have
>>>> many transactions. But I'm only interested to look at the top 10 items
>>>> which has the highest transaction rate (ie the highest count)
>>>>
>>>> I'm doing a calculation of the total amount and average amount. However,
>>>> I
>>>> will only want the total amount and average amount to be calculated based
>>>> on the top 10 items which has the highest transaction rate, and not all
>>>> the
>>>> 100 items.
>>>>
>>>> For now, I need the additional query to get the top 10 items first,
>>>> before
>>>> I run the JSON Facet to get the total amount and average amount for that
>>>> 10
>>>> items.
>>>>
>>>> Regards,
>>>> Edwin
>>>>
>>>>
>>>> On 17 February 2017 at 18:02, alessandro.benedetti <a.benedetti@sease.io
>>>> wrote:
>>>>
>>>> I think we are missing something here ...
>>>>> You want to fetch the top 10 results for your query, and allow the user
>>>>>
>>>> to
>>>>
>>>>> navigate only those 10 results through facets ?
>>>>>
>>>>> Which facets are you interested in ?
>>>>> Field facets ?
>>>>> Whatever facet you want, calculating it in your client, on 10 results
>>>>> shouldn't be that problematic.
>>>>> Are we missing something ? Why you would need an additional query ?
>>>>>
>>>>> Cheers
>>>>>
>>>>>
>>>>>
>>>>> -----
>>>>> ---------------
>>>>> Alessandro Benedetti
>>>>> Search Consultant, R&D Software Engineer, Director
>>>>> Sease Ltd. - www.sease.io
>>>>> --
>>>>> View this message in context: http://lucene.472066.n3.
>>>>> nabble.com/Select-TOP-10-items-from-Solr-Query-tp4320863p4320910.html
>>>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>> --
>> Monitoring * Alerting * Anomaly Detection * Centralized Log Management
>> Solr & Elasticsearch Support * http://sematext.com/
>>
>>

-- 
Monitoring * Alerting * Anomaly Detection * Centralized Log Management
Solr & Elasticsearch Support * http://sematext.com/


Re: Select TOP 10 items from Solr Query

Posted by Zheng Lin Edwin Yeo <ed...@gmail.com>.
Hi Emir,

Thanks for your suggestion.
But I'm not sure if this could work, as I'm using JSON Facet and not the
normal faceting.

Regards,
Edwin


On 20 February 2017 at 17:24, Emir Arnautovic <em...@sematext.com>
wrote:

> Hi Edwin,
>
> I am also bit confused but, it seems to me that you could achieve what you
> need with pivot faceting: https://cwiki.apache.org/confl
> uence/display/solr/Faceting#Faceting-Pivot(DecisionTree)Faceting
>
> HTH,
> Emir
>
>
>
> On 18.02.2017 08:46, Zheng Lin Edwin Yeo wrote:
>
>> Although I have nested documents in the schema, but if not looking for top
>> 10 parents to facet on children.
>>
>> Currently, I'm only working on the information that is available in
>> children. In my case, each line represents a transaction, and I'm doing
>> the
>> faceting based on these individual transaction.
>>
>> Regards,
>> Edwin
>>
>>
>> On 17 February 2017 at 22:10, Alexandre Rafalovitch <ar...@gmail.com>
>> wrote:
>>
>> Am I missing something or do you have nested documents in the schema?
>>>
>>> It reads like you looking for top 10 parents and then want to facet on
>>> children. Is that right?
>>>
>>> Regards,
>>>     Alex
>>>
>>> On 17 Feb 2017 5:35 AM, "Zheng Lin Edwin Yeo" <ed...@gmail.com>
>>> wrote:
>>>
>>> I'm looking at JSON facet for both of type:terms and type:range.
>>>
>>> For example, I may have 100 Items in my collections, and each item can
>>> have
>>> many transactions. But I'm only interested to look at the top 10 items
>>> which has the highest transaction rate (ie the highest count)
>>>
>>> I'm doing a calculation of the total amount and average amount. However,
>>> I
>>> will only want the total amount and average amount to be calculated based
>>> on the top 10 items which has the highest transaction rate, and not all
>>> the
>>> 100 items.
>>>
>>> For now, I need the additional query to get the top 10 items first,
>>> before
>>> I run the JSON Facet to get the total amount and average amount for that
>>> 10
>>> items.
>>>
>>> Regards,
>>> Edwin
>>>
>>>
>>> On 17 February 2017 at 18:02, alessandro.benedetti <a.benedetti@sease.io
>>> >
>>> wrote:
>>>
>>> I think we are missing something here ...
>>>> You want to fetch the top 10 results for your query, and allow the user
>>>>
>>> to
>>>
>>>> navigate only those 10 results through facets ?
>>>>
>>>> Which facets are you interested in ?
>>>> Field facets ?
>>>> Whatever facet you want, calculating it in your client, on 10 results
>>>> shouldn't be that problematic.
>>>> Are we missing something ? Why you would need an additional query ?
>>>>
>>>> Cheers
>>>>
>>>>
>>>>
>>>> -----
>>>> ---------------
>>>> Alessandro Benedetti
>>>> Search Consultant, R&D Software Engineer, Director
>>>> Sease Ltd. - www.sease.io
>>>> --
>>>> View this message in context: http://lucene.472066.n3.
>>>> nabble.com/Select-TOP-10-items-from-Solr-Query-tp4320863p4320910.html
>>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>>
>>>>
> --
> Monitoring * Alerting * Anomaly Detection * Centralized Log Management
> Solr & Elasticsearch Support * http://sematext.com/
>
>

Re: Select TOP 10 items from Solr Query

Posted by Emir Arnautovic <em...@sematext.com>.
Hi Edwin,

I am also bit confused but, it seems to me that you could achieve what 
you need with pivot faceting: 
https://cwiki.apache.org/confluence/display/solr/Faceting#Faceting-Pivot(DecisionTree)Faceting

HTH,
Emir


On 18.02.2017 08:46, Zheng Lin Edwin Yeo wrote:
> Although I have nested documents in the schema, but if not looking for top
> 10 parents to facet on children.
>
> Currently, I'm only working on the information that is available in
> children. In my case, each line represents a transaction, and I'm doing the
> faceting based on these individual transaction.
>
> Regards,
> Edwin
>
>
> On 17 February 2017 at 22:10, Alexandre Rafalovitch <ar...@gmail.com>
> wrote:
>
>> Am I missing something or do you have nested documents in the schema?
>>
>> It reads like you looking for top 10 parents and then want to facet on
>> children. Is that right?
>>
>> Regards,
>>     Alex
>>
>> On 17 Feb 2017 5:35 AM, "Zheng Lin Edwin Yeo" <ed...@gmail.com>
>> wrote:
>>
>> I'm looking at JSON facet for both of type:terms and type:range.
>>
>> For example, I may have 100 Items in my collections, and each item can have
>> many transactions. But I'm only interested to look at the top 10 items
>> which has the highest transaction rate (ie the highest count)
>>
>> I'm doing a calculation of the total amount and average amount. However, I
>> will only want the total amount and average amount to be calculated based
>> on the top 10 items which has the highest transaction rate, and not all the
>> 100 items.
>>
>> For now, I need the additional query to get the top 10 items first, before
>> I run the JSON Facet to get the total amount and average amount for that 10
>> items.
>>
>> Regards,
>> Edwin
>>
>>
>> On 17 February 2017 at 18:02, alessandro.benedetti <a....@sease.io>
>> wrote:
>>
>>> I think we are missing something here ...
>>> You want to fetch the top 10 results for your query, and allow the user
>> to
>>> navigate only those 10 results through facets ?
>>>
>>> Which facets are you interested in ?
>>> Field facets ?
>>> Whatever facet you want, calculating it in your client, on 10 results
>>> shouldn't be that problematic.
>>> Are we missing something ? Why you would need an additional query ?
>>>
>>> Cheers
>>>
>>>
>>>
>>> -----
>>> ---------------
>>> Alessandro Benedetti
>>> Search Consultant, R&D Software Engineer, Director
>>> Sease Ltd. - www.sease.io
>>> --
>>> View this message in context: http://lucene.472066.n3.
>>> nabble.com/Select-TOP-10-items-from-Solr-Query-tp4320863p4320910.html
>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>

-- 
Monitoring * Alerting * Anomaly Detection * Centralized Log Management
Solr & Elasticsearch Support * http://sematext.com/


Re: Select TOP 10 items from Solr Query

Posted by Zheng Lin Edwin Yeo <ed...@gmail.com>.
Although I have nested documents in the schema, but if not looking for top
10 parents to facet on children.

Currently, I'm only working on the information that is available in
children. In my case, each line represents a transaction, and I'm doing the
faceting based on these individual transaction.

Regards,
Edwin


On 17 February 2017 at 22:10, Alexandre Rafalovitch <ar...@gmail.com>
wrote:

> Am I missing something or do you have nested documents in the schema?
>
> It reads like you looking for top 10 parents and then want to facet on
> children. Is that right?
>
> Regards,
>    Alex
>
> On 17 Feb 2017 5:35 AM, "Zheng Lin Edwin Yeo" <ed...@gmail.com>
> wrote:
>
> I'm looking at JSON facet for both of type:terms and type:range.
>
> For example, I may have 100 Items in my collections, and each item can have
> many transactions. But I'm only interested to look at the top 10 items
> which has the highest transaction rate (ie the highest count)
>
> I'm doing a calculation of the total amount and average amount. However, I
> will only want the total amount and average amount to be calculated based
> on the top 10 items which has the highest transaction rate, and not all the
> 100 items.
>
> For now, I need the additional query to get the top 10 items first, before
> I run the JSON Facet to get the total amount and average amount for that 10
> items.
>
> Regards,
> Edwin
>
>
> On 17 February 2017 at 18:02, alessandro.benedetti <a....@sease.io>
> wrote:
>
> > I think we are missing something here ...
> > You want to fetch the top 10 results for your query, and allow the user
> to
> > navigate only those 10 results through facets ?
> >
> > Which facets are you interested in ?
> > Field facets ?
> > Whatever facet you want, calculating it in your client, on 10 results
> > shouldn't be that problematic.
> > Are we missing something ? Why you would need an additional query ?
> >
> > Cheers
> >
> >
> >
> > -----
> > ---------------
> > Alessandro Benedetti
> > Search Consultant, R&D Software Engineer, Director
> > Sease Ltd. - www.sease.io
> > --
> > View this message in context: http://lucene.472066.n3.
> > nabble.com/Select-TOP-10-items-from-Solr-Query-tp4320863p4320910.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
> >
>

Re: Select TOP 10 items from Solr Query

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
Am I missing something or do you have nested documents in the schema?

It reads like you looking for top 10 parents and then want to facet on
children. Is that right?

Regards,
   Alex

On 17 Feb 2017 5:35 AM, "Zheng Lin Edwin Yeo" <ed...@gmail.com> wrote:

I'm looking at JSON facet for both of type:terms and type:range.

For example, I may have 100 Items in my collections, and each item can have
many transactions. But I'm only interested to look at the top 10 items
which has the highest transaction rate (ie the highest count)

I'm doing a calculation of the total amount and average amount. However, I
will only want the total amount and average amount to be calculated based
on the top 10 items which has the highest transaction rate, and not all the
100 items.

For now, I need the additional query to get the top 10 items first, before
I run the JSON Facet to get the total amount and average amount for that 10
items.

Regards,
Edwin


On 17 February 2017 at 18:02, alessandro.benedetti <a....@sease.io>
wrote:

> I think we are missing something here ...
> You want to fetch the top 10 results for your query, and allow the user to
> navigate only those 10 results through facets ?
>
> Which facets are you interested in ?
> Field facets ?
> Whatever facet you want, calculating it in your client, on 10 results
> shouldn't be that problematic.
> Are we missing something ? Why you would need an additional query ?
>
> Cheers
>
>
>
> -----
> ---------------
> Alessandro Benedetti
> Search Consultant, R&D Software Engineer, Director
> Sease Ltd. - www.sease.io
> --
> View this message in context: http://lucene.472066.n3.
> nabble.com/Select-TOP-10-items-from-Solr-Query-tp4320863p4320910.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Select TOP 10 items from Solr Query

Posted by Zheng Lin Edwin Yeo <ed...@gmail.com>.
I'm looking at JSON facet for both of type:terms and type:range.

For example, I may have 100 Items in my collections, and each item can have
many transactions. But I'm only interested to look at the top 10 items
which has the highest transaction rate (ie the highest count)

I'm doing a calculation of the total amount and average amount. However, I
will only want the total amount and average amount to be calculated based
on the top 10 items which has the highest transaction rate, and not all the
100 items.

For now, I need the additional query to get the top 10 items first, before
I run the JSON Facet to get the total amount and average amount for that 10
items.

Regards,
Edwin


On 17 February 2017 at 18:02, alessandro.benedetti <a....@sease.io>
wrote:

> I think we are missing something here ...
> You want to fetch the top 10 results for your query, and allow the user to
> navigate only those 10 results through facets ?
>
> Which facets are you interested in ?
> Field facets ?
> Whatever facet you want, calculating it in your client, on 10 results
> shouldn't be that problematic.
> Are we missing something ? Why you would need an additional query ?
>
> Cheers
>
>
>
> -----
> ---------------
> Alessandro Benedetti
> Search Consultant, R&D Software Engineer, Director
> Sease Ltd. - www.sease.io
> --
> View this message in context: http://lucene.472066.n3.
> nabble.com/Select-TOP-10-items-from-Solr-Query-tp4320863p4320910.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Select TOP 10 items from Solr Query

Posted by "alessandro.benedetti" <a....@sease.io>.
I think we are missing something here ...
You want to fetch the top 10 results for your query, and allow the user to
navigate only those 10 results through facets ?

Which facets are you interested in ?
Field facets ?
Whatever facet you want, calculating it in your client, on 10 results
shouldn't be that problematic.
Are we missing something ? Why you would need an additional query ?

Cheers



-----
---------------
Alessandro Benedetti
Search Consultant, R&D Software Engineer, Director
Sease Ltd. - www.sease.io
--
View this message in context: http://lucene.472066.n3.nabble.com/Select-TOP-10-items-from-Solr-Query-tp4320863p4320910.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Select TOP 10 items from Solr Query

Posted by Michael Kuhlmann <ku...@solr.info>.
Since you already have the top x items then, wouldn't it be much easier
to collect the "facet" data from the result list on your own?

Am 17.02.2017 um 10:18 schrieb Zheng Lin Edwin Yeo:
> Hi Michael,
>
> Yes, I only want the JSON Facet to query based on the returned result set
> of the itemNo from the 1st query.
>
> There's definitely more than the 10, but we just need the top 10 in this
> case. As the top 10 itemNo may change, so we have to get the returned
> result set of the itemNo each time we want to do the JSON Facet.
>
> Regards,
> Edwin
>
>
> On 17 February 2017 at 15:42, Michael Kuhlmann <ku...@solr.info> wrote:
>
>> So basically you want faceting only on the returned result set?
>>
>> I doubt that this is possible without additional queries. The issue is
>> that faceting and result collecting is done within one iteration, so
>> when some document (actually the document's internal id) is fetched as a
>> possible result item, you can't determine whether this will make it into
>> the top x elements or not since there will come more.
>>
>> -Michael
>>
>> Am 17.02.2017 um 05:00 schrieb Zheng Lin Edwin Yeo:
>>> Hi,
>>>
>>> Would like to check, is it possible to do a select of say TOP 10 items
>> from
>>> Solr query, and use the list of the items to do another query (Eg: JSON
>>> Facet)?
>>>
>>> Currently, I'm using a normal facet to retrieve the list of the TOP 10
>> item
>>> from the normal faceting.
>>> After which, I have to list out all the 10 items as a filter when I do
>> the
>>> JSON Facet like this
>>> q=itemNo:(001 002 003 004 005 006 007 008 009 010)
>>>
>>> It will help if I can combine both of this into a single query.
>>>
>>> I'm using Solr 6.4.1
>>>
>>> Regards,
>>> Edwin
>>>
>>


Re: Select TOP 10 items from Solr Query

Posted by Zheng Lin Edwin Yeo <ed...@gmail.com>.
Hi Michael,

Yes, I only want the JSON Facet to query based on the returned result set
of the itemNo from the 1st query.

There's definitely more than the 10, but we just need the top 10 in this
case. As the top 10 itemNo may change, so we have to get the returned
result set of the itemNo each time we want to do the JSON Facet.

Regards,
Edwin


On 17 February 2017 at 15:42, Michael Kuhlmann <ku...@solr.info> wrote:

> So basically you want faceting only on the returned result set?
>
> I doubt that this is possible without additional queries. The issue is
> that faceting and result collecting is done within one iteration, so
> when some document (actually the document's internal id) is fetched as a
> possible result item, you can't determine whether this will make it into
> the top x elements or not since there will come more.
>
> -Michael
>
> Am 17.02.2017 um 05:00 schrieb Zheng Lin Edwin Yeo:
> > Hi,
> >
> > Would like to check, is it possible to do a select of say TOP 10 items
> from
> > Solr query, and use the list of the items to do another query (Eg: JSON
> > Facet)?
> >
> > Currently, I'm using a normal facet to retrieve the list of the TOP 10
> item
> > from the normal faceting.
> > After which, I have to list out all the 10 items as a filter when I do
> the
> > JSON Facet like this
> > q=itemNo:(001 002 003 004 005 006 007 008 009 010)
> >
> > It will help if I can combine both of this into a single query.
> >
> > I'm using Solr 6.4.1
> >
> > Regards,
> > Edwin
> >
>
>

Re: Select TOP 10 items from Solr Query

Posted by Michael Kuhlmann <ku...@solr.info>.
So basically you want faceting only on the returned result set?

I doubt that this is possible without additional queries. The issue is
that faceting and result collecting is done within one iteration, so
when some document (actually the document's internal id) is fetched as a
possible result item, you can't determine whether this will make it into
the top x elements or not since there will come more.

-Michael

Am 17.02.2017 um 05:00 schrieb Zheng Lin Edwin Yeo:
> Hi,
>
> Would like to check, is it possible to do a select of say TOP 10 items from
> Solr query, and use the list of the items to do another query (Eg: JSON
> Facet)?
>
> Currently, I'm using a normal facet to retrieve the list of the TOP 10 item
> from the normal faceting.
> After which, I have to list out all the 10 items as a filter when I do the
> JSON Facet like this
> q=itemNo:(001 002 003 004 005 006 007 008 009 010)
>
> It will help if I can combine both of this into a single query.
>
> I'm using Solr 6.4.1
>
> Regards,
> Edwin
>