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 Drone42 <gv...@gmail.com> on 2012/12/10 22:23:03 UTC

Retrieving one object

I have stored multiple objects with the values;

uniqueUri
name
timestamp.

There can be multiple object with the same name, but they will have
different timestamps (and different uniqueUri)

I want to retrieve the object of a given name with the latest timestamp. As
an example I might have

1. uniqueUri=99661, name=FOO, timestamp=1355174089270
2. uniqueUri=98765, name=FOO, timestamp=1355174089870

I want to retrieve only object 2.

I have tried retrieving 1 row and sorting DECENDING on timestamp, but this
still returns the first object.

How can I do this?



--
View this message in context: http://lucene.472066.n3.nabble.com/Retrieving-one-object-tp4025810.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Retrieving one object

Posted by Drone42 <gv...@gmail.com>.
My mistake;

I was using the embedded SOLR server. I was storing in one route and
searching through another. The changes from the storage wasnt visible (file
open) for the search.

Changing to use the standalone server solved the problem. 



--
View this message in context: http://lucene.472066.n3.nabble.com/Retrieving-one-object-tp4025810p4026068.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Retrieving one object

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
Are you sure it stored both? If you search for name:FOO, do you get both?

If not, check which field is your uniqueKey set in schema.xml. Maybe it is
something that was not being changed between the entries and you updated
old record instead.

Also, what field type is your timestamp? Maybe your sort is doing something
different from what your expect.

Regards,
   Alex.

Personal blog: http://blog.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all at
once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD book)



On Tue, Dec 11, 2012 at 8:23 AM, Drone42 <gv...@gmail.com> wrote:

> I have stored multiple objects with the values;
>
> uniqueUri
> name
> timestamp.
>
> There can be multiple object with the same name, but they will have
> different timestamps (and different uniqueUri)
>
> I want to retrieve the object of a given name with the latest timestamp. As
> an example I might have
>
> 1. uniqueUri=99661, name=FOO, timestamp=1355174089270
> 2. uniqueUri=98765, name=FOO, timestamp=1355174089870
>
> I want to retrieve only object 2.
>
> I have tried retrieving 1 row and sorting DECENDING on timestamp, but this
> still returns the first object.
>
> How can I do this?
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Retrieving-one-object-tp4025810.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>