title: How to use orderByChild or orderByValue in a FirebaseRecyclerAdapter
body: <p>I'm looking for a way to get my data sorted into a RecyclerView. At this moment I'm using the priority method for this, but I know that it is better to apply a <code>orderByChild</code> or <code>orderByValue</code> method to achieve this. I just cannot find how to do this properly.</p>
  
  <p>My (relevant) data structure is the following (bolt format):</p>
  
  <pre><code>path /events/{event}/GeneralInfo is GeneralInfo{}
  path /events/{event}/instances/{instance} is Instance{}
  
  type GeneralInfo {
      owner : KeyString,
      name : ShortNameString | Null, 
      color : Number | Null,
      description : NoteString | Null,
      shared : Boolean | Null,
      startDate : DateString,
      endDate : DateString, 
      instances: Map&lt;KeyString, Boolean&gt;,
      logoAvailable : Boolean | Null
  }
  
  type Instance {
      eventKey : KeyString,
      startDateTime : DateString,
      endDateTime : DateString,
      note : String | Null,
  }
  
  type KeyString extends String {
      validate() { this.length &gt; 0 &amp;&amp; this.length &lt;= 255 }
  }
  
  type DateString extends String {
      validate() { this.length == 12 }
  }
  
  type ShortNameString extends String {
      validate() { this.length &gt;= 0 &amp;&amp; this.length &lt;= 32 }
  }
  </code></pre>
  
  <p>The FirebaseRecyclerAdapter is currently initialized as follows:</p>
  
  <pre><code>Query q = getGeneralInfo( eventKey ).child( "instances" ).orderByPriority();
  
  mAdapter = new FirebaseRecyclerAdapter&lt;Boolean, InstanceViewHolder&gt;(Boolean.class, R.layout.instance_card, InstanceViewHolder.class, q) {
      @Override
      protected void populateViewHolder(final InstanceViewHolder viewHolder, Boolean model, final int position) {
         getInstanceByKey(mEventKey, refKey).addListenerForSingleValueEvent(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {
               Instance i = dataSnapshot.getValue(Instance.class);
               ....
  </code></pre>
  
  <p>Note that I use an index key field (the field with the Boolean) to retrieve the actual data. The index field is currently sorted (using priorities).</p>
  
  <p>I would like to sort directly on the instances (to make things less complicated and be able to remove the use of priorities).</p>
  
  <p>p.s. Although it may seem that the data is not normalized, this is the case: the /events/{event} path is never used to retrieve data. This is only done to keep some overview.</p>