Examples of SolrCore


Examples of org.apache.solr.core.SolrCore

    assertTrue(home.isPolyField());
  }

  @Test
  public void testPointFieldType() throws Exception {
    SolrCore core = h.getCore();
    IndexSchema schema = core.getSchema();
    SchemaField home = schema.getField("home");
    assertNotNull(home);
    assertTrue("home is not a poly field", home.isPolyField());
    FieldType tmp = home.getType();
    assertTrue(tmp instanceof PointType);
View Full Code Here

Examples of org.apache.solr.core.SolrCore

    clearIndex();
  }

  @Test
  public void testSearchDetails() throws Exception {
    SolrCore core = h.getCore();
    IndexSchema schema = core.getSchema();
    double[] xy = new double[]{35.0, -79.34};
    String point = xy[0] + "," + xy[1];
    //How about some queries?
    //don't need a parser for this path currently.  This may change
    assertU(adoc("id", "0", "home_ns", point));
View Full Code Here

Examples of org.apache.solr.core.SolrCore

  {
    String body1 = "AMANAPLANPANAMA";
    String body2 = "qwertasdfgzxcvb";
    String body3 = "1234567890";
   
    SolrCore core = h.getCore();
   
    Map<String,String[]> args = new HashMap<String, String[]>();
    args.put( CommonParams.STREAM_BODY, new String[] {body1} );
   
    // Make sure it got a single stream in and out ok
View Full Code Here

Examples of org.apache.solr.core.SolrCore

    catch( Exception ex ) {
      assumeNoException("Unable to connect to " + url + " to run the test.", ex);
      return;
    }

    SolrCore core = h.getCore();
   
    Map<String,String[]> args = new HashMap<String, String[]>();
    args.put( CommonParams.STREAM_URL, new String[] {url} );
   
    // Make sure it got a single stream in and out ok
View Full Code Here

Examples of org.apache.solr.core.SolrCore

    initCore("solrconfig.xml","schema-required-fields.xml");
  }
 
  @Test
  public void testRequiredFieldsConfig() {
    SolrCore core = h.getCore();
    IndexSchema schema = core.getSchema();
    SchemaField uniqueKey = schema.getUniqueKeyField();

    // Make sure the uniqueKey is required
    assertTrue( uniqueKey.isRequired() );
    assertTrue( schema.getRequiredFields().contains( uniqueKey ) );
View Full Code Here

Examples of org.apache.solr.core.SolrCore

    assertEquals( numDefaultFields+1+1, requiredFields.size()); // also the uniqueKey
  }
 
  @Test
  public void testRequiredFieldsSingleAdd() {     
    SolrCore core = h.getCore();    
    // Add a single document
    assertU("adding document",
      adoc("id", "529", "name", "document with id, name, and subject", "field_t", "what's inside?", "subject", "info"));
    assertU(commit());
   
    // Check it it is in the index
    assertQ("should find one", req("id:529") ,"//result[@numFound=1]" );

    // Add another document without the required subject field, which
    // has a configured defaultValue of "Stuff"
    assertU("adding a doc without field w/ configured default",
          adoc("id", "530", "name", "document with id and name", "field_t", "what's inside?"));
    assertU(commit());

    // Add another document without a subject, which has a default in schema
    String subjectDefault = core.getSchema().getField("subject").getDefaultValue();
    assertNotNull("subject has no default value", subjectDefault);
    assertQ("should find one with subject="+subjectDefault, req("id:530 subject:"+subjectDefault) ,"//result[@numFound=1]" );

    // Add another document without a required name, which has no default
    assertNull(core.getSchema().getField("name").getDefaultValue());
    ignoreException("missing required field");
    assertFailedU("adding doc without required field",
          adoc("id", "531", "subject", "no name document", "field_t", "what's inside?") );
    resetExceptionIgnores();
    assertU(commit());
View Full Code Here

Examples of org.apache.solr.core.SolrCore

  @SuppressWarnings("deprecation")
  private List<Document> getDocuments(SolrDocumentList solrDocList, Map<SolrDocument, Integer> docIds,
                                      Query query, final SolrQueryRequest sreq) throws IOException {
    SolrHighlighter highlighter = null;
    SolrParams solrParams = sreq.getParams();
    SolrCore core = sreq.getCore();

    String urlField = solrParams.get(CarrotParams.URL_FIELD_NAME, "url");
    String titleField = solrParams.get(CarrotParams.TITLE_FIELD_NAME, "title");
    String snippetField = solrParams.get(CarrotParams.SNIPPET_FIELD_NAME, titleField);
   
    // Get the documents
    boolean produceSummary = solrParams.getBool(CarrotParams.PRODUCE_SUMMARY, false);

    SolrQueryRequest req = null;
    String[] snippetFieldAry = null;
    if (produceSummary == true) {
      highlighter = core.getHighlighter();
      if (highlighter != null){
        Map<String, Object> args = Maps.newHashMap();
        snippetFieldAry = new String[]{snippetField};
        args.put(HighlightParams.FIELDS, snippetFieldAry);
        args.put(HighlightParams.HIGHLIGHT, "true");
View Full Code Here

Examples of org.apache.solr.core.SolrCore

   * // ReciprocalFloatFunction on LinearFloatFunction on ReverseOrdFieldSource
   * recip(linear(rord(myfield),1,2),3,4,5)
   * </pre>
   */
  public static FunctionQuery parseFunction(String func, IndexSchema schema) throws ParseException {
    SolrCore core = SolrCore.getSolrCore();
    return (FunctionQuery) (QParser.getParser(func, "func", new LocalSolrQueryRequest(core, new HashMap())).parse());
    // return new FunctionQuery(parseValSource(new StrParser(func), schema));
  }
View Full Code Here

Examples of org.apache.solr.core.SolrCore

    File indexDir = new File(TEMP_DIR, "spellingIdx" + new Date().getTime());
    indexDir.mkdirs();
    spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
    spellchecker.add(IndexBasedSpellChecker.FIELD, "title");
    spellchecker.add(AbstractLuceneSpellChecker.SPELLCHECKER_ARG_NAME, spellchecker);
    SolrCore core = h.getCore();

    String dictName = checker.init(spellchecker, core);
    assertTrue(dictName + " is not equal to " + SolrSpellChecker.DEFAULT_DICTIONARY_NAME,
            dictName.equals(SolrSpellChecker.DEFAULT_DICTIONARY_NAME) == true);
    RefCounted<SolrIndexSearcher> holder = core.getSearcher();
    SolrIndexSearcher searcher = holder.get();
    try {
    checker.build(core, searcher);

    IndexReader reader = searcher.getReader();
View Full Code Here

Examples of org.apache.solr.core.SolrCore

    File indexDir = new File(TEMP_DIR, "spellingIdx" + new Date().getTime());
    indexDir.mkdirs();
    spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
    spellchecker.add(IndexBasedSpellChecker.FIELD, "title");
    spellchecker.add(AbstractLuceneSpellChecker.SPELLCHECKER_ARG_NAME, spellchecker);
    SolrCore core = h.getCore();
    String dictName = checker.init(spellchecker, core);
    assertTrue(dictName + " is not equal to " + SolrSpellChecker.DEFAULT_DICTIONARY_NAME,
            dictName.equals(SolrSpellChecker.DEFAULT_DICTIONARY_NAME) == true);
    RefCounted<SolrIndexSearcher> holder = core.getSearcher();
    SolrIndexSearcher searcher = holder.get();
    try {
    checker.build(core, searcher);

    IndexReader reader = searcher.getReader();
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.