Package org.fao.geonet.kernel.search.keyword

Examples of org.fao.geonet.kernel.search.keyword.KeywordSearchParamsBuilder.build()


            fail("Expected an IllegalStateException because offset is not allowed if no thesaurus is defined");
        } catch (IllegalStateException e) {
            // good
        }
        params.addThesaurus(thesaurus.getKey());
        searcher.search(params.build());
        assertEquals(keywords-5, searcher.getNbResults());
       
        params.addThesaurus(thesaurusBlah.getKey());
        try {
            params.build();
View Full Code Here


        searcher.search(params.build());
        assertEquals(keywords-5, searcher.getNbResults());
       
        params.addThesaurus(thesaurusBlah.getKey());
        try {
            params.build();
            fail("Expected an IllegalStateException because offset is not allowed if more than one thesaurus");
        } catch (IllegalStateException e) {
            // good
        }
       
View Full Code Here

        KeywordSearchParamsBuilder params = new KeywordSearchParamsBuilder(isoLangMapper)
            .addLang("eng")
            .offset(5)
            .addThesaurus(thesaurus.getKey())
            .maxResults(5);
        searcher.search(params.build());
        assertEquals(5, searcher.getNbResults());
        assertEquals("5", searcher.getResults().get(0).getRelativeCode());
    }
    @Test
    public void testSearchContextNoLangKeywordNoSearchTwoSpecificThesauri() throws Exception {
View Full Code Here

    public void testSortResults() throws Exception {
        KeywordsSearcher searcher = new KeywordsSearcher(isoLangMapper, thesaurusFinder);
        KeywordSearchParamsBuilder params = new KeywordSearchParamsBuilder(isoLangMapper)
            .addLang("eng")
            .maxResults(10);
        searcher.search(params.build());
        searcher.sortResults(KeywordSort.defaultLabelSorter(SortDirection.ASC));
       
        for(int i=0; i < searcher.getNbResults() - 2; i++ ){
            String val1 = searcher.getResults().get(i).getDefaultValue();
            String val2 = searcher.getResults().get(i+1).getDefaultValue();
View Full Code Here

    public void testSelectUnselectKeywords() throws Exception {
        KeywordsSearcher searcher = new KeywordsSearcher(isoLangMapper, thesaurusFinder);
        KeywordSearchParamsBuilder params = new KeywordSearchParamsBuilder(isoLangMapper)
            .addLang("eng")
            .maxResults(10);
        searcher.search(params.build());
        Element selectParams = new Element("params");
        Set<String> ids = new HashSet<String>();
        for(int i = 0; i < 5; i++ ) {
            KeywordBean bean = searcher.getResults().get(i);
            if(i%2 == 0) {
View Full Code Here

    public void testExistsResult() throws Exception {
        KeywordsSearcher searcher = new KeywordsSearcher(isoLangMapper, thesaurusFinder);
        KeywordSearchParamsBuilder params = new KeywordSearchParamsBuilder(isoLangMapper)
            .addLang("eng")
            .maxResults(10);
        searcher.search(params.build());
       
        assertEquals(2, searcher.getKeywordFromResultsById(2).getId());
        assertNotNull(searcher.getKeywordFromResultsByUriCode(searcher.getResults().get(4).getUriCode()).getId());
        assertNull(searcher.getKeywordFromResultsById(100));
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.