public bool TryGetValuesPartial(IEnumerable <ICompoundIndexKey> myKeys, out ICloseableEnumerable <long> myVertexIDs) { LuceneReturn results = null; var results_compound = new List <Tuple <long, IComparable, long> >(); foreach (var key in myKeys) { results = _LuceneIndex.GetEntriesInnerByField(_MaxResultsFirst, key.Key as String, key.PropertyID.ToString(), LuceneIndex.Fields.PROPERTY_ID); if (results.TotalHits > _MaxResultsFirst) { results.Close(); results = _LuceneIndex.GetEntriesInnerByField(_MaxResultsFirst, key.Key as String, key.PropertyID.ToString(), LuceneIndex.Fields.PROPERTY_ID); } results_compound.AddRange(results.Where((e) => e.PropertyId != null).Select((e) => new Tuple <long, IComparable, long>((long)e.PropertyId, e.Text, e.VertexId))); } var grouped = from myresults in results_compound group myresults by myresults.Item3; if (grouped.Count() > 0) { myVertexIDs = new CloseableEnumerable <long>(grouped.Select <IGrouping <long, Tuple <long, IComparable, long> >, long>((g) => g.Key), results.Close); return(true); } else { myVertexIDs = null; return(false); } }
public override bool TryGetValues(IComparable myKey, out ICloseableEnumerable <long> myVertexIDs) { if (myKey == null) { myVertexIDs = null; return(false); } myVertexIDs = this[myKey]; return(myVertexIDs.Count() > 0); }
public ICloseableEnumerable <long> this[IEnumerable <ICompoundIndexKey> myKeys] { get { ICloseableEnumerable <long> myVertexIDs = null; if (TryGetValues(myKeys, out myVertexIDs)) { return(myVertexIDs); } else { return(null); } } }
/// <summary> /// Returns all values associated with given key, if it exists. /// </summary> /// <param name="myKey">Search key</param> /// <param name="myVertexIDs">Associated values</param> /// <returns>True, if the key exists</returns> public override bool TryGetValues(IComparable myKey, out ICloseableEnumerable <long> myVertexIDs) { if (!KeyNullSupportCheck(myKey)) { throw new NullKeysNotSupportedException("This index does not support >null< as key."); } var values = new HashSet <long>(); var done = _Index.TryGetValue(myKey, out values); if (values == null) { myVertexIDs = null; } else { myVertexIDs = new CloseableEnumerable <long>(values); } return(done); }
public abstract bool TryGetValues(IComparable myKey, out ICloseableEnumerable<long> myVertexIDs);
/// <summary> /// Returns all values associated with given key, if it exists. /// </summary> /// <param name="myKey">Search key</param> /// <param name="myVertexIDs">Associated values</param> /// <returns>True, if the key exists</returns> public override bool TryGetValues(IComparable myKey, out ICloseableEnumerable<long> myVertexIDs) { if (!KeyNullSupportCheck(myKey)) { throw new NullKeysNotSupportedException("This index does not support >null< as key."); } var values = new HashSet<long>(); var done = _Index.TryGetValue(myKey, out values); if (values == null) { myVertexIDs = null; } else { myVertexIDs = new CloseableEnumerable<long>(values); } return done; }
public bool TryGetValues(IEnumerable <ICompoundIndexKey> myKeys, out ICloseableEnumerable <long> myVertexIDs) { LuceneReturn results = null; var results_compound = new List <Tuple <long, IComparable, long> >(); foreach (var key in myKeys) { results = _LuceneIndex.GetEntriesInnerByField(_MaxResultsFirst, key.Key as String, key.PropertyID.ToString(), LuceneIndex.Fields.PROPERTY_ID); if (results.TotalHits > _MaxResultsFirst) { results.Close(); results = _LuceneIndex.GetEntriesInnerByField(results.TotalHits, key.Key as String, key.PropertyID.ToString(), LuceneIndex.Fields.PROPERTY_ID); } results_compound.AddRange(results .Where((e) => e.PropertyId != null) .Select((e) => new Tuple <long, IComparable, long>((long)e.PropertyId, e.Text, e.VertexId))); } var grouped = from myresults in results_compound group myresults by myresults.Item3; if (grouped.Count() > 0) { var _myVertexIDs = grouped .Where((myGroup) => { var join = from entry in myGroup join key in myKeys on new { JoinField1 = entry.Item2, JoinField2 = entry.Item1 } equals new { JoinField1 = key.Key, JoinField2 = key.PropertyID } select entry; if (join.Count() == myKeys.Count()) { return(true); } else { return(false); } }) .Select <IGrouping <long, Tuple <long, IComparable, long> >, long>((g) => g.Key); if (_myVertexIDs.Count() > 0) { myVertexIDs = new CloseableEnumerable <long>(_myVertexIDs, results.Close); return(true); } else { myVertexIDs = null; return(false); } } else { myVertexIDs = null; return(false); } }
public abstract bool TryGetValues(IComparable myKey, out ICloseableEnumerable <long> myVertexIDs);
public bool TryGetValuesPartial(IEnumerable<ICompoundIndexKey> myKeys, out ICloseableEnumerable<long> myVertexIDs) { LuceneReturn results = null; var results_compound = new List<Tuple<long, IComparable, long>>(); foreach (var key in myKeys) { results = _LuceneIndex.GetEntriesInnerByField(_MaxResultsFirst, key.Key as String, key.PropertyID.ToString(), LuceneIndex.Fields.PROPERTY_ID); if (results.TotalHits > _MaxResultsFirst) { results.Close(); results = _LuceneIndex.GetEntriesInnerByField(_MaxResultsFirst, key.Key as String, key.PropertyID.ToString(), LuceneIndex.Fields.PROPERTY_ID); } results_compound.AddRange(results.Where((e) => e.PropertyId != null).Select((e) => new Tuple<long, IComparable, long>((long)e.PropertyId, e.Text, e.VertexId))); } var grouped = from myresults in results_compound group myresults by myresults.Item3; if (grouped.Count() > 0) { myVertexIDs = new CloseableEnumerable<long>(grouped.Select<IGrouping<long, Tuple<long, IComparable, long>>, long>((g) => g.Key), results.Close); return true; } else { myVertexIDs = null; return false; } }
public override bool TryGetValues(IComparable myKey, out ICloseableEnumerable<long> myVertexIDs) { if (myKey == null) { myVertexIDs = null; return false; } myVertexIDs = this[myKey]; return myVertexIDs.Count() > 0; }
public bool TryGetValues(IEnumerable<ICompoundIndexKey> myKeys, out ICloseableEnumerable<long> myVertexIDs) { LuceneReturn results = null; var results_compound = new List<Tuple<long, IComparable, long>>(); foreach (var key in myKeys) { results = _LuceneIndex.GetEntriesInnerByField(_MaxResultsFirst, key.Key as String, key.PropertyID.ToString(), LuceneIndex.Fields.PROPERTY_ID); if (results.TotalHits > _MaxResultsFirst) { results.Close(); results = _LuceneIndex.GetEntriesInnerByField(results.TotalHits, key.Key as String, key.PropertyID.ToString(), LuceneIndex.Fields.PROPERTY_ID); } results_compound.AddRange(results .Where((e) => e.PropertyId != null) .Select((e) => new Tuple<long, IComparable, long>((long)e.PropertyId, e.Text, e.VertexId))); } var grouped = from myresults in results_compound group myresults by myresults.Item3; if (grouped.Count() > 0) { var _myVertexIDs = grouped .Where((myGroup) => { var join = from entry in myGroup join key in myKeys on new { JoinField1 = entry.Item2, JoinField2 = entry.Item1 } equals new { JoinField1 = key.Key, JoinField2 = key.PropertyID } select entry; if (join.Count() == myKeys.Count()) { return true; } else { return false; } }) .Select<IGrouping<long, Tuple<long, IComparable, long>>, long>((g) => g.Key); if (_myVertexIDs.Count() > 0) { myVertexIDs = new CloseableEnumerable<long>(_myVertexIDs, results.Close); return true; } else { myVertexIDs = null; return false; } } else { myVertexIDs = null; return false; } }