jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Zahler <ben.zah...@inside-solutions.ch>
Subject Oak Property Index Question
Date Thu, 13 Mar 2014 17:41:19 GMT
Hi all,
I am currently writing a training for Oak Users and have found an issue with query indexing
where things to not work as expected.

I execute the following query:
String expression = "SELECT *  FROM [nt:base] WHERE trainingProperty > 10";
Query query = queryManager.createQuery(expression,Query.JCR_SQL2);

As expected, I get the message
 WARN  o.a.j.o.s.q.Cursors$TraversingCursor - Traversed 1000 nodes with filter Filter(query=SELECT
*  FROM [nt:base] WHERE trainingProperty > 10, path=/*, property=[trainingProperty=(10..]);
consider creating an index or changing the query

However, I did not manage to create a PropertyIndex to index the query.

Here is the code that  I used to create the index:

            Node propertyIndexNode = session.getNode("/oak:index").addNode("testIndex", "oak:QueryIndexDefinition");
            propertyIndexNode.setProperty("type", "property") ;
            propertyIndexNode.setProperty("propertyNames", "trainingProperty");
            propertyIndexNode.setProperty("unique", false);
            propertyIndexNode.setProperty("reindex", true);
            session.save();

>From what I read, I would expect the query to be indexed with that node, but I still get
the message above.
Is there anything that I missed?

A running java sample (requiring some oak imports) is attached.

Regards,
Ben Zahler
Inside Solutions AG | Felsenstrasse 11 | 4450 Sissach | Schweiz
Telefon: +41 61 551 00 40 | Direkt: +41 61 551 00 43
http://www.inside-solutions.ch<http://www.inside-solutions.ch/>

Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message