You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Дмитрий Курилов <me...@dmkonweb.ru> on 2010/01/29 12:36:26 UTC
Complex filter with permanent view
Hi folks,
I have a database that contains docs like this one:
{
'type': 'order',
'customer_name': 'John F. Smit',
'order_date': '2009-12-18',
'manager_id': 'some id',
'partner_order': 'ZX-M-777218883',
'other_fields': 'There are other fields in document'
}
I need all documents that match conditions received from web-form (so
conditions are unknown). For example:
* customer_name string CONTAINS 'Smit'
* order_date date BETWEEN '2009-12-01' and '2009-12-31'
* manager_id string IS 'manager-21'
* partner_order CONTAINS '77232'
How to solve it with permanent view?
Many thanks,
Dmitry
Re: Complex filter with permanent view
Posted by Dmitry Unkovsky <oi...@gmail.com>.
http://lucene.apache.org/java/2_4_0/queryparsersyntax.html
It'll give you a brief picture what can you expect of lucene.
couchdb-lucene works quite well for me in case very similar to yours.
--
DU
Re: Complex filter with permanent view
Posted by de Saint Martin Cédric <ce...@desaintmartin.fr>.
Hi,
What do you mean by "third party"?
I have to build a search engine (something like fieldA='value1' AND fieldB='valueB' AND ...), and I already use CouchDB. Must I switch back to a more traditional approach with SQL?
regards,
Cédric de Saint Martin.
On 29 janv. 2010, at 19:23, Alex P wrote:
> Agreed. (almost) any time you need a string contains, you'll want lucene. Range queries are fairly straightforward with standard views (look at startkey and endkey) but if you need 'and' conditions (or any compound queries at query-time) you have to go third party.
>
> On Jan 29, 2010, at 2:16 PM, David Coallier <da...@gmail.com> wrote:
>
>> On 29 January 2010 11:36, Дмитрий Курилов <me...@dmkonweb.ru> wrote:
>>> Hi folks,
>>>
>>> I have a database that contains docs like this one:
>>> {
>>> 'type': 'order',
>>> 'customer_name': 'John F. Smit',
>>> 'order_date': '2009-12-18',
>>> 'manager_id': 'some id',
>>> 'partner_order': 'ZX-M-777218883',
>>> 'other_fields': 'There are other fields in document'
>>> }
>>>
>>> I need all documents that match conditions received from web-form (so
>>> conditions are unknown). For example:
>>> * customer_name string CONTAINS 'Smit'
>>> * order_date date BETWEEN '2009-12-01' and '2009-12-31'
>>> * manager_id string IS 'manager-21'
>>> * partner_order CONTAINS '77232'
>>>
>>
>>
>> I would recommend/consider looking at couchdb-lucene
>> (http://github.com/rnewson/couchdb-lucene)
>>
>> --
>> Slan,
>> David
>
Re: Complex filter with permanent view
Posted by Alex P <ko...@gmail.com>.
Agreed. (almost) any time you need a string contains, you'll want
lucene. Range queries are fairly straightforward with standard views
(look at startkey and endkey) but if you need 'and' conditions (or any
compound queries at query-time) you have to go third party.
On Jan 29, 2010, at 2:16 PM, David Coallier <da...@gmail.com>
wrote:
> On 29 January 2010 11:36, Дмитрий Курилов <me...@dmkonweb.ru> wrote:
>> Hi folks,
>>
>> I have a database that contains docs like this one:
>> {
>> 'type': 'order',
>> 'customer_name': 'John F. Smit',
>> 'order_date': '2009-12-18',
>> 'manager_id': 'some id',
>> 'partner_order': 'ZX-M-777218883',
>> 'other_fields': 'There are other fields in document'
>> }
>>
>> I need all documents that match conditions received from web-form (so
>> conditions are unknown). For example:
>> * customer_name string CONTAINS 'Smit'
>> * order_date date BETWEEN '2009-12-01' and '2009-12-31'
>> * manager_id string IS 'manager-21'
>> * partner_order CONTAINS '77232'
>>
>
>
> I would recommend/consider looking at couchdb-lucene
> (http://github.com/rnewson/couchdb-lucene)
>
> --
> Slan,
> David
Re: Complex filter with permanent view
Posted by David Coallier <da...@gmail.com>.
On 29 January 2010 11:36, Дмитрий Курилов <me...@dmkonweb.ru> wrote:
> Hi folks,
>
> I have a database that contains docs like this one:
> {
> 'type': 'order',
> 'customer_name': 'John F. Smit',
> 'order_date': '2009-12-18',
> 'manager_id': 'some id',
> 'partner_order': 'ZX-M-777218883',
> 'other_fields': 'There are other fields in document'
> }
>
> I need all documents that match conditions received from web-form (so
> conditions are unknown). For example:
> * customer_name string CONTAINS 'Smit'
> * order_date date BETWEEN '2009-12-01' and '2009-12-31'
> * manager_id string IS 'manager-21'
> * partner_order CONTAINS '77232'
>
I would recommend/consider looking at couchdb-lucene
(http://github.com/rnewson/couchdb-lucene)
--
Slan,
David