/// <summary> /// Static constructor for BigFloatArray. /// </summary> /// <param name="maxDoc"></param> /// <returns></returns> public static BigSingleArray NewInstance(int maxDoc) { BigSingleArray array = new BigSingleArray(maxDoc); array.EnsureCapacity(maxDoc); return(array); }
internal GeoDocIdSetIterator(BigSingleArray xvals, BigSingleArray yvals, BigSingleArray zvals, float targetX, float targetY, float targetZ, float delta, float radiusCosine, int maxdoc) { m_xvals = xvals; m_yvals = yvals; m_zvals = zvals; m_targetX = targetX; m_targetY = targetY; m_targetZ = targetZ; m_delta = delta; m_radius = radiusCosine; m_maxDoc = maxdoc; m_doc = -1; }
public override string[] GetFieldValues(BoboSegmentReader reader, int id) { GeoFacetData dataCache = GetFacetData <GeoFacetData>(reader); BigSingleArray xvals = dataCache.xValArray; BigSingleArray yvals = dataCache.yValArray; BigSingleArray zvals = dataCache.zValArray; float xvalue = xvals.Get(id); float yvalue = yvals.Get(id); float zvalue = zvals.Get(id); float lat = GeoMatchUtil.GetMatchLatDegreesFromXYZCoords(xvalue, yvalue, zvalue); float lon = GeoMatchUtil.GetMatchLonDegreesFromXYZCoords(xvalue, yvalue, zvalue); string[] fieldValues = new string[2]; fieldValues[0] = Convert.ToString(lat); fieldValues[1] = Convert.ToString(lon); return(fieldValues); }
/// <summary> /// Constructor /// </summary> /// <param name="name">name of the Geo Facet</param> /// <param name="dataCache">The data cache for the Geo Facet</param> /// <param name="docBase">the base doc id</param> /// <param name="fspec">the facet spec for this facet</param> /// <param name="predefinedRanges">List of ranges, where each range looks like <lat, lon: rad></param> /// <param name="miles">variable to specify if the geo distance calculations are in miles. False indicates distance calculation is in kilometers</param> public GeoFacetCountCollector(string name, GeoFacetHandler.GeoFacetData dataCache, int docBase, FacetSpec fspec, IList <string> predefinedRanges, bool miles) { m_name = name; m_xvals = dataCache.xValArray; m_yvals = dataCache.yValArray; m_zvals = dataCache.zValArray; m_spec = fspec; m_predefinedRanges = new TermStringList(); predefinedRanges.Sort(); m_predefinedRanges.AddAll(predefinedRanges); m_countlength = predefinedRanges.Count; m_count = new LazyBigInt32Array(m_countlength); m_ranges = new GeoRange[predefinedRanges.Count]; int index = 0; foreach (string range in predefinedRanges) { m_ranges[index++] = Parse(range); } m_miles = miles; }
/// <summary> /// Initializes a new instance of <see cref="T:GeoFacetData"/>. /// </summary> public GeoFacetData() { m_xValArray = null; m_yValArray = null; m_zValArray = null; }
public virtual void Load(string latFieldName, string lonFieldName, BoboSegmentReader reader) { if (reader == null) { throw new ArgumentNullException("reader object is null"); } FacetDataCache latCache = (FacetDataCache)reader.GetFacetData(latFieldName); FacetDataCache lonCache = (FacetDataCache)reader.GetFacetData(lonFieldName); int maxDoc = reader.MaxDoc; BigSingleArray xVals = this.m_xValArray; BigSingleArray yVals = this.m_yValArray; BigSingleArray zVals = this.m_zValArray; if (xVals == null) { xVals = NewInstance(maxDoc); } else { xVals.EnsureCapacity(maxDoc); } if (yVals == null) { yVals = NewInstance(maxDoc); } else { yVals.EnsureCapacity(maxDoc); } if (zVals == null) { zVals = NewInstance(maxDoc); } else { zVals.EnsureCapacity(maxDoc); } this.m_xValArray = xVals; this.m_yValArray = yVals; this.m_zValArray = zVals; BigSegmentedArray latOrderArray = latCache.OrderArray; ITermValueList latValList = latCache.ValArray; BigSegmentedArray lonOrderArray = lonCache.OrderArray; ITermValueList lonValList = lonCache.ValArray; for (int i = 0; i < maxDoc; ++i) { string docLatString = latValList.Get(latOrderArray.Get(i)).Trim(); string docLonString = lonValList.Get(lonOrderArray.Get(i)).Trim(); float docLat = 0; if (docLatString.Length > 0) { docLat = float.Parse(docLatString); } float docLon = 0; if (docLonString.Length > 0) { docLon = float.Parse(docLonString); } float[] coords = GeoMatchUtil.GeoMatchCoordsFromDegrees(docLat, docLon); m_xValArray.Add(i, coords[0]); m_yValArray.Add(i, coords[1]); m_zValArray.Add(i, coords[2]); } }
/// <summary> /// Initializes a new instance of <see cref="T:GeoFacetData"/>. /// </summary> /// <param name="xvals"> /// xValArray array, int of size m, each element is the x coordinate value of the /// docid (actually BigFloatArray is used instead of int to avoid requiring large /// chunks of consecutive heap allocation) /// </param> /// <param name="yvals"> /// yValArray array, int of size m, each element is the y coordinate value of the /// docid (actually BigFloatArray is used instead of int to avoid requiring large /// chunks of consecutive heap allocation) /// </param> /// <param name="zvals"> /// zValArray array, int of size m, each element is the z coordinate value of the /// docid (actually BigFloatArray is used instead of int to avoid requiring large /// chunks of consecutive heap allocation) /// </param> public GeoFacetData(BigSingleArray xvals, BigSingleArray yvals, BigSingleArray zvals) { m_xValArray = xvals; m_yValArray = yvals; m_zValArray = zvals; }