Changeset 4201


Ignore:
Timestamp:
12/18/13 12:38:15 (10 years ago)
Author:
keeloo
Message:

After splitting of a branch (r4199) including code for moving from wicket 1.4 to wicket 6, some more modifications in the direction of that target.

Location:
vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/FacetedSearchPage.java

    r4199 r4201  
    271271                int offset = 0;
    272272                int fetchSize = 1000;
    273                 int totalResults = dataProvider.size();
     273                int totalResults = (int) dataProvider.size();
    274274                while (offset < totalResults) {
    275275                    Iterator<SolrDocument> iter = dataProvider.iterator(offset, fetchSize);
  • vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/SearchPageQuery.java

    r4199 r4201  
    44import eu.clarin.cmdi.vlo.config.VloConfig;
    55import java.util.HashMap;
     6import java.util.List;
    67import java.util.Map;
    78import org.apache.solr.client.solrj.SolrQuery;
     
    2728        query = getDefaultQuery();
    2829       
    29         StringValue paramVal;
    30         paramVal = parameters.get(CommonParams.Q);
    31         String queryParam = paramVal.toString();
     30        String queryParam = parameters.get(CommonParams.Q).toString();
    3231
    3332        setSearchQuery(queryParam);
     
    3837
    3938        }
    40         String[] filterQueries = parameters.getStringArray(CommonParams.FQ);
    41         if (filterQueries != null) {
    42             String[] encodedQueries = new String[filterQueries.length];
    43             for (int i = 0; i < filterQueries.length; i++) {
    44                 String fq = filterQueries[i];
     39       
     40        List<StringValue> filterQueryValues = parameters.getValues(CommonParams.FQ);
     41       
     42        if (filterQueryValues != null) {
     43            String[] encodedQueries = new String[filterQueryValues.size()];
     44           
     45            for (int i = 0; i < filterQueryValues.size(); i++) {
     46                String fq = filterQueryValues.get(i).toString();
    4547                String[] keyValue = fq.split(":", 2);
    4648                filterQueryMap.put(keyValue[0], keyValue[1]);
  • vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/SearchServiceDataProvider.java

    r2768 r4201  
    1717
    1818/**
    19  * Data provider of all documents with SearchService entry (FCS) based on existing SolrQuery
    20  *
     19 * Data provider of all documents with SearchService entry (FCS) based on
     20 * existing SolrQuery
     21 *
    2122 * @author Thomas Eckart
    2223 *
    2324 */
    24 public class SearchServiceDataProvider extends SortableDataProvider<SolrDocument> {
    25         private final static Logger LOG = LoggerFactory.getLogger(SearchServiceDataProvider.class);
    26        
    27         private static final long serialVersionUID = -5355607690141772113L;
    28         private final SolrQuery query;
    29         private SolrDocumentList docList;
     25public class SearchServiceDataProvider extends SortableDataProvider<SolrDocument, String> {
    3026
    31         public SearchServiceDataProvider(SolrQuery query) {
    32                 this.query = query;
    33                 this.query.setFacet(false);
    34                 this.query.setStart(0);
    35                 this.query.setRows(10);
    36                 this.query.setFields(FacetConstants.FIELD_SEARCH_SERVICE, FacetConstants.FIELD_ID);
    37                 this.query.setQuery(query.getQuery());
    38                 this.query.addFilterQuery(FacetConstants.FIELD_SEARCH_SERVICE + ":*");
    39                 LOG.debug("Used query for search services: "+this.query.toString());
    40         }
     27    private final static Logger LOG = LoggerFactory.getLogger(SearchServiceDataProvider.class);
     28    private static final long serialVersionUID = -5355607690141772113L;
     29    private final SolrQuery query;
     30    private SolrDocumentList docList;
    4131
    42         private SearchResultsDao getSearchResultsDao() {
    43                 return DaoLocator.getSearchResultsDao();
    44         }
     32    public SearchServiceDataProvider(SolrQuery query) {
     33        this.query = query;
     34        this.query.setFacet(false);
     35        this.query.setStart(0);
     36        this.query.setRows(10);
     37        this.query.setFields(FacetConstants.FIELD_SEARCH_SERVICE, FacetConstants.FIELD_ID);
     38        this.query.setQuery(query.getQuery());
     39        this.query.addFilterQuery(FacetConstants.FIELD_SEARCH_SERVICE + ":*");
     40        LOG.debug("Used query for search services: " + this.query.toString());
     41    }
    4542
    46         private SolrDocumentList getDocList() {
    47                 if (docList == null) {
    48                         docList = getSearchResultsDao().getResults(query);
    49                 }
    50                 return docList;
    51         }
     43    private SearchResultsDao getSearchResultsDao() {
     44        return DaoLocator.getSearchResultsDao();
     45    }
    5246
    53         @Override
    54         public Iterator<SolrDocument> iterator(int first, int count) {
    55                 if (first != query.getStart().intValue() || count != query.getRows().intValue()) {
    56                         query.setStart(first).setRows(count);
    57                         docList = null;
    58                 }
    59                 return getDocList().iterator();
    60         }
    61        
    62         public Iterator<SolrDocument> iterator() {
    63                 return getDocList().iterator();
    64         }
     47    private SolrDocumentList getDocList() {
     48        if (docList == null) {
     49            docList = getSearchResultsDao().getResults(query);
     50        }
     51        return docList;
     52    }
    6553
    66         @Override
    67         public IModel<SolrDocument> model(SolrDocument solrDocument) {
    68                 return new Model<SolrDocument>(solrDocument);
    69         }
     54    @Override
     55    public Iterator<SolrDocument> iterator(long first, long count) {
     56        if (first != query.getStart().intValue() || count != query.getRows().intValue()) {
     57            query.setStart((int) first).setRows((int) count);
     58            docList = null;
     59        }
     60        return getDocList().iterator();
     61    }
    7062
    71         @Override
    72         public int size() {
    73                 return (int) getDocList().getNumFound();
    74         }
     63    public Iterator<SolrDocument> iterator() {
     64        return getDocList().iterator();
     65    }
     66
     67    @Override
     68    public IModel<SolrDocument> model(SolrDocument solrDocument) {
     69        return new Model<SolrDocument>(solrDocument);
     70    }
     71
     72    @Override
     73    public long size() {
     74        return getDocList().getNumFound();
     75    }
    7576}
  • vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/ShowAllFacetValuesPage.java

    r2768 r4201  
    33import java.util.Map;
    44
    5 import org.apache.wicket.PageParameters;
     5import org.apache.wicket.request.mapper.parameter.PageParameters;
    66import org.apache.wicket.markup.html.WebMarkupContainer;
    77import org.apache.wicket.markup.html.basic.Label;
     
    2525                addOccurrencesFilter(parameters);
    2626               
    27                 String selectedFacet = parameters.getString(SELECTED_FACET_PARAM);
    28                 Integer facetMinOccurs = parameters.getAsInteger(FACET_MIN_OCCURS, 1);
     27                String selectedFacet = (parameters.get(SELECTED_FACET_PARAM)).toString();
     28               
     29                Integer facetMinOccurs = (parameters.get(FACET_MIN_OCCURS)).toInt(1); // take care of 1 as default value
     30               
    2931                add(new Label("category", selectedFacet));
    3032                SolrFacetFieldDataProvider data = new SolrFacetFieldDataProvider(selectedFacet, query);
Note: See TracChangeset for help on using the changeset viewer.