public LeafDocLookup getLeafDocLookup(LeafReaderContext context) { return new LeafDocLookup(mapperService, fieldDataLookup, types, context); }
public void setDocument(int docId) { docMap.setDocument(docId); sourceLookup.setSegmentAndDocument(ctx, docId); fieldsLookup.setDocument(docId); } }
/** * Returns field data long (integers) access for the provided field. */ protected ScriptDocValues.Longs docFieldLongs(String field) { return (ScriptDocValues.Longs) doc().get(field); }
@Override public Object run() { if (this.field == null || this.inputFeatureVector == null || this.inputFeatureVectorNorm == 0) { return this.baseConstant; } if (!doc().containsKey(this.field) || doc().get(this.field) == null) { return this.baseConstant; } String docFeatureVectorStr = ((ScriptDocValues.Strings) doc().get(this.field)).getValue(); return calculateScore(docFeatureVectorStr); }
/** * Returns field data long (integers) access for the provided field. */ protected ScriptDocValues.Longs docFieldLongs(String field) { return (ScriptDocValues.Longs) doc().get(field); }
/** * . Computes probability that objects are the same * * @return float the computed score */ @Override public double runAsDouble() { HashMap<String, Collection<String>> props = new HashMap<>(); LeafDocLookup doc = doc(); Collection<String> docKeys = comparedRecord.getProperties(); for (String key : docKeys) { if (doc.containsKey(key)) { String value = (doc.get(key) == null ? "" : getFieldValue(doc.get(key))); props.put(key, value == null ? Collections.singleton("") : Collections.singleton(value)); } } Record r2 = new RecordImpl(props); return compare(comparedRecord, r2, entityParams); }
/** * Returns field data double (floating point) access for the provided field. */ protected ScriptDocValues.Doubles docFieldDoubles(String field) { return (ScriptDocValues.Doubles) doc().get(field); }
public void setDocument(int docId) { docMap.setDocument(docId); sourceLookup.setSegmentAndDocument(ctx, docId); fieldsLookup.setDocument(docId); } }
public LeafDocLookup getLeafDocLookup(LeafReaderContext context) { return new LeafDocLookup(mapperService, fieldDataLookup, types, context); }
/** * Returns field data strings access for the provided field. */ protected ScriptDocValues.Strings docFieldStrings(String field) { return (ScriptDocValues.Strings) doc().get(field); }
public void setDocument(int docId) { docMap.setDocument(docId); sourceLookup.setSegmentAndDocument(ctx, docId); fieldsLookup.setDocument(docId); } }
public LeafDocLookup getLeafDocLookup(LeafReaderContext context) { return new LeafDocLookup(mapperService, fieldDataLookup, types, context); }
/** * Returns field data double (floating point) access for the provided field. */ protected ScriptDocValues.Doubles docFieldDoubles(String field) { return (ScriptDocValues.Doubles) doc().get(field); }
public void setDocument(int docId) { docMap.setDocument(docId); sourceLookup.setSegmentAndDocument(ctx, docId); fieldsLookup.setDocument(docId); indexLookup.setDocument(docId); } }
public LeafDocLookup getLeafDocLookup(LeafReaderContext context) { return new LeafDocLookup(mapperService, fieldDataService, types, context); } }
/** * Returns field data strings access for the provided field. */ protected ScriptDocValues.Strings docFieldStrings(String field) { return (ScriptDocValues.Strings) doc().get(field); }
public void setDocument(int docId) { docMap.setDocument(docId); sourceLookup.setSegmentAndDocument(ctx, docId); fieldsLookup.setDocument(docId); indexLookup.setDocument(docId); } }
public LeafDocLookup getLeafDocLookup(LeafReaderContext context) { return new LeafDocLookup(mapperService, fieldDataService, types, context); }
@Override @SuppressWarnings("unchecked") public Object run() { ArrayList<Long> transactions = (ArrayList<Long>) agg.get(InitScriptFactory.TRANSACTIONS_FIELD); ScriptDocValues.Longs amount = (ScriptDocValues.Longs) doc().get("amount"); ScriptDocValues.Strings type = (ScriptDocValues.Strings) doc().get("type"); if ("sale".equals(type.getValue())) { transactions.add(amount.getValue()); } else { transactions.add(-amount.getValue()); } return null; } }
@Override @SuppressWarnings("unchecked") public Object run() { // First we get field using doc lookup ScriptDocValues<Long> docValue = (ScriptDocValues<Long>) doc().get(fieldName); // Check if field exists if (docValue != null && !docValue.isEmpty()) { try { // Try to parse it as an integer BigInteger bigInteger = BigInteger.valueOf(((Longs) docValue).getValue()); // Check if it's prime return bigInteger.isProbablePrime(certainty); } catch (NumberFormatException ex) { return false; } } return false; }