Hi,

How about a custom UpdateRequestProcessor that uses milliseconds or even
nanoseconds and stores them in some field?  If that is enough resolution
and you still want to avoid collision, append a random letter/string/number
to it, a la <millis or nanos>_<extra stuff to make it unique>.

Otis
--
Solr & ElasticSearch Support
http://sematext.com/





On Wed, Mar 6, 2013 at 2:31 AM, marks1900-pos...@yahoo.com.au <
marks1900-pos...@yahoo.com.au> wrote:

>
> I am looking into how to add auto-increment/sequence/counter functionality
> to Solr 4.x. I specifically want to do this, so that I have numeric field
> which records the document insertion order that can be sorted against. This
> numeric field would have to be unique and not be allowed to change over
> time.  Unfortunately using a insertion "date" would
> provide numerous collisions.  Any feedback or ideas on an approach that
> would help me achieve this would be appreciated.
>
> I am thinking that this could be achieved multiple ways:
> * Via Remote Solr Document calls.  (A Solr Singleton for remote calls +
> Solr calls to get the current sequence value and then a call to increment
> the value )
> * A Solr Plugin (extend RequestHandlerBase - 
> http://..../sequence?q=name&size=1000 and
> return the next sequence/counter number )
> * Using a standard RDBMS such as PostgreSQL.
> * Some special Solr/Lucene functionality that I don't know about.
>
> The closest information I could find is outlined here:
> http://lucene.472066.n3.nabble.com/counter-field-td3886549.html
>
>
> A bit more background:
>
> I am using Solr as a NoSQL solution with great text search capabilities.
>  Currently, I am inserting beans using SolrJ and each of these beans has an
> id which is comprised of bean string type (Such as "CUSTOMER", "BOOK",
> "STORE" ) concatenated with a unique bean type identifier string ( Customer
> - UUID.randomUUID().toString().toLowerCase(Locale.ENGLISH), Book - ISDN,
> Store - name).  For instance,
> "CUSTOMER-b245659b-825c-4357-aab0-6d592468889a", "BOOK-978-1782161325" or
> "STORE-TheUniquelyNamedStore".  Ideally I am aiming to add a numeric field
> to these beans that represents insertion position, that will then be used
> as a sorting field.
>

Reply via email to