Welcome to MOTODEV  |  Join  |  Log In
 
Created: September 20, 2011

Custom Sort Order of Channel Items

Sometimes it doesn't make sense to sort the items of a channel by distance—for example, items that represent events like a concert. The closest event may not be the most interesting one when it takes place far in the future. Another use-case is a channel in which you want to prefer popular items to less popular ones, even if they are closer to the user.

To address these cases, Aloqa offers to sort your channel items first with your own logic and second according to distance. This is done in two steps.

  1. Add the sortindex tag to your KML.
  2. Configure channel sorting in the Aloqa Partner Portal.

Step 1: Add the sortindex tag in your KML

Add a sortindexes tag to your Placemark as shown in this example:

<Placemark id="11.525,48.14,0_MondayAfterWorkDrinks" >
    <name>Monday After Work Drinks</name>
    <description>
        <![CDATA[ ...some description here... ]]>
    </description>
    <Point><coordinates>11.525,48.14,0</coordinates></Point>
    <aloqa:snippet>Monday, September 12, at 5:00PM</aloqa:snippet>

    <aloqa:sortindexes>
        <aloqa:index>5.0</aloqa:index>
    </aloqa:sortindexes>

    <aloqa:onView>
        <aloqa:actions>
            <aloqa:map/>
        </aloqa:actions>
    </aloqa:onView>
</Placemark>

The index must be a floating point number in the range of the Java type Double (4.9^-324 to 1.7976931348623157^308). Items with a smaller number are shown before items with a larger number. In case you have ratings ranging from 1 to 5, where 1 means a bad and 5 a good rating, you should multiply the rating by -1.0 . Then your semantics is preserved.

Step 2: Configure channel sorting in the Aloqa Partner Portal

In the Aloqa Partner Portal, open your channel and scroll to the Filtering & Sorting section. Next to Sorting, click the Edit button. The default is set in the following order:

  1. Distance
  2. Index 1
  3. Index 2
  4. Index 3

Now drag the line with "Index 1" to the top. Note that the "Distance" item moves to the second position. The result should look like this:

  1. Index 1
  2. Distance
  3. Index 2
  4. Index 3

Click the Submit button to confirm the changes.

Don't forget to publish your changes on the channel, so that all subscribers get the updated content.

At the time this was written, only one sort index is supported. Changes to “Index 2” and above will be ignored.
 

Created: September 20, 2011

ECCN 5E991.NR: In accordance with United States Export Administration Regulations (EAR), and specifically the Commerce Control List (CCL), this item has been classified 5E991.NR. Export or re-export of this commodity and compliance with the U.S. Export Administration Regulations is ultimately the responsibility of the exporter. For more detailed information related to export or re-export of this item, please consult the EAR at http://www.access.gpo.gov/bis/ear/ear_data.html.


Was This Document Helpful?
Yes  No 

Additional Comments (Optional)



Submit

Share This Page

Bookmark and Share