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

Examples of org.fao.geonet.kernel.search.keyword.KeywordSearchParamsBuilder


     */
  public void search(String contextLanguage, Element params) throws Exception {
    if(contextLanguage == null) {
      contextLanguage = Geonet.DEFAULT_LANGUAGE;
    }
      KeywordSearchParamsBuilder paramsBuilder = KeywordSearchParamsBuilder.createFromElement(_isoLanguageMapper, params);
        if(paramsBuilder.getLangs().isEmpty()) {
            paramsBuilder.addLang(contextLanguage);
        }
        search(paramsBuilder.build());
  }
View Full Code Here


    public ThesaurusRequest(ServiceContext context, WeakHashMap<String, Map<String, String>> categoryTranslations, Set<String> localesToLoad, Thesaurus thesaurus) {
        this.localesToLoad = localesToLoad;
        this.serviceContext = context;
        this.categoryTranslations = categoryTranslations;
        this.thesaurus = thesaurus;
        this.searchBuilder = new KeywordSearchParamsBuilder(thesaurus.getIsoLanguageMapper());
        for (String lang : localesToLoad) {
            searchBuilder.addLang(lang);
        }
        searchBuilder.addThesaurus(thesaurus.getKey());
        searchBuilder.requireBoundedBy(true);
View Full Code Here

    }

    @Test
    public void testSearchNoContextEngLangNoSearchAllThesauri() throws Exception {
        KeywordsSearcher searcher = new KeywordsSearcher(isoLangMapper, thesaurusFinder);
        KeywordSearchParamsBuilder params = new KeywordSearchParamsBuilder(isoLangMapper)
            .addLang("eng");
        searcher.search(params.build());
        assertSearchNoContextEngLangNoSearchAllThesauri(searcher);
       
        searcher.search(null, params.toXmlParams());
        assertSearchNoContextEngLangNoSearchAllThesauri(searcher);
    }
View Full Code Here

    }

    @Test
    public void testSearchNoContextMultiLangNoSearchAllThesauri() throws Exception {
        KeywordsSearcher searcher = new KeywordsSearcher(isoLangMapper, thesaurusFinder);
        KeywordSearchParamsBuilder params = new KeywordSearchParamsBuilder(isoLangMapper)
            .addLang("fre")
            .addLang("eng")
            .addLang("chi");
        searcher.search(params.build());
        assertSearchNoContextMultiLangNoSearchAllThesauri(searcher);
       
        searcher.search(null, params.toXmlParams());
        assertSearchNoContextMultiLangNoSearchAllThesauri(searcher);
    }
View Full Code Here

    }
       
    @Test
    public void testSearchNoContextMultiLangKeywordSearchAllThesauri() throws Exception {
        KeywordsSearcher searcher = new KeywordsSearcher(isoLangMapper, thesaurusFinder);
        KeywordSearchParamsBuilder params = new KeywordSearchParamsBuilder(isoLangMapper)
            .keyword("fooVal", KeywordSearchType.CONTAINS, false)
            .addLang("fre")
            .addLang("eng")
            .addLang("chi");
        searcher.search(params.build());
        assertSearchNoContextMultiLangSearchAllThesauri(searcher);
       
        searcher.search(null, params.toXmlParams());
        assertSearchNoContextMultiLangSearchAllThesauri(searcher);
    }
View Full Code Here

    }

    @Test
    public void testSearchNoContextMultiLangKeywordNoSearchOneCategory() throws Exception {
        KeywordsSearcher searcher = new KeywordsSearcher(isoLangMapper, thesaurusFinder);
        KeywordSearchParamsBuilder params = new KeywordSearchParamsBuilder(isoLangMapper)
            .thesauriDomainName(thesaurusBlah.getDname())
            .addLang("fre")
            .addLang("eng")
            .addLang("chi");
        searcher.search(params.build());
        assertSearchNoContextMultiLangNoSearchOneCategory(searcher);
       
        searcher.search(null, params.toXmlParams());
        assertSearchNoContextMultiLangNoSearchOneCategory(searcher);
    }
View Full Code Here

    }

    @Test
    public void testSearchNoContextMultiLangKeywordSearchOneSpecificThesauri() throws Exception {
        KeywordsSearcher searcher = new KeywordsSearcher(isoLangMapper, thesaurusFinder);
        KeywordSearchParamsBuilder params = new KeywordSearchParamsBuilder(isoLangMapper)
            .addThesaurus(thesaurusBlah.getKey())
            .addLang("fre")
            .addLang("eng")
            .addLang("chi");
        searcher.search(params.build());
        assertSearchNoContextMultiLangKeywordSearchOneSpecificThesauri(searcher);
       
        searcher.search(null, params.toXmlParams());
        assertSearchNoContextMultiLangKeywordSearchOneSpecificThesauri(searcher);
    }
View Full Code Here

    }

    @Test
    public void testSearchNoContextMultiLangKeywordSearchTwoSpecificThesauri() throws Exception {
        KeywordsSearcher searcher = new KeywordsSearcher(isoLangMapper, thesaurusFinder);
        KeywordSearchParamsBuilder params = new KeywordSearchParamsBuilder(isoLangMapper)
            .addThesaurus(thesaurusBlah.getKey())
            .addThesaurus(thesaurusFoo.getKey())
            .addLang("fre")
            .addLang("eng")
            .addLang("chi");
        searcher.search(params.build());
        assertSearchNoContextMultiLangKeywordSearchTwoSpecificThesauri(searcher);
       
        searcher.search(null, params.toXmlParams());
        assertSearchNoContextMultiLangKeywordSearchTwoSpecificThesauri(searcher);
    }
View Full Code Here

        assertEquals(smallWords*2, searcher.getNbResults());
    }
    @Test
    public void testSearchContextMultiLangKeywordNoSearchTwoSpecificThesauri() throws Exception {
        KeywordsSearcher searcher = new KeywordsSearcher(isoLangMapper, thesaurusFinder);
        KeywordSearchParamsBuilder params = new KeywordSearchParamsBuilder(isoLangMapper)
            .addThesaurus(thesaurusBlah.getKey())
            .addThesaurus(thesaurusFoo.getKey())
            .addLang("fre")
            .addLang("eng")
            .addLang("chi");
        searcher.search("ger" , params.toXmlParams());
        assertSearchNoContextMultiLangKeywordSearchTwoSpecificThesauri(searcher);
    }
View Full Code Here

    }

    @Test
    public void testSearchUriSearch() throws Exception {
        KeywordsSearcher searcher = new KeywordsSearcher(isoLangMapper, thesaurusFinder);
        KeywordSearchParamsBuilder params = new KeywordSearchParamsBuilder(isoLangMapper)
            .uri(THESAURUS_KEYWORD_NS+30)
            .addLang("fre")
            .addLang("eng")
            .addLang("chi");
        searcher.search(params.build());
        assertSearchUriSearch(searcher);
       
        searcher.search(null, params.toXmlParams());
        assertSearchUriSearch(searcher);
    }
View Full Code Here

TOP

Related Classes of org.fao.geonet.kernel.search.keyword.KeywordSearchParamsBuilder

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.