Author: Maital Ashkenazi
Date: 2010-07-22 06:59:50 -0700 (Thu, 22 Jul 2010)
New Revision: 20991

Modified:
   
csplugins/trunk/soc/maital/EnhancedSearch2/src/csplugins/enhanced/search/EnhancedSearchIndex.java
   
csplugins/trunk/soc/maital/EnhancedSearch2/src/csplugins/enhanced/search/EnhancedSearchPanel.java
   
csplugins/trunk/soc/maital/EnhancedSearch2/src/csplugins/enhanced/search/EnhancedSearchQuery.java
Log:
remove dependency on quick_find AttributeUtils. Allow leading wildcard search.

Modified: 
csplugins/trunk/soc/maital/EnhancedSearch2/src/csplugins/enhanced/search/EnhancedSearchIndex.java
===================================================================
--- 
csplugins/trunk/soc/maital/EnhancedSearch2/src/csplugins/enhanced/search/EnhancedSearchIndex.java
   2010-07-21 23:02:47 UTC (rev 20990)
+++ 
csplugins/trunk/soc/maital/EnhancedSearch2/src/csplugins/enhanced/search/EnhancedSearchIndex.java
   2010-07-22 13:59:50 UTC (rev 20991)
@@ -37,6 +37,8 @@
 
 import java.io.IOException;
 import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 import cytoscape.Cytoscape;
 import cytoscape.CyNode;
@@ -45,7 +47,6 @@
 import cytoscape.data.CyAttributes;
 
 import csplugins.enhanced.search.util.EnhancedSearchUtils;
-import csplugins.quickfind.util.CyAttributesUtil;
 
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.NumericField;
@@ -160,23 +161,39 @@
                                        doc.add(new Field(attrIndexingName, 
attrValue,
                                                        Field.Store.NO, 
Field.Index.ANALYZED));
 
-                               } else if (valueType == 
CyAttributes.TYPE_SIMPLE_LIST
-                                               || valueType == 
CyAttributes.TYPE_SIMPLE_MAP) {
+                               // Attributes of type TYPE_SIMPLE_LIST may have 
several values.
+                               // Create a document for each value.
+                               } else if (valueType == 
CyAttributes.TYPE_SIMPLE_LIST) {
+                                       List list = 
attributes.getListAttribute(identifier, attrName);
 
-                                       // Attributes of types TYPE_SIMPLE_LIST 
and TYPE_SIMPLE_MAP
-                                       // may have several values.
-                                       // Create a document for each value.
-                                       String[] valueList = 
CyAttributesUtil.getAttributeValues(
-                                                       attributes, identifier, 
attrName);
-                                       if (valueList != null) {
+                                       //  Iterate through all elements in the 
list
+                                       if ((list != null) && (list.size() > 
0)) {
+                                               for (int index = 0; index < 
list.size(); index++) {
+                                                       Object o = 
list.get(index);
+                                                       String attrValue = 
o.toString();
 
-                                               for (int j = 0; j < 
valueList.length; j++) {
-                                                       String attrValue = 
valueList[j];
+                                                       doc.add(new 
Field(attrIndexingName, attrValue,
+                                                                       
Field.Store.NO, Field.Index.ANALYZED));
+                                               }
+                                       }
 
+                               // Attributes of type TYPE_SIMPLE_MAP may have 
several values.
+                               // Create a document for each value.
+                               } else if (valueType == 
CyAttributes.TYPE_SIMPLE_MAP) {
+                                       Map map = 
attributes.getMapAttribute(identifier, attrName);
+
+                                       //  Iterate through all values in the 
map
+                                       if ((map != null) && (map.size() > 0)) {
+                                               Iterator mapIterator = 
map.values().iterator();
+                                               while (mapIterator.hasNext()) {
+                                                       Object o = 
mapIterator.next();
+                                                       String attrValue = 
o.toString();
+
                                                        doc.add(new 
Field(attrIndexingName, attrValue,
                                                                        
Field.Store.NO, Field.Index.ANALYZED));
                                                }
                                        }
+
                                } else if (valueType == 
CyAttributes.TYPE_COMPLEX) {
                                        // Do not index this field
                                }

Modified: 
csplugins/trunk/soc/maital/EnhancedSearch2/src/csplugins/enhanced/search/EnhancedSearchPanel.java
===================================================================
--- 
csplugins/trunk/soc/maital/EnhancedSearch2/src/csplugins/enhanced/search/EnhancedSearchPanel.java
   2010-07-21 23:02:47 UTC (rev 20990)
+++ 
csplugins/trunk/soc/maital/EnhancedSearch2/src/csplugins/enhanced/search/EnhancedSearchPanel.java
   2010-07-22 13:59:50 UTC (rev 20991)
@@ -70,7 +70,7 @@
 
        private JLabel label;
 
-       private static final String ESP_LABEL = "ESP 3.0.1:  ";
+       private static final String ESP_LABEL = "Enhanced Search:  ";
 
        private static final String SEARCH_MENU_ITEM = "Search";
 

Modified: 
csplugins/trunk/soc/maital/EnhancedSearch2/src/csplugins/enhanced/search/EnhancedSearchQuery.java
===================================================================
--- 
csplugins/trunk/soc/maital/EnhancedSearch2/src/csplugins/enhanced/search/EnhancedSearchQuery.java
   2010-07-21 23:02:47 UTC (rev 20990)
+++ 
csplugins/trunk/soc/maital/EnhancedSearch2/src/csplugins/enhanced/search/EnhancedSearchQuery.java
   2010-07-22 13:59:50 UTC (rev 20991)
@@ -94,6 +94,7 @@
                // Build a Query object.
                // CustomMultiFieldQueryParser is used to support range queries 
on numerical attribute fields.
                CustomMultiFieldQueryParser queryParser = new 
CustomMultiFieldQueryParser(Version.LUCENE_30, attFields, analyzer);
+               queryParser.setAllowLeadingWildcard(true);
 
                try {
                        // Execute query

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to