use of org.apache.solr.schema.IndexSchema in project lucene-solr by apache.
the class TestSolr4Spatial method testSpatialConfig.
@Test
public void testSpatialConfig() throws Exception {
try (SolrCore core = h.getCoreInc()) {
IndexSchema schema = core.getLatestSchema();
// BBox Config
// Make sure the subfields are not stored
SchemaField sub = schema.getField("bbox" + BBoxStrategy.SUFFIX_MINX);
assertFalse(sub.stored());
// Make sure solr field type is also not stored
BBoxField bbox = (BBoxField) schema.getField("bbox").getType();
BBoxStrategy strategy = bbox.getStrategy("bbox");
assertFalse(strategy.getFieldType().stored());
}
}
use of org.apache.solr.schema.IndexSchema in project lucene-solr by apache.
the class TestUnifiedSolrHighlighter method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
System.setProperty("filterCache.enabled", "false");
System.setProperty("queryResultCache.enabled", "false");
// this is why we use this particular solrconfig
System.setProperty("documentCache.enabled", "true");
initCore("solrconfig-cache-enable-disable.xml", "schema-unifiedhighlight.xml");
// test our config is sane, just to be sure:
// 'text' and 'text3' should have offsets, 'text2' should not
IndexSchema schema = h.getCore().getLatestSchema();
assertTrue(schema.getField("text").storeOffsetsWithPositions());
assertTrue(schema.getField("text3").storeOffsetsWithPositions());
assertFalse(schema.getField("text2").storeOffsetsWithPositions());
}
use of org.apache.solr.schema.IndexSchema in project lucene-solr by apache.
the class TestPostingsSolrHighlighter method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
initCore("solrconfig-postingshighlight.xml", "schema-postingshighlight.xml");
// test our config is sane, just to be sure:
// postingshighlighter should be used
SolrHighlighter highlighter = HighlightComponent.getHighlighter(h.getCore());
assertTrue("wrong highlighter: " + highlighter.getClass(), highlighter instanceof PostingsSolrHighlighter);
// 'text' and 'text3' should have offsets, 'text2' should not
IndexSchema schema = h.getCore().getLatestSchema();
assertTrue(schema.getField("text").storeOffsetsWithPositions());
assertTrue(schema.getField("text3").storeOffsetsWithPositions());
assertFalse(schema.getField("text2").storeOffsetsWithPositions());
}
use of org.apache.solr.schema.IndexSchema in project lucene-solr by apache.
the class ClassificationUpdateProcessorFactory method getInstance.
@Override
public UpdateRequestProcessor getInstance(SolrQueryRequest req, SolrQueryResponse rsp, UpdateRequestProcessor next) {
String trainingFilterQueryString = (params.get(KNN_FILTER_QUERY));
try {
if (trainingFilterQueryString != null && !trainingFilterQueryString.isEmpty()) {
Query trainingFilterQuery = this.parseFilterQuery(trainingFilterQueryString, params, req);
classificationParams.setTrainingFilterQuery(trainingFilterQuery);
}
} catch (SyntaxError | RuntimeException syntaxError) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Classification UpdateProcessor Training Filter Query: '" + trainingFilterQueryString + "' is not supported", syntaxError);
}
IndexSchema schema = req.getSchema();
IndexReader indexReader = req.getSearcher().getIndexReader();
return new ClassificationUpdateProcessor(classificationParams, next, indexReader, schema);
}
use of org.apache.solr.schema.IndexSchema in project SearchServices by Alfresco.
the class TestPostingsSolrHighlighter method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
initAlfrescoCore("schema.xml");
// test our config is sane, just to be sure:
// postingshighlighter should be used
SolrHighlighter highlighter = HighlightComponent.getHighlighter(h.getCore());
assertTrue("wrong highlighter: " + highlighter.getClass(), highlighter instanceof AlfrescoSolrHighlighter);
// 'text' and 'text3' should have offsets, 'text2' should not
IndexSchema schema = h.getCore().getLatestSchema();
assertTrue(schema.getField("text").storeOffsetsWithPositions());
assertTrue(schema.getField("text3").storeOffsetsWithPositions());
assertFalse(schema.getField("text2").storeOffsetsWithPositions());
}
Aggregations