couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Newson <rnew...@apache.org>
Subject Re: (Dynamically) excluding documents from a view query
Date Mon, 22 Oct 2012 12:56:48 GMT
loop through your tags, doing ret.add(tag, {"field":tag"}) for each,
then query with ?q=+tag:a -tag:b to find things with tag 'a' but not
with tag 'b'.

https://github.com/rnewson/couchdb-lucene

B.

On 22 October 2012 07:22, boazc <bcitrin@gmail.com> wrote:
> I am playing with CouchDB-Lucene looking if it can fulfill my use-case.
> I see that I can only index one document at a time, i.e. I cannot create an
> index for each tag.
> What will be the approach here? Should I concatenate tags or is an array
> supported in Lucene?
>
> Thanks!
>
> On Tue, Oct 16, 2012 at 8:45 PM, Robert Newson-2 [via CouchDB Development] <
> ml-node+s1959287n7581303h58@n2.nabble.com> wrote:
>
>> I think that would require you to read the entire view every time, though.
>>
>> On 16 October 2012 10:53, boazc <[hidden email]<http://user/SendEmail.jtp?type=node&node=7581303&i=0>>
>> wrote:
>>
>> > Thanks Robert.
>> >
>> > It crossed my mind that I can use List function and expect say
>> include-keys
>> > and exclude-keys query parameters thus filter out the undesired
>> documents.
>> > 1. Do you think the performance of such function will be reasonable?
>> > 2. Can I still support pagination through a List function?
>> >
>> > Cheers.
>> >
>> > On Tue, Oct 16, 2012 at 3:30 PM, Robert Newson-2 [via CouchDB
>> Development] <
>> > [hidden email] <http://user/SendEmail.jtp?type=node&node=7581303&i=1>>
>> wrote:
>> >
>> >> I can't speak about ElasticSearch, but the CouchDB-Lucene query would
>> >> certainly reflect the current state of your database (i.e, no "delay")
>> >> when you query.
>> >>
>> >> As for the original question, I don't think you can achieve it
>> >> directly with CouchDB views. If you emit each tag of a document as a
>> >> key, and null for value (e.g, emit("a",null)), then you could make two
>> >> concurrent queries for ?key=a and ?key=b, and read each, row by row,
>> >> filtering out as appropriate. It's not trivial.
>> >>
>> >> B.
>> >>
>> >> On 16 October 2012 05:50, boazc <[hidden email]<
>> http://user/SendEmail.jtp?type=node&node=7581300&i=0>>
>> >> wrote:
>> >>
>> >> > Hello,
>> >> >
>> >> > My documents contain tags which have a corresponding view.
>> >> > I want to retrieve all documents that contain a certain tag, but
>> don't
>> >> > contain another one.
>> >> > (Note that I don't know about the possible tags in advance).
>> >> >
>> >> > Example:
>> >> > id: doc1, tags: [a, b]
>> >> > id: doc2, tags: [b, c]
>> >> > id: doc3, tags: [a, c]
>> >> > If I want all docs with tag=a but not tag=b I expect to get only
>> doc3.
>> >> >
>> >> > Is there a way to achieve this on CouchDB side?
>> >> > Needless to say I cannot do it on the client side as I cannot benefit
>> >> from
>> >> > pagination and anyway might receive an extreme set of documents I
>> need
>> >> to
>> >> > work on.
>> >> >
>> >> > I know I can turn to some search engines e.g. ElasticSearch or
>> >> > CouchDB-Lucene, but other than introducing a new component to the
>> system
>> >> it
>> >> > also means an inherent delay between the "real" data and the indexed
>> >> data
>> >> > which in my domain is unacceptable.
>> >> >
>> >> > Thanks!!
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > View this message in context:
>> >>
>> http://couchdb-development.1959287.n2.nabble.com/Dynamically-excluding-documents-from-a-view-query-tp7581297.html
>> >> > Sent from the CouchDB Development mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ------------------------------
>> >>  If you reply to this email, your message will be added to the
>> discussion
>> >> below:
>> >>
>> >>
>> http://couchdb-development.1959287.n2.nabble.com/Dynamically-excluding-documents-from-a-view-query-tp7581297p7581300.html
>> >>  To unsubscribe from (Dynamically) excluding documents from a view
>> query, click
>> >> here<
>>
>> >> .
>> >> NAML<
>> http://couchdb-development.1959287.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>> >>
>> >
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://couchdb-development.1959287.n2.nabble.com/Dynamically-excluding-documents-from-a-view-query-tp7581297p7581301.html
>>
>> > Sent from the CouchDB Development mailing list archive at Nabble.com.
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://couchdb-development.1959287.n2.nabble.com/Dynamically-excluding-documents-from-a-view-query-tp7581297p7581303.html
>>  To unsubscribe from (Dynamically) excluding documents from a view query, click
>> here<http://couchdb-development.1959287.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7581297&code=YmNpdHJpbkBnbWFpbC5jb218NzU4MTI5N3wtMTkyNTAwODYwOA==>
>> .
>> NAML<http://couchdb-development.1959287.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
>
> --
> View this message in context: http://couchdb-development.1959287.n2.nabble.com/Dynamically-excluding-documents-from-a-view-query-tp7581297p7581329.html
> Sent from the CouchDB Development mailing list archive at Nabble.com.

Mime
View raw message