You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Philipp Bunge (JIRA)" <ji...@apache.org> on 2009/12/01 18:18:20 UTC

[jira] Created: (JCR-2417) RepositoryException when using BindVariables in JCR-SQL2 CONTAINS

RepositoryException when using BindVariables in JCR-SQL2 CONTAINS
-----------------------------------------------------------------

                 Key: JCR-2417
                 URL: https://issues.apache.org/jira/browse/JCR-2417
             Project: Jackrabbit Content Repository
          Issue Type: Bug
          Components: query
    Affects Versions: 2.0-beta3
            Reporter: Philipp Bunge


When using a BindVariable in a JCR-SQL2 CONTAINS constraint, the query fails with a RepositoryException.

For example:

String sql = "SELECT * FROM [nt:unstructured] WHERE ISCHILDNODE([/testroot]) AND CONTAINS(mytext, $searchExpression)";
Query q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2);
q.bindValue("searchExpression", superuser.getValueFactory().createValue("fox"));
q.execute();

Results in:

javax.jcr.RepositoryException: Unknown static operand type: org.apache.jackrabbit.spi.commons.query.qom.BindVariableValueImpl@591a4d
        at org.apache.jackrabbit.core.query.lucene.LuceneQueryFactoryImpl.create(LuceneQueryFactoryImpl.java:215)
        at org.apache.jackrabbit.core.query.lucene.constraint.FullTextConstraint.<init>(FullTextConstraint.java:42)
        at org.apache.jackrabbit.core.query.lucene.constraint.ConstraintBuilder$Visitor.visit(ConstraintBuilder.java:175)
        at org.apache.jackrabbit.spi.commons.query.qom.FullTextSearchImpl.accept(FullTextSearchImpl.java:117)
        at org.apache.jackrabbit.core.query.lucene.constraint.ConstraintBuilder$Visitor.visit(ConstraintBuilder.java:137)
        at org.apache.jackrabbit.spi.commons.query.qom.AndImpl.accept(AndImpl.java:72)
        at org.apache.jackrabbit.core.query.lucene.constraint.ConstraintBuilder.create(ConstraintBuilder.java:82)
        at org.apache.jackrabbit.core.query.lucene.QueryObjectModelImpl.execute(QueryObjectModelImpl.java:109)
        at org.apache.jackrabbit.core.query.QueryImpl.execute(QueryImpl.java:127)

I tried to fix this issue but there is no way to access the BindVariables from the ConstraintBuilder from the LuceneQueryFactoryImpl and the ConstraintBuilder just passes the FullTextSearchImpl QOM subtree to the factory (via FullTextConstraint constructor) without any further visiting. If the signature would be "LuceneQueryFactoryImpl#create(FullTextSearchImpl fts, Value searchExpression)" we could visit the StaticOperand in the ConstraintBuilder and then modify the FullTextSearchImpl constructor accordingly, but this would imply that LuceneQueryFactory interface would need to be change accordingly and I don't know what that would mean.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-2417) RepositoryException when using BindVariables in JCR-SQL2 CONTAINS

Posted by "Philipp Bunge (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2417?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Philipp Bunge updated JCR-2417:
-------------------------------

    Status: Patch Available  (was: Open)

I've attached a patch which offers a possible solution which initializes the LuceneQueryFactoryImpl with the bind variable values and therefore does not require a change of the LuceneQueryFactory interface.

> RepositoryException when using BindVariables in JCR-SQL2 CONTAINS
> -----------------------------------------------------------------
>
>                 Key: JCR-2417
>                 URL: https://issues.apache.org/jira/browse/JCR-2417
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.0-beta3
>            Reporter: Philipp Bunge
>         Attachments: contains_with_bind_variable.patch
>
>
> When using a BindVariable in a JCR-SQL2 CONTAINS constraint, the query fails with a RepositoryException.
> For example:
> String sql = "SELECT * FROM [nt:unstructured] WHERE ISCHILDNODE([/testroot]) AND CONTAINS(mytext, $searchExpression)";
> Query q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2);
> q.bindValue("searchExpression", superuser.getValueFactory().createValue("fox"));
> q.execute();
> Results in:
> javax.jcr.RepositoryException: Unknown static operand type: org.apache.jackrabbit.spi.commons.query.qom.BindVariableValueImpl@591a4d
>         at org.apache.jackrabbit.core.query.lucene.LuceneQueryFactoryImpl.create(LuceneQueryFactoryImpl.java:215)
>         at org.apache.jackrabbit.core.query.lucene.constraint.FullTextConstraint.<init>(FullTextConstraint.java:42)
>         at org.apache.jackrabbit.core.query.lucene.constraint.ConstraintBuilder$Visitor.visit(ConstraintBuilder.java:175)
>         at org.apache.jackrabbit.spi.commons.query.qom.FullTextSearchImpl.accept(FullTextSearchImpl.java:117)
>         at org.apache.jackrabbit.core.query.lucene.constraint.ConstraintBuilder$Visitor.visit(ConstraintBuilder.java:137)
>         at org.apache.jackrabbit.spi.commons.query.qom.AndImpl.accept(AndImpl.java:72)
>         at org.apache.jackrabbit.core.query.lucene.constraint.ConstraintBuilder.create(ConstraintBuilder.java:82)
>         at org.apache.jackrabbit.core.query.lucene.QueryObjectModelImpl.execute(QueryObjectModelImpl.java:109)
>         at org.apache.jackrabbit.core.query.QueryImpl.execute(QueryImpl.java:127)
> I tried to fix this issue but there is no way to access the BindVariables from the ConstraintBuilder from the LuceneQueryFactoryImpl and the ConstraintBuilder just passes the FullTextSearchImpl QOM subtree to the factory (via FullTextConstraint constructor) without any further visiting. If the signature would be "LuceneQueryFactoryImpl#create(FullTextSearchImpl fts, Value searchExpression)" we could visit the StaticOperand in the ConstraintBuilder and then modify the FullTextSearchImpl constructor accordingly, but this would imply that LuceneQueryFactory interface would need to be change accordingly and I don't know what that would mean.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-2417) RepositoryException when using BindVariables in JCR-SQL2 CONTAINS

Posted by "Philipp Bunge (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2417?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Philipp Bunge updated JCR-2417:
-------------------------------

    Attachment: contains_with_bind_variable.patch

A suggested solution for the bug including a corresponding unittest.

> RepositoryException when using BindVariables in JCR-SQL2 CONTAINS
> -----------------------------------------------------------------
>
>                 Key: JCR-2417
>                 URL: https://issues.apache.org/jira/browse/JCR-2417
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.0-beta3
>            Reporter: Philipp Bunge
>         Attachments: contains_with_bind_variable.patch
>
>
> When using a BindVariable in a JCR-SQL2 CONTAINS constraint, the query fails with a RepositoryException.
> For example:
> String sql = "SELECT * FROM [nt:unstructured] WHERE ISCHILDNODE([/testroot]) AND CONTAINS(mytext, $searchExpression)";
> Query q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2);
> q.bindValue("searchExpression", superuser.getValueFactory().createValue("fox"));
> q.execute();
> Results in:
> javax.jcr.RepositoryException: Unknown static operand type: org.apache.jackrabbit.spi.commons.query.qom.BindVariableValueImpl@591a4d
>         at org.apache.jackrabbit.core.query.lucene.LuceneQueryFactoryImpl.create(LuceneQueryFactoryImpl.java:215)
>         at org.apache.jackrabbit.core.query.lucene.constraint.FullTextConstraint.<init>(FullTextConstraint.java:42)
>         at org.apache.jackrabbit.core.query.lucene.constraint.ConstraintBuilder$Visitor.visit(ConstraintBuilder.java:175)
>         at org.apache.jackrabbit.spi.commons.query.qom.FullTextSearchImpl.accept(FullTextSearchImpl.java:117)
>         at org.apache.jackrabbit.core.query.lucene.constraint.ConstraintBuilder$Visitor.visit(ConstraintBuilder.java:137)
>         at org.apache.jackrabbit.spi.commons.query.qom.AndImpl.accept(AndImpl.java:72)
>         at org.apache.jackrabbit.core.query.lucene.constraint.ConstraintBuilder.create(ConstraintBuilder.java:82)
>         at org.apache.jackrabbit.core.query.lucene.QueryObjectModelImpl.execute(QueryObjectModelImpl.java:109)
>         at org.apache.jackrabbit.core.query.QueryImpl.execute(QueryImpl.java:127)
> I tried to fix this issue but there is no way to access the BindVariables from the ConstraintBuilder from the LuceneQueryFactoryImpl and the ConstraintBuilder just passes the FullTextSearchImpl QOM subtree to the factory (via FullTextConstraint constructor) without any further visiting. If the signature would be "LuceneQueryFactoryImpl#create(FullTextSearchImpl fts, Value searchExpression)" we could visit the StaticOperand in the ConstraintBuilder and then modify the FullTextSearchImpl constructor accordingly, but this would imply that LuceneQueryFactory interface would need to be change accordingly and I don't know what that would mean.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-2417) RepositoryException when using BindVariables in JCR-SQL2 CONTAINS

Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2417?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marcel Reutegger updated JCR-2417:
----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.0
           Status: Resolved  (was: Patch Available)

Applied patch with minor changes (see below) to trunk in revision: 907659

Fixed a minor javadoc issue and exception type in LuceneQueryFactoryImpl.

Thanks a lot for the patch.

> RepositoryException when using BindVariables in JCR-SQL2 CONTAINS
> -----------------------------------------------------------------
>
>                 Key: JCR-2417
>                 URL: https://issues.apache.org/jira/browse/JCR-2417
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.0-beta3, 2.0.0
>            Reporter: Philipp Bunge
>             Fix For: 2.1.0
>
>         Attachments: contains_with_bind_variable.patch
>
>
> When using a BindVariable in a JCR-SQL2 CONTAINS constraint, the query fails with a RepositoryException.
> For example:
> String sql = "SELECT * FROM [nt:unstructured] WHERE ISCHILDNODE([/testroot]) AND CONTAINS(mytext, $searchExpression)";
> Query q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2);
> q.bindValue("searchExpression", superuser.getValueFactory().createValue("fox"));
> q.execute();
> Results in:
> javax.jcr.RepositoryException: Unknown static operand type: org.apache.jackrabbit.spi.commons.query.qom.BindVariableValueImpl@591a4d
>         at org.apache.jackrabbit.core.query.lucene.LuceneQueryFactoryImpl.create(LuceneQueryFactoryImpl.java:215)
>         at org.apache.jackrabbit.core.query.lucene.constraint.FullTextConstraint.<init>(FullTextConstraint.java:42)
>         at org.apache.jackrabbit.core.query.lucene.constraint.ConstraintBuilder$Visitor.visit(ConstraintBuilder.java:175)
>         at org.apache.jackrabbit.spi.commons.query.qom.FullTextSearchImpl.accept(FullTextSearchImpl.java:117)
>         at org.apache.jackrabbit.core.query.lucene.constraint.ConstraintBuilder$Visitor.visit(ConstraintBuilder.java:137)
>         at org.apache.jackrabbit.spi.commons.query.qom.AndImpl.accept(AndImpl.java:72)
>         at org.apache.jackrabbit.core.query.lucene.constraint.ConstraintBuilder.create(ConstraintBuilder.java:82)
>         at org.apache.jackrabbit.core.query.lucene.QueryObjectModelImpl.execute(QueryObjectModelImpl.java:109)
>         at org.apache.jackrabbit.core.query.QueryImpl.execute(QueryImpl.java:127)
> I tried to fix this issue but there is no way to access the BindVariables from the ConstraintBuilder from the LuceneQueryFactoryImpl and the ConstraintBuilder just passes the FullTextSearchImpl QOM subtree to the factory (via FullTextConstraint constructor) without any further visiting. If the signature would be "LuceneQueryFactoryImpl#create(FullTextSearchImpl fts, Value searchExpression)" we could visit the StaticOperand in the ConstraintBuilder and then modify the FullTextSearchImpl constructor accordingly, but this would imply that LuceneQueryFactory interface would need to be change accordingly and I don't know what that would mean.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-2417) RepositoryException when using BindVariables in JCR-SQL2 CONTAINS

Posted by "Philipp Bunge (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2417?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Philipp Bunge updated JCR-2417:
-------------------------------

    Attachment:     (was: contains_with_bind_variable.patch)

> RepositoryException when using BindVariables in JCR-SQL2 CONTAINS
> -----------------------------------------------------------------
>
>                 Key: JCR-2417
>                 URL: https://issues.apache.org/jira/browse/JCR-2417
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.0-beta3, 2.0.0
>            Reporter: Philipp Bunge
>         Attachments: contains_with_bind_variable.patch
>
>
> When using a BindVariable in a JCR-SQL2 CONTAINS constraint, the query fails with a RepositoryException.
> For example:
> String sql = "SELECT * FROM [nt:unstructured] WHERE ISCHILDNODE([/testroot]) AND CONTAINS(mytext, $searchExpression)";
> Query q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2);
> q.bindValue("searchExpression", superuser.getValueFactory().createValue("fox"));
> q.execute();
> Results in:
> javax.jcr.RepositoryException: Unknown static operand type: org.apache.jackrabbit.spi.commons.query.qom.BindVariableValueImpl@591a4d
>         at org.apache.jackrabbit.core.query.lucene.LuceneQueryFactoryImpl.create(LuceneQueryFactoryImpl.java:215)
>         at org.apache.jackrabbit.core.query.lucene.constraint.FullTextConstraint.<init>(FullTextConstraint.java:42)
>         at org.apache.jackrabbit.core.query.lucene.constraint.ConstraintBuilder$Visitor.visit(ConstraintBuilder.java:175)
>         at org.apache.jackrabbit.spi.commons.query.qom.FullTextSearchImpl.accept(FullTextSearchImpl.java:117)
>         at org.apache.jackrabbit.core.query.lucene.constraint.ConstraintBuilder$Visitor.visit(ConstraintBuilder.java:137)
>         at org.apache.jackrabbit.spi.commons.query.qom.AndImpl.accept(AndImpl.java:72)
>         at org.apache.jackrabbit.core.query.lucene.constraint.ConstraintBuilder.create(ConstraintBuilder.java:82)
>         at org.apache.jackrabbit.core.query.lucene.QueryObjectModelImpl.execute(QueryObjectModelImpl.java:109)
>         at org.apache.jackrabbit.core.query.QueryImpl.execute(QueryImpl.java:127)
> I tried to fix this issue but there is no way to access the BindVariables from the ConstraintBuilder from the LuceneQueryFactoryImpl and the ConstraintBuilder just passes the FullTextSearchImpl QOM subtree to the factory (via FullTextConstraint constructor) without any further visiting. If the signature would be "LuceneQueryFactoryImpl#create(FullTextSearchImpl fts, Value searchExpression)" we could visit the StaticOperand in the ConstraintBuilder and then modify the FullTextSearchImpl constructor accordingly, but this would imply that LuceneQueryFactory interface would need to be change accordingly and I don't know what that would mean.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-2417) RepositoryException when using BindVariables in JCR-SQL2 CONTAINS

Posted by "Philipp Bunge (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2417?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Philipp Bunge updated JCR-2417:
-------------------------------

    Attachment: contains_with_bind_variable.patch

Fixed license header.

> RepositoryException when using BindVariables in JCR-SQL2 CONTAINS
> -----------------------------------------------------------------
>
>                 Key: JCR-2417
>                 URL: https://issues.apache.org/jira/browse/JCR-2417
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.0-beta3, 2.0.0
>            Reporter: Philipp Bunge
>         Attachments: contains_with_bind_variable.patch
>
>
> When using a BindVariable in a JCR-SQL2 CONTAINS constraint, the query fails with a RepositoryException.
> For example:
> String sql = "SELECT * FROM [nt:unstructured] WHERE ISCHILDNODE([/testroot]) AND CONTAINS(mytext, $searchExpression)";
> Query q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2);
> q.bindValue("searchExpression", superuser.getValueFactory().createValue("fox"));
> q.execute();
> Results in:
> javax.jcr.RepositoryException: Unknown static operand type: org.apache.jackrabbit.spi.commons.query.qom.BindVariableValueImpl@591a4d
>         at org.apache.jackrabbit.core.query.lucene.LuceneQueryFactoryImpl.create(LuceneQueryFactoryImpl.java:215)
>         at org.apache.jackrabbit.core.query.lucene.constraint.FullTextConstraint.<init>(FullTextConstraint.java:42)
>         at org.apache.jackrabbit.core.query.lucene.constraint.ConstraintBuilder$Visitor.visit(ConstraintBuilder.java:175)
>         at org.apache.jackrabbit.spi.commons.query.qom.FullTextSearchImpl.accept(FullTextSearchImpl.java:117)
>         at org.apache.jackrabbit.core.query.lucene.constraint.ConstraintBuilder$Visitor.visit(ConstraintBuilder.java:137)
>         at org.apache.jackrabbit.spi.commons.query.qom.AndImpl.accept(AndImpl.java:72)
>         at org.apache.jackrabbit.core.query.lucene.constraint.ConstraintBuilder.create(ConstraintBuilder.java:82)
>         at org.apache.jackrabbit.core.query.lucene.QueryObjectModelImpl.execute(QueryObjectModelImpl.java:109)
>         at org.apache.jackrabbit.core.query.QueryImpl.execute(QueryImpl.java:127)
> I tried to fix this issue but there is no way to access the BindVariables from the ConstraintBuilder from the LuceneQueryFactoryImpl and the ConstraintBuilder just passes the FullTextSearchImpl QOM subtree to the factory (via FullTextConstraint constructor) without any further visiting. If the signature would be "LuceneQueryFactoryImpl#create(FullTextSearchImpl fts, Value searchExpression)" we could visit the StaticOperand in the ConstraintBuilder and then modify the FullTextSearchImpl constructor accordingly, but this would imply that LuceneQueryFactory interface would need to be change accordingly and I don't know what that would mean.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-2417) RepositoryException when using BindVariables in JCR-SQL2 CONTAINS

Posted by "Philipp Bunge (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2417?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Philipp Bunge updated JCR-2417:
-------------------------------

    Affects Version/s: 2.0.0

> RepositoryException when using BindVariables in JCR-SQL2 CONTAINS
> -----------------------------------------------------------------
>
>                 Key: JCR-2417
>                 URL: https://issues.apache.org/jira/browse/JCR-2417
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.0-beta3, 2.0.0
>            Reporter: Philipp Bunge
>         Attachments: contains_with_bind_variable.patch
>
>
> When using a BindVariable in a JCR-SQL2 CONTAINS constraint, the query fails with a RepositoryException.
> For example:
> String sql = "SELECT * FROM [nt:unstructured] WHERE ISCHILDNODE([/testroot]) AND CONTAINS(mytext, $searchExpression)";
> Query q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2);
> q.bindValue("searchExpression", superuser.getValueFactory().createValue("fox"));
> q.execute();
> Results in:
> javax.jcr.RepositoryException: Unknown static operand type: org.apache.jackrabbit.spi.commons.query.qom.BindVariableValueImpl@591a4d
>         at org.apache.jackrabbit.core.query.lucene.LuceneQueryFactoryImpl.create(LuceneQueryFactoryImpl.java:215)
>         at org.apache.jackrabbit.core.query.lucene.constraint.FullTextConstraint.<init>(FullTextConstraint.java:42)
>         at org.apache.jackrabbit.core.query.lucene.constraint.ConstraintBuilder$Visitor.visit(ConstraintBuilder.java:175)
>         at org.apache.jackrabbit.spi.commons.query.qom.FullTextSearchImpl.accept(FullTextSearchImpl.java:117)
>         at org.apache.jackrabbit.core.query.lucene.constraint.ConstraintBuilder$Visitor.visit(ConstraintBuilder.java:137)
>         at org.apache.jackrabbit.spi.commons.query.qom.AndImpl.accept(AndImpl.java:72)
>         at org.apache.jackrabbit.core.query.lucene.constraint.ConstraintBuilder.create(ConstraintBuilder.java:82)
>         at org.apache.jackrabbit.core.query.lucene.QueryObjectModelImpl.execute(QueryObjectModelImpl.java:109)
>         at org.apache.jackrabbit.core.query.QueryImpl.execute(QueryImpl.java:127)
> I tried to fix this issue but there is no way to access the BindVariables from the ConstraintBuilder from the LuceneQueryFactoryImpl and the ConstraintBuilder just passes the FullTextSearchImpl QOM subtree to the factory (via FullTextConstraint constructor) without any further visiting. If the signature would be "LuceneQueryFactoryImpl#create(FullTextSearchImpl fts, Value searchExpression)" we could visit the StaticOperand in the ConstraintBuilder and then modify the FullTextSearchImpl constructor accordingly, but this would imply that LuceneQueryFactory interface would need to be change accordingly and I don't know what that would mean.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.