jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcel Reutegger (JIRA)" <j...@apache.org>
Subject [jira] Updated: (JCR-2417) RepositoryException when using BindVariables in JCR-SQL2 CONTAINS
Date Mon, 08 Feb 2010 14:07:27 GMT

     [ 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.


Mime
View raw message