jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r190589 - in /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query: TextFilterService.java lucene/NodeIndexer.java
Date Tue, 14 Jun 2005 13:17:03 GMT
Author: mreutegg
Date: Tue Jun 14 06:17:00 2005
New Revision: 190589

URL: http://svn.apache.org/viewcvs?rev=190589&view=rev
Log:
- jcr:encoding property is optional

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

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/TextFilterService.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/TextFilterService.java?rev=190589&r1=190588&r2=190589&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/TextFilterService.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/TextFilterService.java
Tue Jun 14 06:17:00 2005
@@ -80,6 +80,8 @@
      *
      * @param data     the binary data
      * @param mimeType the mime type
+     * @param encoding the encoding of the binary data or <code>null</code> if
+     *   the data does not have an encoding or it is unknown.
      * @return the extracted content
      * @throws RepositoryException if an error occurs while creating the index
      *                             layout. This includes the case where

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java?rev=190589&r1=190588&r2=190589&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
Tue Jun 14 06:17:00 2005
@@ -260,17 +260,22 @@
                 // don't know how to index
                 return;
             }
-            if (node.hasPropertyEntry(JCR_ENCODING)
-                    && node.hasPropertyEntry(JCR_MIMETYPE)) {
+            if (node.hasPropertyEntry(JCR_MIMETYPE)) {
                 PropertyState dataProp = (PropertyState) stateProvider.getItemState(new PropertyId(node.getUUID(),
JCR_DATA));
                 PropertyState mimeTypeProp =
                     (PropertyState) stateProvider.getItemState(new PropertyId(node.getUUID(),
JCR_MIMETYPE));
-                PropertyState encodingProp =
-                    (PropertyState) stateProvider.getItemState(new PropertyId(node.getUUID(),
JCR_ENCODING));
+
+                // jcr:encoding is not mandatory
+                String encoding = null;
+                if (node.hasPropertyEntry(JCR_ENCODING)) {
+                    PropertyState encodingProp =
+                        (PropertyState) stateProvider.getItemState(new PropertyId(node.getUUID(),
JCR_ENCODING));
+                    encodingProp.getValues()[0].internalValue().toString();
+                }
 
                 Map fields = TextFilterService.extractText(dataProp,
                         mimeTypeProp.getValues()[0].internalValue().toString(),
-                        encodingProp.getValues()[0].internalValue().toString());
+                        encoding);
                 for (Iterator it = fields.keySet().iterator(); it.hasNext();) {
                     String field = (String) it.next();
                     Reader r = (Reader) fields.get(field);



Mime
View raw message