當前位置: 首頁>>代碼示例>>Java>>正文


Java ModifiableSolrParams類代碼示例

本文整理匯總了Java中org.apache.solr.common.params.ModifiableSolrParams的典型用法代碼示例。如果您正苦於以下問題:Java ModifiableSolrParams類的具體用法?Java ModifiableSolrParams怎麽用?Java ModifiableSolrParams使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ModifiableSolrParams類屬於org.apache.solr.common.params包,在下文中一共展示了ModifiableSolrParams類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: test_singleTerm

import org.apache.solr.common.params.ModifiableSolrParams; //導入依賴的package包/類
@Test
public void test_singleTerm() throws SyntaxError {

    // arrange
    QParser parser = new SimilarityParser("first",new ModifiableSolrParams(),mockCorrectParams,req("first"));

    // act
    Query luceneQuery = parser.parse();

    // assert
    AugmentedTermQuery expected = new AugmentedTermQuery(
            AugmentedTermQuery.ModelMethod.Generalized, new Term("text", "first"),
            new TermWeightTuple[]{SimilarityApiMock.similarTerm("text")}
            );

    Assert.assertEquals(expected, luceneQuery);
}
 
開發者ID:sebastian-hofstaetter,項目名稱:ir-generalized-translation-models,代碼行數:18,代碼來源:SimilarityParserTest.java

示例2: listRuntimeDependencies

import org.apache.solr.common.params.ModifiableSolrParams; //導入依賴的package包/類
protected List<String> listRuntimeDependencies(String collectionName) throws IOException, SolrServerException {
    ModifiableSolrParams params = new ModifiableSolrParams().set("file",RUNTIME_LIB_FILE_NAME);
    SolrRequest request = new QueryRequest(params);
    request.setPath("/admin/file");
    request.setResponseParser(new InputStreamResponseParser("json"));

    NamedList o = client.request(request, collectionName);

    LineIterator it = IOUtils.lineIterator((InputStream) o.get("stream"), "utf-8");

    List<String> returnValues = Streams.stream(it).collect(Collectors.toList());

    //if file not exists (a little hacky..)
    if(returnValues.size() == 1 && returnValues.get(0).startsWith("{\"responseHeader\":{\"status\":404")) {
        logger.warn("Release does not yet contain rumtimelib configuration file. Runtimelibs have to be installed manually.");
        return Collections.emptyList();
    };
    return returnValues;
}
 
開發者ID:RBMHTechnology,項目名稱:vind,代碼行數:20,代碼來源:CollectionManagementService.java

示例3: query

import org.apache.solr.common.params.ModifiableSolrParams; //導入依賴的package包/類
public QueryResponse query(ModifiableSolrParams params) throws SolrServerException
{
   	try
   	{
	    QueryResponse response = server.query(params);
	    if(response.getStatus() != 0)
	    {
	    	solrTracker.setSolrActive(false);
	    }

	    return response;
	}
	catch(SolrServerException e)
	{
		solrTracker.setSolrActive(false);
		throw e;
	}
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:19,代碼來源:SOLRAdminClient.java

示例4: testSynonymes

import org.apache.solr.common.params.ModifiableSolrParams; //導入依賴的package包/類
/**
 * Tests MBC-1203 (Static synonyms)
 * Attention! To enable this, make sure that you use the WhiteSpaceTokenizer (for query and index).
 */
@Test
@Ignore //At the moment synonyms are not supported in suggestions
public void testSynonymes() {

    ModifiableSolrParams params = new ModifiableSolrParams();

    params.add(SuggestionRequestParams.SUGGESTION, "true");
    params.add(CommonParams.QT,"/suggester");
    params.add(CommonParams.Q, "xalps");
    params.add(SuggestionRequestParams.SUGGESTION_FIELD, "dynamic_multi_stored_suggest_string_name");
    params.add(SuggestionRequestParams.SUGGESTION_DF, "suggestions");

    SolrQueryRequest req = new LocalSolrQueryRequest( core, params );

    assertQ("suggester - test synonym mapping for single facet",req,
            "//response/lst[@name='suggestions']/int[@name='suggestion_count'][.='2']",
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_name']/int[@name='X-Alps'][.='1']",
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_name']/int[@name='My xa'][.='1']");
}
 
開發者ID:RBMHTechnology,項目名稱:vind,代碼行數:24,代碼來源:IssueExampleTest.java

示例5: test_MBC_3646_1

import org.apache.solr.common.params.ModifiableSolrParams; //導入依賴的package包/類
public void test_MBC_3646_1() {

        ModifiableSolrParams params = new ModifiableSolrParams();

        params.add(SuggestionRequestParams.SUGGESTION,"true");
        params.add(CommonParams.QT,"/suggester");
        params.add(CommonParams.Q,"MI123");
        params.add(SuggestionRequestParams.SUGGESTION_FIELD,"dynamic_multi_stored_suggest_string_id");
        params.add(SuggestionRequestParams.SUGGESTION_DF,"suggestions");

        SolrQueryRequest req = new LocalSolrQueryRequest( core, params );

        assertQ("suggester - test number search without result", req,
                "//response/lst[@name='suggestions']/int[@name='suggestion_count'][.='1']",
                "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_id']/int[@name='MI123-456-789'][.='1']");
    }
 
開發者ID:RBMHTechnology,項目名稱:vind,代碼行數:17,代碼來源:IssueExampleTest.java

示例6: test_MBC_3646_2

import org.apache.solr.common.params.ModifiableSolrParams; //導入依賴的package包/類
public void test_MBC_3646_2() {

        ModifiableSolrParams params = new ModifiableSolrParams();

        params.add(SuggestionRequestParams.SUGGESTION,"true");
        params.add(CommonParams.QT,"/suggester");
        params.add(CommonParams.Q,"MI123-456-788");
        params.add(CommonParams.FQ,"dynamic_multi_stored_suggest_string_id:MI123-456-788"); //filter for non existing facet -> no suggestion should be returned
        params.add(SuggestionRequestParams.SUGGESTION_FIELD,"dynamic_multi_stored_suggest_string_id");
        params.add(SuggestionRequestParams.SUGGESTION_DF,"suggestions");

        SolrQueryRequest req = new LocalSolrQueryRequest( core, params );

        assertQ("suggester - test number search without result", req,
                "not(//response/lst[@name='spellcheck'])");
    }
 
開發者ID:RBMHTechnology,項目名稱:vind,代碼行數:17,代碼來源:IssueExampleTest.java

示例7: testQueryTermLimit

import org.apache.solr.common.params.ModifiableSolrParams; //導入依賴的package包/類
public void testQueryTermLimit() {

        ModifiableSolrParams params = new ModifiableSolrParams();

        params.add(SuggestionRequestParams.SUGGESTION,"true");
        params.add(CommonParams.QT,"/suggester");
        params.add(CommonParams.Q,"se");
        params.add(SuggestionRequestParams.SUGGESTION_FIELD,"dynamic_multi_stored_suggest_string_name");
        params.add(SuggestionRequestParams.SUGGESTION_TERM_LIMIT,"1");

        SolrQueryRequest req = new LocalSolrQueryRequest( core, params );

        assertQ("suggester - simple facet suggestion for 'sebasti'",req,
                "//response/lst[@name='suggestions']/int[@name='suggestion_count'][.='3']",
                "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_name']/int[@name='sebastien loeb'][.='2']",
                "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_name']/int[@name='sebastian vettel'][.='1']",
                "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_name']/int[@name='sebastien vettel'][.='1']");
    }
 
開發者ID:RBMHTechnology,項目名稱:vind,代碼行數:19,代碼來源:PivotRegexBasedSuggestionTest.java

示例8: multiFacetSuggestionTest

import org.apache.solr.common.params.ModifiableSolrParams; //導入依賴的package包/類
@Test
public void multiFacetSuggestionTest() {

    ModifiableSolrParams params = new ModifiableSolrParams();

    params.add(SuggestionRequestParams.SUGGESTION,"true");
    params.add(CommonParams.Q,"S");
    params.add(CommonParams.QT,"/suggester");
    params.add(SuggestionRequestParams.SUGGESTION_FIELD,"dynamic_multi_stored_suggest_string_name");
    params.add(SuggestionRequestParams.SUGGESTION_FIELD,"dynamic_multi_stored_suggest_string_place");

    SolrQueryRequest req = new LocalSolrQueryRequest( core, params );

    assertQ("suggester - simple facet suggestion for 'S'",req,
            "//response/lst[@name='suggestions']/int[@name='suggestion_count'][.='3']",
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_name']/int[@name='sebastian vettel'][.='2']",
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_name']/int[@name='stefan Bradl'][.='1']",
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_place']/int[@name='suzuka'][.='2']");

}
 
開發者ID:RBMHTechnology,項目名稱:vind,代碼行數:21,代碼來源:SuggestionRequestHandlerTest.java

示例9: spellcheckSuggestionTest

import org.apache.solr.common.params.ModifiableSolrParams; //導入依賴的package包/類
@Test
public void spellcheckSuggestionTest() {

    ModifiableSolrParams params = new ModifiableSolrParams();

    params.add(SuggestionRequestParams.SUGGESTION,"true");
    params.add(CommonParams.QT,"/suggester");
    params.add(CommonParams.Q,"sepastian");
    params.add(SuggestionRequestParams.SUGGESTION_FIELD,"dynamic_multi_stored_suggest_string_name");
    params.add(SuggestionRequestParams.SUGGESTION_DF,"suggestions");

    SolrQueryRequest req = new LocalSolrQueryRequest( core, params );

    assertQ("suggester - spellcheck suggestion for 'sepastian'",req,
            "//response/lst[@name='suggestions']/int[@name='suggestion_count'][.='1']",
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_name']/int[@name='sebastian vettel'][.='2']",
            "//response/lst[@name='spellcheck']/lst[@name='collations']/str[@name='collation'][.='sebastian*']");

}
 
開發者ID:RBMHTechnology,項目名稱:vind,代碼行數:20,代碼來源:SuggestionRequestHandlerTest.java

示例10: fqParameterTest

import org.apache.solr.common.params.ModifiableSolrParams; //導入依賴的package包/類
@Test
public void fqParameterTest() {

    ModifiableSolrParams params = new ModifiableSolrParams();

    params.add(SuggestionRequestParams.SUGGESTION,"true");
    params.add(CommonParams.QT,"/suggester");
    params.add(CommonParams.Q,"sebastian");
    params.add(SuggestionRequestParams.SUGGESTION_FIELD,"dynamic_multi_stored_suggest_string_name");
    params.add(CommonParams.FQ,"dynamic_multi_stored_suggest_string_place:\"(1328869589310-619798898)\"");

    SolrQueryRequest req = new LocalSolrQueryRequest( core, params );

    assertQ("suggester - spellcheck suggestion for 'sepastian'",req,
            "//response/lst[@name='suggestions']/int[@name='suggestion_count'][.='1']",
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_name']/int[@name='sebastian vettel'][.='1']");

}
 
開發者ID:RBMHTechnology,項目名稱:vind,代碼行數:19,代碼來源:SuggestionRequestHandlerTest.java

示例11: sortingTest

import org.apache.solr.common.params.ModifiableSolrParams; //導入依賴的package包/類
@Test
public void sortingTest() {
    ModifiableSolrParams params = new ModifiableSolrParams();

    params.add(SuggestionRequestParams.SUGGESTION,"true");
    params.add(CommonParams.QT,"/suggester");
    params.add(CommonParams.Q,"s");
    params.add(SuggestionRequestParams.SUGGESTION_FIELD,"dynamic_multi_stored_suggest_string_name");
    params.add(SuggestionRequestParams.SUGGESTION_FIELD,"dynamic_multi_stored_suggest_string_place");

    SolrQueryRequest req = new LocalSolrQueryRequest( core, params );

    assertQ("suggester - test single sorting for 's' with 2 facets", req,
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_name']/int[1][.='2']",
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_name']/int[2][.='1']",
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_place']/int[1][.='2']");

    //TODO fix
    /*assertQ("suggester - test multi sorting for 's' with 2 facets",req,
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[1]/int[@name='count'][.='2']",
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[2]/int[@name='count'][.='2']",
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[3]/int[@name='count'][.='1']");
   */
}
 
開發者ID:RBMHTechnology,項目名稱:vind,代碼行數:25,代碼來源:SuggestionRequestHandlerTest.java

示例12: sortingTest2

import org.apache.solr.common.params.ModifiableSolrParams; //導入依賴的package包/類
@Test
public void sortingTest2() {
    ModifiableSolrParams params = new ModifiableSolrParams();

    params.add(SuggestionRequestParams.SUGGESTION,"true");
    params.add(CommonParams.QT,"/suggester");
    params.add(CommonParams.Q,"ku");
    params.add(SuggestionRequestParams.SUGGESTION_FIELD,"dynamic_multi_stored_suggest_string_place");

    SolrQueryRequest req = new LocalSolrQueryRequest( core, params );

    assertQ("suggester - test single sorting for 'ku' with 2 facets", req,
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_place']/int[@name='kuala Lumpur'][.='2']",
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_place']/int[1][.='2']",
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_place']/int[@name='Havanna kuba'][.='1']");
}
 
開發者ID:RBMHTechnology,項目名稱:vind,代碼行數:17,代碼來源:SuggestionRequestHandlerTest.java

示例13: testFacetTypesSingle

import org.apache.solr.common.params.ModifiableSolrParams; //導入依賴的package包/類
@Test
public void testFacetTypesSingle() {
    ModifiableSolrParams params = new ModifiableSolrParams();

    params.add(SuggestionRequestParams.SUGGESTION,"true");
    params.add(CommonParams.QT,"/suggester");
    params.add(CommonParams.Q,"s");
    params.add(SuggestionRequestParams.SUGGESTION_FIELD,"dynamic_multi_stored_suggest_string_name");
    params.add(SuggestionRequestParams.SUGGESTION_FIELD,"dynamic_multi_stored_suggest_string_place");

    SolrQueryRequest req = new LocalSolrQueryRequest( core, params );

    assertQ(req,
            "//response/lst[@name='suggestions']/int[@name='suggestion_count'][.='3']",
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_name']/int[@name='sebastian vettel'][.='2']",
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_name']/int[@name='stefan Bradl'][.='1']",
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_place']/int[@name='suzuka'][.='2']");

}
 
開發者ID:RBMHTechnology,項目名稱:vind,代碼行數:20,代碼來源:SuggestionRequestHandlerTest.java

示例14: testSynonyms

import org.apache.solr.common.params.ModifiableSolrParams; //導入依賴的package包/類
@Test
@Ignore //At the moment synonyms are not supported in suggestions
public void testSynonyms() {
    ModifiableSolrParams params = new ModifiableSolrParams();

    params.add(SuggestionRequestParams.SUGGESTION,"true");
    params.add(CommonParams.QT,"/suggester");
    params.add(CommonParams.Q,"xfighter");
    params.add(SuggestionRequestParams.SUGGESTION_FIELD,"dynamic_multi_stored_suggest_string_name");

    SolrQueryRequest req = new LocalSolrQueryRequest( core, params );

    assertQ("suggester - test synonym mapping for single facet", req,
            "//response/lst[@name='suggestions']/int[@name='suggestion_count'][.='2']",
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_name']/int[@name='RBXF'][.='1']",
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[@name='dynamic_multi_stored_suggest_string_name']/int[@name='X-fighters'][.='1']");

    /* TODO does not work for multifacets
    params.add(SuggestionRequestParams.SUGGESTION_MULTIVALUE,"true");
    params.set(CommonParams.Q,"RB x-fighter");

    assertQ("suggester - test synonym mapping for multi facet",req,
            "//response/lst[@name='suggestions']/lst[@name='suggestion_facets']/lst[1]/int[@name='count'][.='2']");
    */
}
 
開發者ID:RBMHTechnology,項目名稱:vind,代碼行數:26,代碼來源:SuggestionRequestHandlerTest.java

示例15: beforeTests

import org.apache.solr.common.params.ModifiableSolrParams; //導入依賴的package包/類
@BeforeClass
public static void beforeTests() throws Exception {

    // This is relative to the current working directory
    // when running the tests with intellij the current working directory is: the main Extensions folder
    // THIS could/will break test runs with other working directories !
    // - resource folder has to be set explicitly, otherwise the base class takes the relative "solr/collection1"
    //   and will not find it ...
    initCore("solrconfig.xml",
            "schema.xml",
            "src\\test\\resources\\");

    mockCorrectParams = new ModifiableSolrParams();
    mockCorrectParams.add("api:type","mock");
    mockCorrectParams.add("query:method","GT");
    mockCorrectParams.add("df","text");
    mockCorrectParams.add("defType","similarityApiParser");
}
 
開發者ID:sebastian-hofstaetter,項目名稱:ir-generalized-translation-models,代碼行數:19,代碼來源:SimilarityParserTest.java


注:本文中的org.apache.solr.common.params.ModifiableSolrParams類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。