@Test public void testConvert() { MetadataRequest request = new MetadataQueryRequest(); request.setType("myRowType"); request.setName("myFilterName"); request.setUserName("myUserName"); request.setClusters("cl1,cl2"); SolrQuery queryResult = underTest.convert(request); assertEquals("?q=*%3A*&fq=type%3AmyRowType&fq=name%3AmyFilterName&fq=cluster_string%3A%28cl1+OR+cl2%29&rows=10000&sort=name+asc", queryResult.toQueryString()); }
@Override public SolrQuery convert(MetadataRequest metadataRequest) { SolrQuery metadataQuery = new SolrQuery(); metadataQuery.setQuery("*:*"); metadataQuery.addFilterQuery(String.format("%s:%s", TYPE, metadataRequest.getType())); if (StringUtils.isNotBlank(metadataRequest.getName())) { metadataQuery.addFilterQuery(String.format("%s:%s", NAME, metadataRequest.getName())); } SolrQuery.SortClause sortOrder = SolrQuery.SortClause.create(NAME, SolrQuery.ORDER.asc); List<SolrQuery.SortClause> sort = new ArrayList<>(); sort.add(sortOrder); metadataQuery.setRows(10000); metadataQuery.setSorts(sort); SolrUtil.addListFilterToSolrQuery(metadataQuery, CLUSTER + "_string", metadataRequest.getClusters()); return metadataQuery; }
MetadataRequestQueryConverter extends AbstractConverterAware<MetadataRequest, SolrQuery> { @Override public SolrQuery convert(MetadataRequest metadataRequest) { SolrQuery metadataQuery = new SolrQuery(); metadataQuery.setQuery("*:*"); metadataQuery.addFilterQuery(String.format("%s:%s", TYPE, metadataRequest.getType())); if (StringUtils.isNotBlank(metadataRequest.getName())) { metadataQuery.addFilterQuery(String.format("%s:%s", NAME, metadataRequest.getName())); } SolrQuery.SortClause sortOrder = SolrQuery.SortClause.create(NAME, SolrQuery.ORDER.asc); List<SolrQuery.SortClause> sort = new ArrayList<>(); sort.add(sortOrder); metadataQuery.setRows(10000); metadataQuery.setSorts(sort); SolrUtil.addListFilterToSolrQuery(metadataQuery, CLUSTER + "_string", metadataRequest.getClusters()); return metadataQuery; } }
MetadataRequestQueryConverter extends AbstractConverterAware<MetadataRequest, SolrQuery> { @Override public SolrQuery convert(MetadataRequest metadataRequest) { SolrQuery metadataQuery = new SolrQuery(); metadataQuery.setQuery("*:*"); metadataQuery.addFilterQuery(String.format("%s:%s", TYPE, metadataRequest.getType())); if (StringUtils.isNotBlank(metadataRequest.getName())) { metadataQuery.addFilterQuery(String.format("%s:%s", NAME, metadataRequest.getName())); } SolrQuery.SortClause sortOrder = SolrQuery.SortClause.create(NAME, SolrQuery.ORDER.asc); List<SolrQuery.SortClause> sort = new ArrayList<>(); sort.add(sortOrder); metadataQuery.setRows(10000); metadataQuery.setSorts(sort); SolrUtil.addListFilterToSolrQuery(metadataQuery, CLUSTER + "_string", metadataRequest.getClusters()); return metadataQuery; }  }
MetadataRequestQueryConverter extends AbstractConverterAware<MetadataRequest, SolrQuery> { @Override public SolrQuery convert(MetadataRequest metadataRequest) { SolrQuery metadataQuery = new SolrQuery(); metadataQuery.setQuery("*:*"); metadataQuery.addFilterQuery(String.format("%s:%s", TYPE, metadataRequest.getType())); if (StringUtils.isNotBlank(metadataRequest.getName())) { metadataQuery.addFilterQuery(String.format("%s:%s", NAME, metadataRequest.getName())); } SolrQuery.SortClause sortOrder = SolrQuery.SortClause.create(NAME, SolrQuery.ORDER.asc); List<SolrQuery.SortClause> sort = new ArrayList<>(); sort.add(sortOrder); metadataQuery.setRows(10000); metadataQuery.setSorts(sort); SolrUtil.addListFilterToSolrQuery(metadataQuery, CLUSTER + "_string", metadataRequest.getClusters()); return metadataQuery; }  @Override SolrQuery convert(MetadataRequest metadataRequest); }
MetadataRequestQueryConverter extends AbstractConverterAware<MetadataRequest, SolrQuery> { @Override public SolrQuery convert(MetadataRequest metadataRequest) { SolrQuery metadataQuery = new SolrQuery(); metadataQuery.setQuery("*:*"); metadataQuery.addFilterQuery(String.format("%s:%s", TYPE, metadataRequest.getType())); if (StringUtils.isNotBlank(metadataRequest.getName())) { metadataQuery.addFilterQuery(String.format("%s:%s", NAME, metadataRequest.getName())); } SolrQuery.SortClause sortOrder = SolrQuery.SortClause.create(NAME, SolrQuery.ORDER.asc); List<SolrQuery.SortClause> sort = new ArrayList<>(); sort.add(sortOrder); metadataQuery.setRows(10000); metadataQuery.setSorts(sort); SolrUtil.addListFilterToSolrQuery(metadataQuery, CLUSTER + "_string", metadataRequest.getClusters()); return metadataQuery; }  @Override SolrQuery convert(MetadataRequest metadataRequest);  }