I want to generate unique keys automatically in solr. I checked the default function here but it is generating id like 1cdee8b4-c42d-4101-8301-4dc350a4d522. In my application, I need unique autoincrement numbers like we do in MySql. What should be approach to do this ? Solrj pointers would be much helpful.
Another solution (hack) that I've implemented is to create a record in solr inside the existing schema. For example if you have a schema which has 2 string fields then you can store the values as MAX_VALUE and the other being the actual integer max value stored as string. So anytime you would add, you'd have to query for "fieldname:MAX_VALUE" and retrieve the string value from the other field of the same document. You can parse it and add 1. You then update the existing MAX_VALUE document. It's not the most feasible but it is a solution. The implementation keeps your max number within your index rather than in another application.
It's also solj friendly as it's fairly straight forward to make the query and the update query.
I apologize for the grammar. Do comment if you can't understand what I'm saying.