Package org.apache.solr.core

Examples of org.apache.solr.core.SolrCore


   * <dynamicField name="dynamic_*" type="string" indexed="true" stored="true"/>
   * <dynamicField name="*_dynamic" type="string" indexed="true" stored="true"/>
   */
  public void testDynamicCopy()
  {
    SolrCore core = h.getCore();
    assertU(adoc("id", "10", "title", "test", "aaa_dynamic", "aaa"));
    assertU(commit());
   
    Map<String,String> args = new HashMap<String, String>();
    args.put( CommonParams.Q, "title:test" );
View Full Code Here


            ,"//result/doc[1]/int[@name='id'][.='10']"
            );
  }

  public void testSimilarityFactory() {
    SolrCore core = h.getCore();
    Similarity similarity = core.getSchema().getSimilarity();
    assertTrue("wrong class", similarity instanceof MockConfigurableSimilarity);
    assertEquals("is there an echo?", ((MockConfigurableSimilarity)similarity).getPassthrough());
  }
View Full Code Here

    // test that reload affects aliases
    CoreAdminRequest.reloadCore("core1", coreadmin);

    // this is only an effective test for embedded, where we have
    // direct access to the core container.
    SolrCore c1 = cores.getCore("core1");
    SolrCore c2 = cores.getCore("corefoo");
    assertTrue(c1 == c2);
    if (c1 != null) c1.close();
    if (c2 != null) c2.close();

    // retest core query
    assertEquals( 1, getSolrCore1().query( new SolrQuery( "id:BBB" ) ).getResults().size() );

    // test close
View Full Code Here

    // any field manipulation needs to happen when you know the core will not
    // be accepting any requests.  Typically this is done within the inform()
    // method.  Since this is a single threaded test, we can change the fields
    // willi-nilly

    SolrCore core = h.getCore();
    IndexSchema schema = core.getSchema();
    final String fieldName = "runtimefield";
    SchemaField sf = new SchemaField( fieldName, schema.getFieldTypes().get( "string" ) );
    schema.getFields().put( fieldName, sf );
   
    // also register a new copy field (from our new field)
View Full Code Here

            ,"//result/doc[1]/int[@name='id'][.='10']"
            );
  }
 
  public void testIsDynamicField() throws Exception {
    SolrCore core = h.getCore();
    IndexSchema schema = core.getSchema();
    assertFalse( schema.isDynamicField( "id" ) );
    assertTrue( schema.isDynamicField( "aaa_i" ) );
    assertFalse( schema.isDynamicField( "no_such_field" ) );
  }
View Full Code Here

   
    assertU("commit", commit());
  }

  public void testEmptyLower() throws Exception {
    SolrCore core = h.getCore();
    TermsComponent tc = (TermsComponent) core.getSearchComponent("termsComp");
    assertTrue("tc is null and it shouldn't be", tc != null);

    ModifiableSolrParams params = new ModifiableSolrParams();
    params.add(TermsParams.TERMS, "true");
    params.add(TermsParams.TERMS_FIELD, "lowerfilt");
    //no lower bound
    params.add(TermsParams.TERMS_UPPER, "b");
    params.add(TermsParams.TERMS_LIMIT, String.valueOf(50));
    SolrRequestHandler handler;
    SolrQueryResponse rsp;
    NamedList values;
    NamedList terms;
    handler = core.getRequestHandler("/terms");
    assertTrue("handler is null and it shouldn't be", handler != null);
    rsp = new SolrQueryResponse();
    rsp.add("responseHeader", new SimpleOrderedMap());
    handler.handleRequest(new LocalSolrQueryRequest(core, params), rsp);
    values = rsp.getValues();
View Full Code Here

    assertTrue("abb is null and it shouldn't be", terms.get("abb") != null);
    assertTrue("abc is null and it shouldn't be", terms.get("abc") != null);
  }

  public void testNoField() throws Exception {
    SolrCore core = h.getCore();
    TermsComponent tc = (TermsComponent) core.getSearchComponent("termsComp");
    assertTrue("tc is null and it shouldn't be", tc != null);

    ModifiableSolrParams params = new ModifiableSolrParams();
    params.add(TermsParams.TERMS, "true");
    //no lower bound
    params.add(TermsParams.TERMS_LOWER, "d");
    params.add(TermsParams.TERMS_LIMIT, String.valueOf(50));
    SolrRequestHandler handler;
    SolrQueryResponse rsp;

    handler = core.getRequestHandler("/terms");
    assertTrue("handler is null and it shouldn't be", handler != null);
    rsp = new SolrQueryResponse();
    rsp.add("responseHeader", new SimpleOrderedMap());
    handler.handleRequest(new LocalSolrQueryRequest(core, params), rsp);
    Exception exception = rsp.getException();
View Full Code Here

    assertTrue("exception is null and it shouldn't be", exception != null);
  }


  public void testMultipleFields() throws Exception {
    SolrCore core = h.getCore();
    TermsComponent tc = (TermsComponent) core.getSearchComponent("termsComp");
    assertTrue("tc is null and it shouldn't be", tc != null);

    ModifiableSolrParams params = new ModifiableSolrParams();
    params.add(TermsParams.TERMS, "true");
    params.add(TermsParams.TERMS_FIELD, "lowerfilt", "standardfilt");
    //no lower bound
    params.add(TermsParams.TERMS_UPPER, "b");
    params.add(TermsParams.TERMS_LIMIT, String.valueOf(50));
    SolrRequestHandler handler;
    SolrQueryResponse rsp;
    NamedList values;
    NamedList terms;
    handler = core.getRequestHandler("/terms");
    assertTrue("handler is null and it shouldn't be", handler != null);
    rsp = new SolrQueryResponse();
    rsp.add("responseHeader", new SimpleOrderedMap());
    handler.handleRequest(new LocalSolrQueryRequest(core, params), rsp);
    values = rsp.getValues();
View Full Code Here

    terms = (NamedList) tmp.get("standardfilt");
    assertTrue("terms Size: " + terms.size() + " is not: " + 4, terms.size() == 4);
  }

  public void testUnlimitedRows() throws Exception {
    SolrCore core = h.getCore();
    TermsComponent tc = (TermsComponent) core.getSearchComponent("termsComp");
    assertTrue("tc is null and it shouldn't be", tc != null);

    ModifiableSolrParams params = new ModifiableSolrParams();
    params.add(TermsParams.TERMS, "true");
    params.add(TermsParams.TERMS_FIELD, "lowerfilt", "standardfilt");
    //no lower bound, upper bound or rows
    params.add(TermsParams.TERMS_LIMIT, String.valueOf(-1));
    SolrRequestHandler handler;
    SolrQueryResponse rsp;
    NamedList values;
    NamedList terms;
    handler = core.getRequestHandler("/terms");
    assertTrue("handler is null and it shouldn't be", handler != null);
    rsp = new SolrQueryResponse();
    rsp.add("responseHeader", new SimpleOrderedMap());
    handler.handleRequest(new LocalSolrQueryRequest(core, params), rsp);
    values = rsp.getValues();
View Full Code Here

    assertTrue("terms Size: " + terms.size() + " is not: " + 9, terms.size() == 9);

  }

  public void testPrefix() throws Exception {
    SolrCore core = h.getCore();
    TermsComponent tc = (TermsComponent) core.getSearchComponent("termsComp");
    assertTrue("tc is null and it shouldn't be", tc != null);

    ModifiableSolrParams params = new ModifiableSolrParams();
    params.add(TermsParams.TERMS, "true");
    params.add(TermsParams.TERMS_FIELD, "lowerfilt", "standardfilt");
    params.add(TermsParams.TERMS_LOWER,  "aa");
    params.add(TermsParams.TERMS_LOWER_INCLUSIVE, "false");
    params.add(TermsParams.TERMS_PREFIX_STR, "aa");
    params.add(TermsParams.TERMS_UPPER, "b");
    params.add(TermsParams.TERMS_LIMIT, String.valueOf(50));
    SolrRequestHandler handler;
    SolrQueryResponse rsp;
    NamedList values;
    NamedList terms;
    handler = core.getRequestHandler("/terms");
    assertTrue("handler is null and it shouldn't be", handler != null);
    rsp = new SolrQueryResponse();
    rsp.add("responseHeader", new SimpleOrderedMap());
    handler.handleRequest(new LocalSolrQueryRequest(core, params), rsp);
    values = rsp.getValues();
View Full Code Here

TOP

Related Classes of org.apache.solr.core.SolrCore

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.