use of org.apache.solr.schema.FieldType in project lucene-solr by apache.
the class FacetRangeProcessor method getRangeCounts.
private SimpleOrderedMap<Object> getRangeCounts() throws IOException {
final FieldType ft = sf.getType();
if (ft instanceof TrieField) {
switch(ft.getNumberType()) {
case FLOAT:
calc = new FloatCalc(sf);
break;
case DOUBLE:
calc = new DoubleCalc(sf);
break;
case INTEGER:
calc = new IntCalc(sf);
break;
case LONG:
calc = new LongCalc(sf);
break;
case DATE:
calc = new DateCalc(sf, null);
break;
default:
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unable to range facet on tried field of unexpected type:" + freq.field);
}
} else {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unable to range facet on field:" + sf);
}
createRangeList();
return getRangeCountsIndexed();
}
use of org.apache.solr.schema.FieldType in project lucene-solr by apache.
the class TestLuceneMatchVersion method testStandardTokenizerVersions.
public void testStandardTokenizerVersions() throws Exception {
assertEquals(DEFAULT_VERSION, solrConfig.luceneMatchVersion);
final IndexSchema schema = h.getCore().getLatestSchema();
FieldType type = schema.getFieldType("textDefault");
TokenizerChain ana = (TokenizerChain) type.getIndexAnalyzer();
assertEquals(DEFAULT_VERSION, (ana.getTokenizerFactory()).getLuceneMatchVersion());
assertEquals(DEFAULT_VERSION, (ana.getTokenFilterFactories()[2]).getLuceneMatchVersion());
type = schema.getFieldType("textTurkishAnalyzerDefault");
Analyzer ana1 = type.getIndexAnalyzer();
assertTrue(ana1 instanceof TurkishAnalyzer);
assertEquals(DEFAULT_VERSION, ana1.getVersion());
}
use of org.apache.solr.schema.FieldType in project lucene-solr by apache.
the class TestReversedWildcardFilterFactory method testCachingInQueryParser.
@Test
public void testCachingInQueryParser() {
SolrQParser parser = new SolrQParser();
SolrQueryRequest req = req();
String[] fields = new String[] { "one", "two", "three" };
String aField = fields[random().nextInt(fields.length)];
FieldType type = req.getSchema().getField(aField).getType();
FieldType typeSpy = spy(type);
// calling twice
parser.getReversedWildcardFilterFactory(typeSpy);
parser.getReversedWildcardFilterFactory(typeSpy);
// but it should reach only once
verify(typeSpy, times(1)).getIndexAnalyzer();
}
use of org.apache.solr.schema.FieldType in project lucene-solr by apache.
the class TestTrie method checkPrecisionSteps.
private void checkPrecisionSteps(String fieldType) {
FieldType type = h.getCore().getLatestSchema().getFieldType(fieldType);
if (type instanceof TrieField) {
TrieField field = (TrieField) type;
assertTrue(field.getPrecisionStep() > 0 && field.getPrecisionStep() < 64);
}
}
use of org.apache.solr.schema.FieldType in project lucene-solr by apache.
the class PivotFacetProcessor method getSubset.
/**
* Given a base docset, computes the subset of documents corresponding to the specified pivotValue
*
* @param base the set of documents to evaluate relative to
* @param field the field type used by the pivotValue
* @param pivotValue String representation of the value, may be null (ie: "missing")
*/
private DocSet getSubset(DocSet base, SchemaField field, String pivotValue) throws IOException {
FieldType ft = field.getType();
if (null == pivotValue) {
Query query = ft.getRangeQuery(null, field, null, null, false, false);
DocSet hasVal = searcher.getDocSet(query);
return base.andNot(hasVal);
} else {
Query query = ft.getFieldQuery(null, field, pivotValue);
return searcher.getDocSet(query, base);
}
}
Aggregations