What you need is called couchdb-lucene. All the hacks that try to do
something similar, in my opinion require much more effort.

On Mon, Apr 12, 2010 at 12:20 PM, Sebastian Cohnen
<[email protected]> wrote:
> you are right, this won't work in your case... but I'm not sure if this is 
> easily solvable... *hmm*
>
> On 12.04.2010, at 11:19, Magnus Ottosson wrote:
>
>> Are you sure about that?
>>
>> Wouldn't [name, population] first order the cities by name and if
>> there are more than one city with the same name they would be order by
>> population?
>>
>> Magnus
>>
>>
>>
>> On Mon, Apr 12, 2010 at 10:59 AM, Nils Breunese <[email protected]> wrote:
>>> If you use [name, population] as the key I believe you'll get what you 
>>> need. You could query the view like this: 
>>> ?startkey=["name"]&endkey=["name",{}]
>>>
>>> Also check out the article on view collation on the wiki: 
>>> http://wiki.apache.org/couchdb/View_collation
>>>
>>> Nils Breunese.
>>> ________________________________________
>>> Van: Magnus Ottosson [[email protected]]
>>> Verzonden: maandag 12 april 2010 10:25
>>> Aan: [email protected]
>>> Onderwerp: Search for city by name, order by population
>>>
>>> Hi,
>>>
>>> I have a database with the names and population of cities (about 7
>>> million entities). Is it possible, with couchdb, to create a key that
>>> includes both cityname and population where I can search for a name
>>> and get the matching results ordered by the population?
>>>
>>> I tried to create a key like [population, name] and search like this
>>> ?startkey=[0, "name"]&endkey=[10000000, "name]&limit=10 but it does
>>> not work like the way I hoped.
>>>
>>> Any ideas?
>>>
>>> Magnus
>>>
>>> De informatie vervat in deze  e-mail en meegezonden bijlagen is uitsluitend 
>>> bedoeld voor gebruik door de geadresseerde en kan vertrouwelijke informatie 
>>> bevatten. Openbaarmaking, vermenigvuldiging, verspreiding en/of 
>>> verstrekking van deze informatie aan derden is voorbehouden aan 
>>> geadresseerde. De VPRO staat niet in voor de juiste en volledige 
>>> overbrenging van de inhoud van een verzonden e-mail, noch voor tijdige 
>>> ontvangst daarvan.
>>>
>
>

Reply via email to