Bug 780250 (SOA-2647) - modeshape full-text search
Summary: modeshape full-text search
Keywords:
Status: CLOSED NOTABUG
Alias: SOA-2647
Product: JBoss Enterprise SOA Platform 5
Classification: JBoss
Component: EDS
Version: 5.1.0.ER4
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: ---
Assignee: Van Halbert
QA Contact:
URL: http://jira.jboss.org/jira/browse/SOA...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-12-07 09:24 UTC by Aleksandar Kostadinov
Modified: 2010-12-07 20:50 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-12-07 20:50:43 UTC
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker SOA-2647 0 None None None Never

Description Aleksandar Kostadinov 2010-12-07 09:24:22 UTC
project_key: SOA

      String ftsExpression = "myfile*";
      Query ftsQuery = qm.createQuery(ftsExpression, Query.JCR_SQL2);

This results in javax.jcr.query.InvalidQueryException: The JCR-SQL2 query "myfile*" is not well-formed: Unexpected token 'myfile' at line 1, column 1

I have also tried single/double quoting the word, multiple words, the 'contains(...,...)' syntax but everything results in an InvalidQueryException.

Am I doing anything wrong?

Comment 1 Randall Hauch 2010-12-07 15:50:17 UTC
If you're trying to use the full-text search language, you need to pass the "Search" value (or the JcrRepository.QueryLanguage.SEARCH constant, if you have access to that package on your classpath) as the second parameter to "createQuery".

As you've coded it, you're actually asking ModeShape to treat your query expression as JCR-SQL2. If you'd like to use JCR-SQL2, the equivalent query is:

    SELECT [jcr:primaryType] FROM [nt:base] WHERE CONTAINS( [nt:base].*, "myfile*" )

Comment 2 Randall Hauch 2010-12-07 15:53:01 UTC
In other words, if you want to use the full-text search language, your code should either be:

      String ftsExpression = "myfile*"; 
      Query ftsQuery = qm.createQuery(ftsExpression, JcrRepository.QueryLanguage.SEARCH);

or

      String ftsExpression = "myfile*"; 
      Query ftsQuery = qm.createQuery(ftsExpression, "Search");

or, if you do want to use JCR-SQL2, it should be this:

      String ftsExpression = "SELECT [jcr:primaryType] FROM [nt:base] WHERE CONTAINS( [nt:base].*, 'myfile*' )"; 
      Query ftsQuery = qm.createQuery(ftsExpression, Query.JCR_SQL2);

Comment 3 Van Halbert 2010-12-07 16:03:29 UTC
Comment was provided as to how querying should be performed.

Comment 4 Aleksandar Kostadinov 2010-12-07 20:50:43 UTC
Thanks, that JCR 2 way works.


Note You need to log in before you can comment on or make changes to this bug.