You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Alexander Perepelica <pe...@gmail.com> on 2010/07/16 10:36:20 UTC

View with multiple parameters

Hello!
I am new with couchdb. And I try to understand how can I create view where I
can set >1 parameter.
When I work with with sql I can do such query
Select *  From data
Where ( Param1 >XXX and Param1 < YYY ) and ( Param2 >NNN and Param2 < OOO )
...
So when I must use only I parameter I do it with startkey and endkey. But if
I have more then one parameter?
Thank you!

Alexander

Re: View with multiple parameters

Posted by Alexander Perepelica <pe...@gmail.com>.
Thank you for tip, I look at lucene. What I try to do is save to couchdb log
massages from application's and then create reports from this db. Log
messages are
{ datetime:XXX, ip:"192.168.0.1", category:11, command:12, key1:value1, ...,
keyN=valueM}
And I try create view for
Select *
from data Where datetime > ... and datetime < ... and ip in ["...","..."]
and category = "" ....


2010/7/16 Jon Gretar Borgthorsson <jo...@jongretar.com>

> We tend not to do things like that. It's amazing how often one can engineer
> away from doing things that way and how much faster and reliable working
> within these constrictions are. First think about the problem and see if
> you
> really need that. If things really overlap that way. It's difficult to say
> without knowing your specific setup and needs.
>
> However. Sometimes you cannot do things like that. I for example am working
> on a real estate site where users make pretty complex queries using
> location, sizes, number of rooms and so on. In a case like that you would
> use couchdb-lucene[1]. But using a solution like that is a best practice no
> matter what database you use. Doing complex queries into the database is a
> bad waste of the database resource.
>
>  [1]: http://github.com/rnewson/couchdb-lucene
>
> On Fri, Jul 16, 2010 at 8:36 AM, Alexander Perepelica <
> perepelica.alex@gmail.com> wrote:
>
> > Hello!
> > I am new with couchdb. And I try to understand how can I create view
> where
> > I
> > can set >1 parameter.
> > When I work with with sql I can do such query
> > Select *  From data
> > Where ( Param1 >XXX and Param1 < YYY ) and ( Param2 >NNN and Param2 < OOO
> )
> > ...
> > So when I must use only I parameter I do it with startkey and endkey. But
> > if
> > I have more then one parameter?
> > Thank you!
> >
> > Alexander
> >
>



-- 
Perepelitca Alexander
Senior Developer, Department for new technology's

Institute for Recording information
Kyiv, Ukraine

Re: View with multiple parameters

Posted by Jon Gretar Borgthorsson <jo...@jongretar.com>.
We tend not to do things like that. It's amazing how often one can engineer
away from doing things that way and how much faster and reliable working
within these constrictions are. First think about the problem and see if you
really need that. If things really overlap that way. It's difficult to say
without knowing your specific setup and needs.

However. Sometimes you cannot do things like that. I for example am working
on a real estate site where users make pretty complex queries using
location, sizes, number of rooms and so on. In a case like that you would
use couchdb-lucene[1]. But using a solution like that is a best practice no
matter what database you use. Doing complex queries into the database is a
bad waste of the database resource.

 [1]: http://github.com/rnewson/couchdb-lucene

On Fri, Jul 16, 2010 at 8:36 AM, Alexander Perepelica <
perepelica.alex@gmail.com> wrote:

> Hello!
> I am new with couchdb. And I try to understand how can I create view where
> I
> can set >1 parameter.
> When I work with with sql I can do such query
> Select *  From data
> Where ( Param1 >XXX and Param1 < YYY ) and ( Param2 >NNN and Param2 < OOO )
> ...
> So when I must use only I parameter I do it with startkey and endkey. But
> if
> I have more then one parameter?
> Thank you!
>
> Alexander
>