jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r191784 - /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java
Date Wed, 22 Jun 2005 08:59:23 GMT
Author: mreutegg
Date: Wed Jun 22 01:59:21 2005
New Revision: 191784

URL: http://svn.apache.org/viewcvs?rev=191784&view=rev
Log:
JCR-143: Query for string literal broken when literal can be coerced into other type

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java?rev=191784&r1=191783&r2=191784&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryBuilder.java
Wed Jun 22 01:59:21 2005
@@ -775,6 +775,9 @@
             }
         }
         if (values.size() == 0) {
+            // use literal as is then try to guess other types
+            values.add(literal);
+
             // try to guess property type
             if (literal.indexOf('/') > -1) {
                 // might be a path
@@ -784,17 +787,17 @@
                 } catch (Exception e) {
                     // not a path
                 }
-            } else if (XMLChar.isValidName(literal)) {
+            }
+            if (XMLChar.isValidName(literal)) {
                 // might be a name
                 try {
                     values.add(nsMappings.translatePropertyName(literal, session.getNamespaceResolver()));
                     log.debug("Coerced " + literal + " into NAME.");
-                    // also add literal as string value as is
-                    values.add(literal);
                 } catch (Exception e) {
                     // not a name
                 }
-            } else if (literal.indexOf(':') > -1) {
+            }
+            if (literal.indexOf(':') > -1) {
                 // is it a date?
                 Calendar c = ISO8601.parse(literal);
                 if (c != null) {



Mime
View raw message