Changeset 26130

Show
Ignore:
Timestamp:
27.08.2012 16:38:59 (7 years ago)
Author:
ak19
Message:

custom indexSubcollection displayItems now show up in Form Search. This was also necessary in the enhanced Tudor tutorial, where search partitions are created and users are asked to provide custom displayNames for these.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractGS2TextSearch.java

    r26046 r26130  
    182182        { 
    183183            Document owner = info.getOwnerDocument(); 
    184             // so far we have index specific display elements, and global format elements  
     184            Element config_search = (Element) GSXML.getChildByTagName(extra_info, GSXML.SEARCH_ELEM); 
     185 
     186            // so far we have index and indexSubcollection specific display elements, and global format elements  
     187 
    185188            NodeList indexes = info.getElementsByTagName(GSXML.INDEX_ELEM); 
    186             Element config_search = (Element) GSXML.getChildByTagName(extra_info, GSXML.SEARCH_ELEM); 
    187  
    188189            for (int i = 0; i < indexes.getLength(); i++) 
    189190            { 
     
    208209                } 
    209210            } // for each index 
     211 
     212            NodeList indexSubcollections = info.getElementsByTagName(INDEX_SUBCOLLECTION_ELEM); // buildConfig.xml 
     213 
     214            for (int i = 0; i < indexSubcollections.getLength(); i++) 
     215            { 
     216                Element indexSubcollection = (Element) indexSubcollections.item(i); 
     217                String name = indexSubcollection.getAttribute(GSXML.NAME_ATT); 
     218                Element node_extra = GSXML.getNamedElement(config_search, INDEX_SUBCOLLECTION_ELEM, GSXML.NAME_ATT, name); // collectionConfig.xml 
     219                if (node_extra == null) 
     220                { 
     221                    logger.error("haven't found extra info for indexSubCollection named " + name); 
     222                    continue; 
     223                } 
     224 
     225                // get the display elements if any - displayName 
     226                NodeList display_names = node_extra.getElementsByTagName(GSXML.DISPLAY_TEXT_ELEM); 
     227                if (display_names != null) 
     228                { 
     229                    for (int j = 0; j < display_names.getLength(); j++) 
     230                    { 
     231                        Element e = (Element) display_names.item(j); 
     232                        indexSubcollection.appendChild(owner.importNode(e, true)); 
     233                    } 
     234                } 
     235            } // for each indexSubCollection 
    210236        } 
    211237        return true;