Example usage for org.apache.lucene.queries.function.valuesource MultiValueSource dimension

List of usage examples for org.apache.lucene.queries.function.valuesource MultiValueSource dimension

Introduction

In this page you can find the example usage for org.apache.lucene.queries.function.valuesource MultiValueSource dimension.

Prototype

public abstract int dimension();

Source Link

Usage

From source file:org.apache.solr.search.function.distance.HaversineFunction.java

License:Apache License

public HaversineFunction(MultiValueSource p1, MultiValueSource p2, double radius, boolean convertToRads) {
    this.p1 = p1;
    this.p2 = p2;
    if (p1.dimension() != 2 || p2.dimension() != 2) {
        throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Illegal dimension for value sources");
    }//from w w  w . j ava  2 s .c  o m
    this.radius = radius;
    this.convertToRadians = convertToRads;
}

From source file:org.apache.solr.search.function.distance.VectorDistanceFunction.java

License:Apache License

public VectorDistanceFunction(float power, MultiValueSource source1, MultiValueSource source2) {
    if ((source1.dimension() != source2.dimension())) {
        throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Illegal number of sources");
    }/*  w w  w. j a  v  a  2 s .  c om*/
    this.power = power;
    this.oneOverPower = 1 / power;
    this.source1 = source1;
    this.source2 = source2;
}