Retrieving one object

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Retrieving one object

Drone42
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?
Reply | Threaded
Open this post in threaded view
|

Re: Retrieving one object

Alexandre Rafalovitch
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 <[hidden email]> 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.
>
Reply | Threaded
Open this post in threaded view
|

Re: Retrieving one object

Drone42
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.