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 Reza Safari <r....@lukkien.com> on 2009/07/15 11:49:09 UTC

How to filter old revisions

Hi,

How is possible to search for max values e.g.

doc1 has revision number 1
doc2 has revision number 2
doc3 has revision number 3

doc1, doc2 and doc3 have all same root revision id e.g. 10000

I want search result with doc's with only highest revision number?

Gr, Reza














RE: How to filter old revisions

Posted by Daniel Alheiros <Da...@bbc.co.uk>.
Hi

Are you ever going to search for earlier revisions or only the latest?
If in your use cases you need the latest, just replace earlier revisions
with the latest on your index....

Regards,
Daniel  

-----Original Message-----
From: Reza Safari [mailto:r.safari@lukkien.com] 
Sent: 15 July 2009 12:22
To: solr-user@lucene.apache.org
Subject: Re: How to filter old revisions

Revision is a field.
Sorting is not an option because then I sort all document! I want to
filter a subset of documents with the same root version number (field)
and get only one document of the subset with highest revision number.  
In other words the root revision number of all documents retrieved by
search must be unique.

E.g. If these are all my documents

<doc>
<long name="id">100000</str>
<int name="revision_number">1</int>
<long name="root_revision_id"> 100000 </long> <.....> <doc> <doc> <long
name="id">100001</str> <int name="revision_number">2</int> <long
name="root_revision_id"> 100000 </long> <.....> <doc> <doc> <long
name="id">100002</str> <int name="revision_number">1</int> <long
name="root_revision_id"> 100002 </long> <.....> <doc>

Search must return only documents with id=100001 and id=100002 (document
with id=100000 must be ignored because 100001 has the same
root_revision_id as document with id= 100000 and the revision number of
document with id= 100001 is > revision number of document with id=
100000)

Gr, Reza

On Jul 15, 2009, at 11:52 AM, Shalin Shekhar Mangar wrote:

> On Wed, Jul 15, 2009 at 3:19 PM, Reza Safari <r....@lukkien.com>
> wrote:
>
>> Hi,
>>
>> How is possible to search for max values e.g.
>>
>> doc1 has revision number 1
>> doc2 has revision number 2
>> doc3 has revision number 3
>>
>> doc1, doc2 and doc3 have all same root revision id e.g. 10000
>>
>> I want search result with doc's with only highest revision number?
>>
>
> What is "revision"? Is it a field in your Solr document?
>
> There's no way to find max but you can always sort descending by the 
> revision field and take the first.
>
> --
> Regards,
> Shalin Shekhar Mangar.


--
Reza Safari
LUKKIEN
Copernicuslaan 15
6716 BM Ede

The Netherlands
---------------------------------------------
http://www.lukkien.com
t: +31 (0) 318 698000

This message is for the designated recipient only and may contain  
privileged, proprietary, or otherwise private information. If you have  
received it in error, please notify the sender immediately and delete  
the original. Any other use of the email by you is prohibited.















http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
					

Re: How to filter old revisions

Posted by Reza Safari <r....@lukkien.com>.
Revision is a field.
Sorting is not an option because then I sort all document! I want to  
filter a subset of documents with the same root version number (field)  
and get only one document of the subset with highest revision number.  
In other words the root revision number of all documents retrieved by  
search must be unique.

E.g. If these are all my documents

<doc>
<long name="id">100000</str>
<int name="revision_number">1</int>
<long name="root_revision_id"> 100000 </long>
<.....>
<doc>
<doc>
<long name="id">100001</str>
<int name="revision_number">2</int>
<long name="root_revision_id"> 100000 </long>
<.....>
<doc>
<doc>
<long name="id">100002</str>
<int name="revision_number">1</int>
<long name="root_revision_id"> 100002 </long>
<.....>
<doc>

Search must return only documents with id=100001 and id=100002  
(document with id=100000 must be ignored because 100001 has the same  
root_revision_id as document with id= 100000 and the revision number  
of document with id= 100001 is > revision number of document with id=  
100000)

Gr, Reza

On Jul 15, 2009, at 11:52 AM, Shalin Shekhar Mangar wrote:

> On Wed, Jul 15, 2009 at 3:19 PM, Reza Safari <r....@lukkien.com>  
> wrote:
>
>> Hi,
>>
>> How is possible to search for max values e.g.
>>
>> doc1 has revision number 1
>> doc2 has revision number 2
>> doc3 has revision number 3
>>
>> doc1, doc2 and doc3 have all same root revision id e.g. 10000
>>
>> I want search result with doc's with only highest revision number?
>>
>
> What is "revision"? Is it a field in your Solr document?
>
> There's no way to find max but you can always sort descending by the
> revision field and take the first.
>
> -- 
> Regards,
> Shalin Shekhar Mangar.


--
Reza Safari
LUKKIEN
Copernicuslaan 15
6716 BM Ede

The Netherlands
---------------------------------------------
http://www.lukkien.com
t: +31 (0) 318 698000

This message is for the designated recipient only and may contain  
privileged, proprietary, or otherwise private information. If you have  
received it in error, please notify the sender immediately and delete  
the original. Any other use of the email by you is prohibited.















Re: How to filter old revisions

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Wed, Jul 15, 2009 at 3:19 PM, Reza Safari <r....@lukkien.com> wrote:

> Hi,
>
> How is possible to search for max values e.g.
>
> doc1 has revision number 1
> doc2 has revision number 2
> doc3 has revision number 3
>
> doc1, doc2 and doc3 have all same root revision id e.g. 10000
>
> I want search result with doc's with only highest revision number?
>

What is "revision"? Is it a field in your Solr document?

There's no way to find max but you can always sort descending by the
revision field and take the first.

-- 
Regards,
Shalin Shekhar Mangar.