Package org.fao.geonet.domain.statistic

Examples of org.fao.geonet.domain.statistic.SearchRequestParam


    @Autowired
    SearchRequestRepository _requestRepo;

    @Test
    public void testHasTermField() throws Exception {
        final SearchRequestParam param = _paramRepo.save(SearchRequestParamRepositoryTest.newRequestParam(_inc));
        _paramRepo.save(SearchRequestParamRepositoryTest.newRequestParam(_inc));

        final List<SearchRequestParam> all = _paramRepo.findAll(SearchRequestParamSpecs.hasTermField(param.getTermField()));

        assertEquals(1, all.size());

        assertEquals(param.getId(), all.get(0).getId());
    }
View Full Code Here


        assertEquals(param.getId(), all.get(0).getId());
    }

    @Test
    public void testHasTermFieldIn() throws Exception {
        final SearchRequestParam param = _paramRepo.save(SearchRequestParamRepositoryTest.newRequestParam(_inc));
        final SearchRequestParam param2 = _paramRepo.save(SearchRequestParamRepositoryTest.newRequestParam(_inc));
        _paramRepo.save(SearchRequestParamRepositoryTest.newRequestParam(_inc));

        final List<String> termFields = Arrays.asList(param.getTermField(), param2.getTermField());
        final List<SearchRequestParam> all = _paramRepo.findAll(SearchRequestParamSpecs.hasTermFieldIn(termFields));

        assertEquals(2, all.size());

        List<Integer> ids = Lists.transform(all, new Function<SearchRequestParam, Integer>() {
            @Nullable
            @Override
            public Integer apply(@Nullable SearchRequestParam input) {
                return input.getId();
            }
        });
        assertTrue(ids.contains(param.getId()));
        assertTrue(ids.contains(param2.getId()));
    }
View Full Code Here

    @Autowired
    SearchRequestParamRepository _paramRepo;

    @Test
    public void testGetTermTextToRequestCount() {
        SearchRequestParam param3 = _paramRepo.save(newRequestParam(_inc));
        SearchRequestParam param4 = _paramRepo.save(newRequestParam(_inc));
        SearchRequestParam param1 = newRequestParam(_inc);
        param1 = _paramRepo.save(param1);
        SearchRequestParam param2 = newRequestParam(_inc);
        param2.setTermText(param1.getTermText());
        _paramRepo.save(param2);
        SearchRequestParam param5 = _paramRepo.save(newRequestParam(_inc));
        SearchRequestParam param6 = newRequestParam(_inc);
        param6.setTermField(SearchRequestParamRepositoryImpl.TERMS_TO_EXCLUDE_FROM_TAG_CLOUD[0]);
        SearchRequestParam param7 = newRequestParam(_inc);
        param7.setTermText("");
        _paramRepo.save(param7);

        List<Pair<String, Integer>> tagCloudSummary = _paramRepo.getTermTextToRequestCount(10);
        assertEquals(4, tagCloudSummary.size());
        assertEquals(2, find(tagCloudSummary, param1.getTermText()));
View Full Code Here

        return -1;
    }

    public static SearchRequestParam newRequestParam(AtomicInteger inc) {
        int val = inc.incrementAndGet();
        SearchRequestParam param = new SearchRequestParam();
        param.setInclusive(val % 2 == 0);
        param.setLowerText("lower text" + val);
        final LuceneQueryParamType[] values = LuceneQueryParamType.values();
        param.setQueryType(values[val % values.length]);
        param.setSimilarity(val);
        param.setTermField("term field" + val);
        param.setTermText("term text" + val);
        param.setUpperText("upper text" + val);

        return param;
    }
View Full Code Here

TOP

Related Classes of org.fao.geonet.domain.statistic.SearchRequestParam

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.