| Summary: | modeshape full-text search | ||
|---|---|---|---|
| Product: | [JBoss] JBoss Enterprise SOA Platform 5 | Reporter: | Aleksandar Kostadinov <akostadinov> |
| Component: | EDS | Assignee: | Van Halbert <vhalbert> |
| Status: | CLOSED NOTABUG | QA Contact: | |
| Severity: | high | Docs Contact: | |
| Priority: | high | ||
| Version: | 5.1.0.ER4 | CC: | rhauch |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| URL: | http://jira.jboss.org/jira/browse/SOA-2647 | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2010-12-07 20:50:43 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
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*" )
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 was provided as to how querying should be performed. Thanks, that JCR 2 way works. |
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?