Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C5F58160C15 for ; Wed, 3 Jan 2018 13:08:05 +0100 (CET) Received: (qmail 15345 invoked by uid 500); 3 Jan 2018 12:08:05 -0000 Mailing-List: contact oak-issues-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: oak-dev@jackrabbit.apache.org Delivered-To: mailing list oak-issues@jackrabbit.apache.org Received: (qmail 15334 invoked by uid 99); 3 Jan 2018 12:08:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Jan 2018 12:08:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 69376C0C70 for ; Wed, 3 Jan 2018 12:08:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.011 X-Spam-Level: X-Spam-Status: No, score=-100.011 tagged_above=-999 required=6.31 tests=[RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id JgY8u9QFo0-4 for ; Wed, 3 Jan 2018 12:08:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 98D995FB29 for ; Wed, 3 Jan 2018 12:08:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 00984E1013 for ; Wed, 3 Jan 2018 12:08:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 3F748240FA for ; Wed, 3 Jan 2018 12:08:00 +0000 (UTC) Date: Wed, 3 Jan 2018 12:08:00 +0000 (UTC) From: "Dirk Rudolph (JIRA)" To: oak-issues@jackrabbit.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (OAK-7109) rep:facet returns wrong results for complex queries MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 03 Jan 2018 12:08:06 -0000 [ https://issues.apache.org/jira/browse/OAK-7109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16309559#comment-16309559 ] Dirk Rudolph commented on OAK-7109: ----------------------------------- Here is an example where constraints get lost in the filter: {code} select * from [nt:base] where ([propa] = 'true' and [propb] in('foo','bar')) or ([propa] = 'false' and not([propb] in('foo','bar'))) {code} It implements kind of white-/blacklisting ala "If a is set to true, b has to be in a configured set, if not, b has not to be in the configured set." It evaluates to: {code} [nt:base] as [nt:base] /* lucene:test2(/oak:index/test2) propa:[* TO *] where [nt:base].[propa] is not null */ {code} Which doesn't contain anything of propb, so in that case facet counting will be wrong as well. > rep:facet returns wrong results for complex queries > --------------------------------------------------- > > Key: OAK-7109 > URL: https://issues.apache.org/jira/browse/OAK-7109 > Project: Jackrabbit Oak > Issue Type: Bug > Components: lucene > Affects Versions: 1.6.7 > Reporter: Dirk Rudolph > Labels: facet > Attachments: facetsInMultipleRoots.patch > > > eComplex queries in that case are queries, which are passed to lucene not containing all original constraints. For example queries with multiple path restrictions like: > {code} > select [rep:facet(simple/tags)] from [nt:base] as a where contains(a.[*], 'ipsum') and (isdescendantnode(a,'/content1') or isdescendantnode(a,'/content2')) > {code} > In that particular case the index planer gives ":fulltext:ipsum" to lucene even though the index supports evaluating path constraints. > As counting the facets happens on the raw result of lucene, the returned facets are incorrect. For example having the following content > {code} > /content1/test/foo > + text = lorem ipsum > - simple/ > + tags = tag1, tag2 > /content2/test/bar > + text = lorem ipsum > - simple/ > + tags = tag1, tag2 > /content3/test/bar > + text = lorem ipsum > - simple/ > + tags = tag1, tag2 > {code} > the expected result for the dimensions of simple/tags and the query above is > - tag1: 2 > - tag2: 2 > as the result set is 2 results long and all documents are equal. The actual result set is > - tag1: 3 > - tag2: 3 > as the path constraint is not handled by lucene. > To workaround that the only solution that came to my mind is building the [disjunctive normal form|https://en.wikipedia.org/wiki/Disjunctive_normal_form] of my complex query and executing a query for each of the disjunctive statements. As this is expanding exponentially its only a theoretical solution, nothing for production. -- This message was sent by Atlassian JIRA (v6.4.14#64029)