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 Alok Bhandari <al...@gmail.com> on 2013/07/24 15:08:29 UTC

how to get unique latest results from solr

Hello All,

I am using solr 4.0. I have a data in my solrindex where on each review of a
document a new entry for a document is added in solr , here document also
have a field which holds employee_id and entry also holds the timestamp of
when that record is added. 

Now I want to query this index in a way that I can specify two time ranges
t1-t2 and get latest entry for  employee_id in this time-range. So in the
given time-range document might have been updated multiple times , but I
want latest entry.

Is there any know way to achieve this.

Thanks 

Alok



--
View this message in context: http://lucene.472066.n3.nabble.com/how-to-get-unique-latest-results-from-solr-tp4080034.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: how to get unique latest results from solr

Posted by Alok Bhandari <al...@gmail.com>.
Thanks Erick.

It seems the approach suggested by you is the one which I was looking for ,
thanks a lot for reply.



--
View this message in context: http://lucene.472066.n3.nabble.com/how-to-get-unique-latest-results-from-solr-tp4080034p4080228.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: how to get unique latest results from solr

Posted by Erick Erickson <er...@gmail.com>.
You might be able to get close with grouping (by employee) and
sorting within groups by update time.

Best
Erick

On Wed, Jul 24, 2013 at 10:13 AM, Jack Krupansky
<ja...@basetechnology.com> wrote:
> In that case, the answer is that no, Solr does not have such a feature.
>
> You could simulate it by doing a separate query (using the method I
> suggested) for each of the 10 employees, one at a time.
>
>
> -- Jack Krupansky
>
> -----Original Message----- From: Alok Bhandari
> Sent: Wednesday, July 24, 2013 10:07 AM
> To: solr-user@lucene.apache.org
> Subject: Re: how to get unique latest results from solr
>
>
> Thanks Jack.
>
> It may be the case that I was unable to explain the query correctly.
> Actually I don't want it for a single employee I want it for all the
> employees that are updated in that time range. So if lets say 10 employees
> data is updated in the given time-range and that also multiple times then I
> want latest entry per employee updated in the given time range.
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/how-to-get-unique-latest-results-from-solr-tp4080034p4080052.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Re: how to get unique latest results from solr

Posted by Jack Krupansky <ja...@basetechnology.com>.
In that case, the answer is that no, Solr does not have such a feature.

You could simulate it by doing a separate query (using the method I 
suggested) for each of the 10 employees, one at a time.

-- Jack Krupansky

-----Original Message----- 
From: Alok Bhandari
Sent: Wednesday, July 24, 2013 10:07 AM
To: solr-user@lucene.apache.org
Subject: Re: how to get unique latest results from solr

Thanks Jack.

It may be the case that I was unable to explain the query correctly.
Actually I don't want it for a single employee I want it for all the
employees that are updated in that time range. So if lets say 10 employees
data is updated in the given time-range and that also multiple times then I
want latest entry per employee updated in the given time range.



--
View this message in context: 
http://lucene.472066.n3.nabble.com/how-to-get-unique-latest-results-from-solr-tp4080034p4080052.html
Sent from the Solr - User mailing list archive at Nabble.com. 


Re: how to get unique latest results from solr

Posted by Alok Bhandari <al...@gmail.com>.
Thanks Jack.

It may be the case that I was unable to explain the query correctly.
Actually I don't want it for a single employee I want it for all the
employees that are updated in that time range. So if lets say 10 employees
data is updated in the given time-range and that also multiple times then I
want latest entry per employee updated in the given time range. 



--
View this message in context: http://lucene.472066.n3.nabble.com/how-to-get-unique-latest-results-from-solr-tp4080034p4080052.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: how to get unique latest results from solr

Posted by Jack Krupansky <ja...@basetechnology.com>.
Do your time range query, sort by the time field as "descending", and take 
the first result.

-- Jack Krupansky

-----Original Message----- 
From: Alok Bhandari
Sent: Wednesday, July 24, 2013 9:08 AM
To: solr-user@lucene.apache.org
Subject: how to get unique latest results from solr


Hello All,

I am using solr 4.0. I have a data in my solrindex where on each review of a
document a new entry for a document is added in solr , here document also
have a field which holds employee_id and entry also holds the timestamp of
when that record is added.

Now I want to query this index in a way that I can specify two time ranges
t1-t2 and get latest entry for  employee_id in this time-range. So in the
given time-range document might have been updated multiple times , but I
want latest entry.

Is there any know way to achieve this.

Thanks

Alok



--
View this message in context: 
http://lucene.472066.n3.nabble.com/how-to-get-unique-latest-results-from-solr-tp4080034.html
Sent from the Solr - User mailing list archive at Nabble.com.