You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Torgeir Veimo <to...@gmail.com> on 2015/02/10 11:08:46 UTC

oak index configuration

I am struggling with messages such as

20:04:13,598 WARN  query.Cursors$TraversingCursor.fetchNext() - line
312 [0:0:0:0:0:0:0:1] - Traversed 7000 nodes with filter
Filter(query=select c.[jcr:path] as [jcr:path], c.[jcr:score] as
[jcr:score], c.* from [nt:base] as a inner join [nt:base] as b on
isdescendantnode(b, a) inner join [ka:asset] as c on ischildnode(c, b)
where name(a) = 'content' and isdescendantnode(a, '/') and
c.[ka:assetType] = 'company' order by c.[jcr:score] /* xpath:
/jcr:root//content//* /element(*,ka:asset)[@ka:assetType = 'company' ]
order by @jcr:score */, path=//*); consider creating an index or
changing the query

/jcr:root//content//*/element(*,ka:asset)[@ka:assetType = 'company' ]
order by @jcr:score

My indexes are set up with

        NodeBuilder index = IndexUtils.getOrCreateOakIndex(builder);
        index.child("lucene")
                .setProperty("jcr:primaryType",
"oak:QueryIndexDefinition", Type.NAME)
                .setProperty("type", "lucene")
                .setProperty("async", "async")

.setProperty(PropertyStates.createProperty("includePropertyTypes",
ImmutableSet.of(PropertyType.TYPENAME_STRING,
PropertyType.TYPENAME_BINARY), Type.STRINGS))

.setProperty(PropertyStates.createProperty("excludePropertyNames",
ImmutableSet.of("jcr:createdBy", "jcr:lastModifiedBy"), Type.STRINGS))
                .setProperty("reindex", true);

        createDefinition("jcr:path", index);
        createDefinition("ka:assetType", index);
        createDefinition("ka:state", index);
        createDefinition("ka:tags", index);
        createDefinition("ka:id", index);
        createDefinition("ka:principal", index);
        createDefinition("ka:owner", index);
        createDefinition("ka:expire", index);
        createDefinition("title", index);
    }

    private void createDefinition(String definition, NodeBuilder index) {
        IndexUtils.createIndexDefinition(index, definition, true, false,

org.elasticsearch.common.collect.ImmutableList.of(definition), null)
                .setProperty("reindex-async", true)
                .setProperty("reindex", true);

Am wondering, is the query syntax somewhat wrong? Am not sure if the
//*/ in the path is correct?

-- 
-Tor

Re: oak index configuration

Posted by Torgeir Veimo <to...@gmail.com>.
It looks like is the double slash between /jcr:root and content which
causes it to traverse. I'll amend my queries.

On 11 February 2015 at 18:10, Thomas Mueller <mu...@adobe.com> wrote:
> Hi,
>
>>/jcr:root//content//*/element(*,ka:asset)[@ka:assetType = 'company' ]
>>order by @jcr:score
>
> Could you try removing "order by @jcr:score"?
>
> jcr:score has a meaning for full-text queries ("contains..."), but not
> here.
>
> Please note "order by @jcr:score" means low scores come first. To get high
> scores first, you need to use "order by @jcr:score descending".
>
>
> Regards,
> Thomas
>



-- 
-Tor

Re: oak index configuration

Posted by Thomas Mueller <mu...@adobe.com>.
Hi,

>/jcr:root//content//*/element(*,ka:asset)[@ka:assetType = 'company' ]
>order by @jcr:score

Could you try removing "order by @jcr:score"?

jcr:score has a meaning for full-text queries ("contains..."), but not
here.

Please note "order by @jcr:score" means low scores come first. To get high
scores first, you need to use "order by @jcr:score descending".


Regards,
Thomas