if (null != keyField) if (!returnFields.contains(keyField)) fieldFilter.add(ByteBufferUtil.bytes(keyField.getName()));
public boolean equals(Object o) { if (o.getClass() != FileFloatSource.class) return false; FileFloatSource other = (FileFloatSource)o; return this.field.getName().equals(other.field.getName()) && this.keyField.getName().equals(other.keyField.getName()) && this.defVal == other.defVal && this.dataDir.equals(other.dataDir); }
@Override public Query getRangeQuery(QParser parser, SchemaField sf, Date min, Date max, boolean minInclusive, boolean maxInclusive) { int ps = precisionStep; Query query = NumericRangeQuery.newLongRange(sf.getName(), ps, min == null ? null : min.getTime(), max == null ? null : max.getTime(), minInclusive, maxInclusive); return query; } }
protected final Term idTerm(String readableId) { // to correctly create the Term, the string needs to be run // through the Analyzer for that field. return new Term(idField.getName(), idFieldType.toInternal(readableId)); }
@Override public Query getFieldQuery(final QParser parser, final SchemaField field, final String externalVal) { // Not useful for now in SIREn throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Not implemented operation." + field.getName()); }
@Override public Query getRangeQuery(final QParser parser, final SchemaField field, final String part1, final String part2, final boolean minInclusive, final boolean maxInclusive) { throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unsupported operation. Can not do range on SIREn field: " + field.getName()); }
@Override public SortField getSortField(SchemaField field, boolean top) { return new SortField(field.getName(), FieldCache.NUMERIC_UTILS_LONG_PARSER, top); }
@Override public SortField getSortField(final SchemaField field, final boolean reverse) { throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unsupported operation. Can not sort on SIREn field: " + field.getName()); }
@Override public ValueSource getValueSource(SchemaField field) { return new TrieDateFieldSource(field.getName(), FieldCache.NUMERIC_UTILS_LONG_PARSER); }
@Override public SortField getSortField(final SchemaField field, final boolean reverse) { throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unsupported operation. Can not sort on SIREn field: " + field.getName()); }
void add(SolrInputDocument doc, int line, int column, String val) { if (val.length() > 0) { doc.addField(fields[column].getName(),val,1.0f); } } }
@Override public Query getRangeQuery(final QParser parser, final SchemaField field, final String part1, final String part2, final boolean minInclusive, final boolean maxInclusive) { throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unsupported operation. Can not do range on SIREn field: " + field.getName()); }
@Override public Query getFieldQuery(final QParser parser, final SchemaField field, final String externalVal) { // Not useful for now in SIREn throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Not implemented operation." + field.getName()); }
protected final String getIndexedId(Document doc) { if (idField == null) throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Operation requires schema to have a unique key field"); // Right now, single valued fields that require value transformation from external to internal (indexed) // form have that transformation already performed and stored as the field value. Fieldable[] id = doc.getFieldables( idField.getName() ); if (id == null || id.length < 1) throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Document is missing uniqueKey field " + idField.getName()); if( id.length > 1 ) throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Document specifies multiple unique ids! " + idField.getName()); return idFieldType.storedToIndexed( id[0] ); }
@Override protected HashMap<String,Analyzer> analyzerCache() { HashMap<String,Analyzer> cache = new HashMap<String,Analyzer>(); for (SchemaField f : getFields().values()) { Analyzer analyzer = f.getType().getQueryAnalyzer(); cache.put(f.getName(), analyzer); } return cache; }
protected HashMap<String,Analyzer> analyzerCache() { HashMap<String,Analyzer> cache = new HashMap<String,Analyzer>(); for (SchemaField f : getFields().values()) { Analyzer analyzer = f.getType().getAnalyzer(); cache.put(f.getName(), analyzer); } return cache; }
protected final String getIndexedIdOptional(Document doc) { if (idField == null) return null; Field f = doc.getField(idField.getName()); if (f == null) return null; return idFieldType.storedToIndexed(f); }
/** DateField specific range query */ public Query getRangeQuery(QParser parser, SchemaField sf, Date part1, Date part2, boolean minInclusive, boolean maxInclusive) { return new TermRangeQuery( sf.getName(), part1 == null ? null : toInternal(part1), part2 == null ? null : toInternal(part2), minInclusive, maxInclusive); }
public UpdateHandler(SolrCore core) { this.core=core; schema = core.getSchema(); idField = schema.getUniqueKeyField(); idFieldType = idField!=null ? idField.getType() : null; idTerm = idField!=null ? new Term(idField.getName(),"") : null; parseEventListeners(); }