Ignore:
Timestamp:
2012-06-28T16:35:14+12:00 (12 years ago)
Author:
sjm84
Message:

Removed the Solr code from the main greenstone code

File:
1 edited

Legend:

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

    r25850 r25885  
    305305                    createParameter(INDEX_LANGUAGE_PARAM, param_list, lang);
    306306                }
    307                
     307
    308308                if (does_paging)
    309309                {
     
    311311                    createParameter(START_PAGE_PARAM, param_list, lang);
    312312                }
    313                
     313
    314314                // create a multi param for the fields etc
    315315                // text box, field
     
    665665        addTermInfo(term_list, params, query_result);
    666666
    667         if (query_result instanceof SolrQueryResult)
    668         {
    669             Element facet_list = this.doc.createElement(GSXML.FACET_ELEM + GSXML.LIST_MODIFIER);
    670             result.appendChild(facet_list);
    671 
    672             if(((SolrQueryResult) query_result).getFacetResults() != null)
    673             {
    674                 for (FacetField facet : ((SolrQueryResult) query_result).getFacetResults())
     667        if(does_faceting)
     668        {
     669            ArrayList<FacetWrapper> facets = getFacets(query_result);
     670            if(facets != null)
     671            {
     672                Element facet_list = this.doc.createElement(GSXML.FACET_ELEM + GSXML.LIST_MODIFIER);
     673                result.appendChild(facet_list);
     674
     675                for(FacetWrapper currentFacet : facets)
    675676                {
    676677                    Element facet_elem = this.doc.createElement(GSXML.FACET_ELEM);
    677                     facet_elem.setAttribute(GSXML.NAME_ATT, facet.getName());
    678    
    679                     for (FacetField.Count count : facet.getValues())
     678                    facet_elem.setAttribute(GSXML.NAME_ATT, currentFacet.getName());
     679                    facet_list.appendChild(facet_elem);
     680                   
     681                    HashMap<String, Long> countMap = currentFacet.getCounts();
     682                   
     683                    for(String countName : countMap.keySet())
    680684                    {
    681                         if (count.getCount() > 0)
     685                        long countValue = countMap.get(countName);
     686                        if(countValue > 0)
    682687                        {
    683688                            Element count_elem = this.doc.createElement(GSXML.COUNT_ELEM);
    684                             count_elem.setAttribute(GSXML.NAME_ATT, count.getName());
    685                             count_elem.setTextContent("" + count.getCount());
    686    
     689                            count_elem.setAttribute(GSXML.NAME_ATT, countName);
     690                            count_elem.setTextContent("" + countValue);
     691
    687692                            facet_elem.appendChild(count_elem);
    688693                        }
    689694                    }
    690                     facet_list.appendChild(facet_elem);
    691695                }
    692696            }
     
    712716    /** get the list of doc ranks */
    713717    abstract protected String[] getDocRanks(Object query_result);
     718   
     719    /** get the list of facets */
     720    abstract protected ArrayList<FacetWrapper> getFacets(Object query_result);
    714721
    715722    /** add in term info if available */
Note: See TracChangeset for help on using the changeset viewer.