[dna-commits] DNA SVN: r1573 - trunk/extensions/dna-search-lucene/src/main/java/org/jboss/dna/search/lucene.

dna-commits at lists.jboss.org dna-commits at lists.jboss.org
Sat Jan 9 16:30:51 EST 2010


Author: rhauch
Date: 2010-01-09 16:30:51 -0500 (Sat, 09 Jan 2010)
New Revision: 1573

Modified:
   trunk/extensions/dna-search-lucene/src/main/java/org/jboss/dna/search/lucene/LuceneSearchSession.java
Log:
Added the name of the nodes to be included in full-text searches.

Modified: trunk/extensions/dna-search-lucene/src/main/java/org/jboss/dna/search/lucene/LuceneSearchSession.java
===================================================================
--- trunk/extensions/dna-search-lucene/src/main/java/org/jboss/dna/search/lucene/LuceneSearchSession.java	2010-01-09 21:30:31 UTC (rev 1572)
+++ trunk/extensions/dna-search-lucene/src/main/java/org/jboss/dna/search/lucene/LuceneSearchSession.java	2010-01-09 21:30:51 UTC (rev 1573)
@@ -380,9 +380,12 @@
             }
         }
 
+        // Always include the local name in the full-text search field ...
+        StringBuilder fullTextSearchValue = new StringBuilder();
+        fullTextSearchValue.append(localNameStr);
+
         // Index the properties
         String stringValue = null;
-        StringBuilder fullTextSearchValue = null;
         for (Property property : properties) {
             Name name = property.getName();
             Rule rule = workspace.rules.getRule(name);
@@ -446,12 +449,7 @@
 
                 if (rule.getIndexOption() != Field.Index.NO) {
                     // This field is to be full-text searchable ...
-                    if (fullTextSearchValue == null) {
-                        fullTextSearchValue = new StringBuilder();
-                    } else {
-                        fullTextSearchValue.append(' ');
-                    }
-                    fullTextSearchValue.append(stringValue);
+                    fullTextSearchValue.append(' ').append(stringValue);
 
                     // Also create a full-text-searchable field ...
                     String fullTextNameString = processor.fullTextFieldName(nameString);
@@ -460,7 +458,7 @@
             }
         }
         // Add the full-text-search field ...
-        if (fullTextSearchValue != null && fullTextSearchValue.length() != 0) {
+        if (fullTextSearchValue.length() != 0) {
             doc.add(new Field(ContentIndex.FULL_TEXT, fullTextSearchValue.toString(), Field.Store.NO, Field.Index.ANALYZED));
         }
         getContentWriter().updateDocument(new Term(ContentIndex.PATH, pathStr), doc);



More information about the dna-commits mailing list