You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Ilya Novojilov <no...@gmail.com> on 2011/08/21 10:57:54 UTC

getting related documents

He||o all
I understand it's a very common request, but I couldn't find a solution.
Say documents are:

{
  title:"doc 1",
  body:"body",
  tags:["tag1","tag2","tag3"]
}

another thing is that Tags have importance value.
So I want to get documents that have tag1,tag2 adn tag3
If there is no such docs - return those with tag1 and tag2
etc.

Re: getting related documents

Posted by Ilya Novojilov <no...@gmail.com>.
It seems very close, will give it a try.

This was done in SQL + php with 3 requests:

select * from tags where tagid in (1,2,3);
if (no rows)
select * from tags where tagid in (1,2);
if (no rows)
select * from tags where tagid in (1);
if (no rows)
return default set


2011/8/21 Marcello Nuccio <ma...@gmail.com>:
> I'm not sure to understand your question. Can you be more specific?
> Is the following useful?
> http://stackoverflow.com/questions/5227587/how-to-match-a-superset-key-to-a-subset-using-group-level-sub-selects-in-couchdb/5256801#5256801
>
> Marcello
>
> 2011/8/21 Ilya Novojilov <no...@gmail.com>:
>> He||o all
>> I understand it's a very common request, but I couldn't find a solution.
>> Say documents are:
>>
>> {
>>  title:"doc 1",
>>  body:"body",
>>  tags:["tag1","tag2","tag3"]
>> }
>>
>> another thing is that Tags have importance value.
>> So I want to get documents that have tag1,tag2 adn tag3
>> If there is no such docs - return those with tag1 and tag2
>> etc.
>>
>

Re: getting related documents

Posted by Marcello Nuccio <ma...@gmail.com>.
I'm not sure to understand your question. Can you be more specific?
Is the following useful?
http://stackoverflow.com/questions/5227587/how-to-match-a-superset-key-to-a-subset-using-group-level-sub-selects-in-couchdb/5256801#5256801

Marcello

2011/8/21 Ilya Novojilov <no...@gmail.com>:
> He||o all
> I understand it's a very common request, but I couldn't find a solution.
> Say documents are:
>
> {
>  title:"doc 1",
>  body:"body",
>  tags:["tag1","tag2","tag3"]
> }
>
> another thing is that Tags have importance value.
> So I want to get documents that have tag1,tag2 adn tag3
> If there is no such docs - return those with tag1 and tag2
> etc.
>