Changeset 29217


Ignore:
Timestamp:
08/19/14 19:40:31 (7 years ago)
Author:
ak19
Message:

Terms must be found in a sorlCore (sidx or didx) of THIS collection, not in the first solrCore in the CoreContainer (solr.xml), since the CoreContainer can contain core descriptors of other GS collections as welll.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/util/SolrQueryWrapper.java

    r29209 r29217  
    7878    SolrServer solr_core = null;
    7979
     80    String collection_core_name_prefix = null;
     81
    8082    public SolrQueryWrapper()
    8183    {
     
    9395        this.solr_core = solr_core;
    9496    }
     97
     98    public void setCollectionCoreNamePrefix(String colCoreNamePrefix) {
     99    this.collection_core_name_prefix = colCoreNamePrefix;
     100    }
     101
    95102  // make sure its not null.
    96103  public void setSortField(String sort_field) {
     
    158165        Iterator<SolrCore> coreIterator = solrCores.iterator();
    159166
    160         // Just use the first core, since the term frequency of any term is the same regardless of core
    161         if(coreIterator.hasNext()) {
     167        // Just use the first core that matches the collection name, since the term
     168        // frequency of any term is the same regardless of whether its didx or sidx core
     169        boolean foundCore = false;
     170        while(coreIterator.hasNext() && !foundCore) {
    162171            SolrCore solrCore = coreIterator.next();
    163            
     172            if(!solrCore.getName().startsWith(this.collection_core_name_prefix)) {
     173            //logger.error("### Skipping core not of this collection: " + solrCore.getName());
     174            continue;
     175            }
     176
     177            //logger.error("### Found core " + solrCore.getName() + " of this collection " + this.collection_core_name_prefix);
     178            foundCore = true;
    164179           
    165180            LocalSolrQueryRequest solrQueryRequest = new LocalSolrQueryRequest(solrCore, solrQuery);
Note: See TracChangeset for help on using the changeset viewer.