← Back to team overview

u1db-discuss team mailing list archive

Index collation - was: Indexing and lists

 

On 11/17/2011 09:06 PM, Stuart Langridge wrote:
So, let's talk about indexing.

Imagine a database with the following documents in:

{ "name": "Stuart", "address": {"town": "Birmingham", "country": "UK"},
   "hair": "red", "colours": [ "red", "blue" ], "id": "sil" }
{ "name": "Samuele", "address": {"town": "Sometown", "country": "CH"},
   "hair": "brown", "colours": [ "green" ], "id": "pedronis" }
{ "name": "Lucio", "address": {"town": "Othertown", "country": "AR"},
   "hair": "brown", "colours": [ "pink" ], "id": "lucio" }
{ "name": "Rodney", "address": {"town": "Podunk", "country": "US"},
   "hair": "brown", "colours": [ "brown", "red" ], "id": "dobey" }

If I create an index as create_index("haircolour", ["hair"]), the index
would look (conceptually) like this:
brown: dobey
brown: lucio
brown: pedronis
red: sil

A question - how are the indexes collated? Ie. does "Élèphant" sort before or after "Elephant"? With the current locale of the executing user? That could turn out "interesting" if I have two boxes one in English and one in Danish...

This seems like a tricky problem unless the collation must be specified at index creation time.

Cheers,
Mikkel


Follow ups

References