Changeset 33305 for main

Show
Ignore:
Timestamp:
08.07.2019 13:39:51 (6 weeks ago)
Author:
kjdon
Message:

get the list of level ids (= shortnames) and store it locally. This way solr search can use it to determine what cores it needs to load. (sidx/didx). so now in getLevelData, we already have level_ids, just need to get level_names.

Files:
1 modified

Legend:

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

    r33279 r33305  
    8282    protected String NOT_OPERATOR = "!"; 
    8383 
     84        // what levels we support 
     85        protected ArrayList<String> level_ids = null; 
    8486    // the default level for searching 
    8587    protected String default_level = null; 
     
    206208            } 
    207209 
     210            // lets add displayinfo from collectionConfig into the level elements from buildConfig - 
     211            // so we can easily find them later. 
     212            // will also store a list of level ids so we can easily see which levels we have 
    208213            Document owner = info.getOwnerDocument(); 
    209214 
     215            level_ids = new ArrayList<String>(); 
    210216            NodeList levels = info.getElementsByTagName(GSXML.LEVEL_ELEM); 
    211  
     217             
    212218            for (int i = 0; i < levels.getLength(); i++) 
    213             { 
    214                 Element lev = (Element) levels.item(i); 
     219              { 
     220                    Element lev = (Element) levels.item(i); 
     221                    String shortname = lev.getAttribute(GSXML.SHORTNAME_ATT); 
     222                if (shortname.equals("")) 
     223                  { 
     224                    continue; 
     225                  } 
     226                level_ids.add(shortname); 
     227                 
    215228                String name = lev.getAttribute(GSXML.NAME_ATT); 
    216229                Element node_extra = GSXML.getNamedElement(config_search, GSXML.LEVEL_ELEM, GSXML.NAME_ATT, name); 
     
    231244                    } 
    232245                } 
    233             } // for each level 
     246              }// for each level 
    234247        } 
    235248        else 
    236249        { 
    237             // for soem reason we don't have the collectionConfig file. assume plain only 
     250            // for some reason we don't have the collectionConfig file. assume plain only 
    238251            this.plain_search = true; 
    239252        } 
     
    478491        if (name.equals(LEVEL_PARAM)) 
    479492        { 
    480             ArrayList<String> level_ids = new ArrayList<String>(); 
    481493            ArrayList<String> level_names = new ArrayList<String>(); 
    482             getLevelData(level_ids, level_names, lang); 
     494            getLevelData(level_names, lang); 
    483495            if (level_ids.size() > 1) 
    484496            { 
     
    552564 
    553565    // should cache some of this 
    554     protected void getLevelData(ArrayList<String> level_ids, ArrayList<String> level_names, String lang) 
     566  protected void getLevelData(ArrayList<String> level_names, String lang) 
    555567    { 
    556568        Element level_list = (Element) GSXML.getChildByTagName(this.config_info, LEVEL_ELEM + GSXML.LIST_MODIFIER); 
    557         NodeList levels = level_list.getElementsByTagName(LEVEL_ELEM); 
    558         for (int i = 0; i < levels.getLength(); i++) 
    559         { 
    560             Element level = (Element) levels.item(i); 
    561             String shortname = level.getAttribute(GSXML.SHORTNAME_ATT); 
    562             if (shortname.equals("")) 
    563             { 
    564                 continue; 
    565             } 
    566             level_ids.add(shortname); 
     569        for (int i=0; i<level_ids.size(); i++) { 
     570          Element level = GSXML.getNamedElement(level_list, GSXML.LEVEL_ELEM, GSXML.SHORTNAME_ATT, level_ids.get(i)); 
    567571            String display_name = getDisplayText(level, GSXML.DISPLAY_TEXT_NAME, lang, "en"); 
    568572            if (display_name.equals("")) 
     
    572576                if (display_name.equals("")) 
    573577                { 
    574                     display_name = shortname; 
     578                  display_name = level_ids.get(i); // shortname 
    575579                } 
    576580                else 
     
    582586        } 
    583587    } 
     588 
    584589 
    585590    // the following three functions are needed so the base class can