You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Burkhard Pauli <ma...@bpauli.de> on 2015/09/07 14:32:58 UTC

Lucene Property Index and OR condition

Hello List,

I created a lucene property index as follow:

{
    "async": "async",
    "compatVersion": 2,
    "evaluatePathRestrictions": true,
    "indexRules": {
        "dam:Asset": {
            "includePropertyTypes": [
                "String"
            ],
            "jcr:primaryType": "nt:unstructured",
            "properties": {
                "brand1": {
                    "jcr:primaryType": "nt:unstructured",
                    "name": "jcr:content/metadata/option/1/brand",
                    "propertyIndex": true
                },
                "brand2": {
                    "jcr:primaryType": "nt:unstructured",
                    "name": "jcr:content/metadata/option/2/brand",
                    "propertyIndex": true
                },
                "jcr:primaryType": "nt:unstructured"
            }
        },
        "jcr:primaryType": "nt:unstructured"
    },
    "jcr:primaryType": "oak:QueryIndexDefinition",
    "reindex": false,
    "reindexCount": 1,
    "type": "lucene"
}

If I test the XPATH query /jcr:root/content/dam//element(*,
dam:Asset)[(jcr:content/metadata/option/_x0032_/@brand='E’)]
I get the debug message "cost for lucene-property is 193.0”. So it works as
expected.

But if I add a OR-Statemenet to the XPATH query like
/jcr:root/content/dam//element(*,
dam:Asset)[(jcr:content/metadata/option/_x0031_/@brand='E') or
(jcr:content/metadata/option/_x0032_/@brand='E’)]

I get "cost for lucene-property is Infinity”

Question: Does the Lucene property index support or conditions? I tried
even with a oak property index without success.

Thanks for your help!

Best regards
Burkhard

Re: Lucene Property Index and OR condition

Posted by Burkhard Pauli <ma...@bpauli.de>.
Hi Chetan,

Thanks for your feedback. It was tested with version 1.0.15 which is part
of AEM 6.0 SP2. Good to know that this is fixed now.

Are you aware of any HF for version 1.0.x?

Thanks
Burkhard

On Mon, Sep 7, 2015 at 5:41 PM, Chetan Mehrotra <ch...@gmail.com>
wrote:

> How did you performed the test? If you tested out with explain then
> current code in 1.0/1.2 return misleading result and this got fixed in
> trunk with OAK-2943. Technically Oak would convert the OR clause to a
> union query and then each part of union should then be able to make
> use of index.
> Chetan Mehrotra
>
>
> On Mon, Sep 7, 2015 at 6:36 PM, Davide Giannella <da...@apache.org>
> wrote:
> > On 07/09/2015 14:32, Burkhard Pauli wrote:
> >> ...
> >> Question: Does the Lucene property index support or conditions? I tried
> >> even with a oak property index without success.
> >>
> >
> > I can be be totally wrong, so please take this carefully, but AFAIR
> > lucene property index does not support ORs.
> >
> > This is mainly used for tests but should be valid for real-life as well
> >
> >
> https://github.com/apache/jackrabbit-oak/blob/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexPlanner.java#L452
> >
> > Davide
> >
> >
>



-- 
––––––––––––––––––––––––––––––––––––––––––
Burkhard Pauli
Bötzowstr. 13 | 10407 Berlin
Fon 030. 648 315 73 | Mobil 0151. 227 337 53
–––––––––––––––––––––––––––––––––––––––––-

Re: Lucene Property Index and OR condition

Posted by Chetan Mehrotra <ch...@gmail.com>.
How did you performed the test? If you tested out with explain then
current code in 1.0/1.2 return misleading result and this got fixed in
trunk with OAK-2943. Technically Oak would convert the OR clause to a
union query and then each part of union should then be able to make
use of index.
Chetan Mehrotra


On Mon, Sep 7, 2015 at 6:36 PM, Davide Giannella <da...@apache.org> wrote:
> On 07/09/2015 14:32, Burkhard Pauli wrote:
>> ...
>> Question: Does the Lucene property index support or conditions? I tried
>> even with a oak property index without success.
>>
>
> I can be be totally wrong, so please take this carefully, but AFAIR
> lucene property index does not support ORs.
>
> This is mainly used for tests but should be valid for real-life as well
>
> https://github.com/apache/jackrabbit-oak/blob/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexPlanner.java#L452
>
> Davide
>
>

Re: Lucene Property Index and OR condition

Posted by Davide Giannella <da...@apache.org>.
On 07/09/2015 14:32, Burkhard Pauli wrote:
> ...
> Question: Does the Lucene property index support or conditions? I tried
> even with a oak property index without success.
>

I can be be totally wrong, so please take this carefully, but AFAIR
lucene property index does not support ORs.

This is mainly used for tests but should be valid for real-life as well

https://github.com/apache/jackrabbit-oak/blob/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexPlanner.java#L452

Davide