I have a list of drawers in a mysql table named Drawers like
|      BOX       |  RANK  |
|----------------|--------|
|     Box1       |   1    |
|     Box2       |   2    |
|     Box3       |   3    |
|     Box4       |   4    |
|     Box5       |   5    |
Then I have another source which says some of these boxes contains jewel and should be placed at a specific position only(Lets call this table jewelboxes).
|      BOX       |  RANK  |
|----------------|--------|
|     Box1       |   4    |
|     Box3       |   1    |
|     Box5       |   3    |
I have certain restrictions that needs to adhere to:
I cannot write a stored proc on these tables
I want to get a list of Boxes on Solr where position of the jewelboxes should be fixed irrespective of the calling order(ascending/descending). for example,
ascending order would be:
|      BOX       |  RANK  |
|----------------|--------|
|     Box3       |   1    |
|     Box2       |   2    |
|     Box5       |   3    |
|     Box1       |   4    |
|     Box4       |   5    |
descending order would be:
|      BOX       |  RANK  |
|----------------|--------|
|     Box3       |   1    |
|     Box4       |   2    |
|     Box5       |   3    |
|     Box1       |   4    |
|     Box2       |   5    |
I am importing these tables into solr from dih, and currently ripping my hair apart thinking about how to do this. I have 2 options in my mind, but both are not very clear, and would like you folks here to help me out. My options are:
- Write a query in such a way that'll give me correct order. (this would need a master level querying skills because all we have is a select query in dih)
 - Write a CustomFieldComparator as described in the following link: http://sujitpal.blogspot.in/2011/05/custom-sorting-in-solr-using-external.html
 
Is there any third approach which can be followed to get the desired results ?
UPDATE:
I can work without the descending order criteria, but I still need the ascending one.
Thanks :-)