コード例 #1
0
 public int Compare(string value1, string value2)
 {
     return(NullSafeComparer.Compare(value1, value2));
 }
コード例 #2
0
 public void IndexField(string fieldName)
 {
     lock (transactionLockObject)
     {
         if (isDisposed)
         {
             throw new ObjectDisposedException("Can't use IndexField() after Dispose() or Delete()");
         }
         if (isFieldIndexesInUse)
         {
             throw new InvalidOperationException("Can't use IndexField() before disposing the enumerable from a FindDocumentIds call");
         }
         if (DebugLogHandler != null)
         {
             DebugLogHandler("IndexField: fieldName=" + fieldName);
         }
         journalWriter.Start();
         try
         {
             fieldIndexes.ClearField(fieldName);
             List <KeyValuePair <uint, IComparable> > list = new List <KeyValuePair <uint, IComparable> >();
             foreach (KeyValuePair <uint, byte[]> document2 in packedFile.Documents)
             {
                 if (document2.Key != metadataDocumentId)
                 {
                     TDocument   document   = DecryptAndDeserialize(document2.Value, document2.Key);
                     IComparable fieldValue = fieldIndexes.GetFieldValue(fieldName, document);
                     list.Add(new KeyValuePair <uint, IComparable>(document2.Key, fieldValue));
                 }
             }
             list.Sort((KeyValuePair <uint, IComparable> a, KeyValuePair <uint, IComparable> b) => NullSafeComparer.Compare(a.Value, b.Value));
             fieldIndexes.InsertPreSorted(fieldName, list);
             journalWriter.Finish();
             journalPlayer.Play();
         }
         catch (Exception)
         {
             journalWriter.Discard();
             throw;
         }
     }
 }
コード例 #3
0
 public static IEnumerable <KeyValuePair <uint, TField> > FindDocumentsGreaterThanOrEqualTo <TDocument, TField>(this IDocumentCollection <TDocument> collection, string fieldName, TField value) where TDocument : AbstractDocument, new()where TField : IComparable <TField>
 {
     return(collection.FindDocuments(fieldName, value, (TField v) => NullSafeComparer.Compare(v, value) >= 0));
 }
コード例 #4
0
 public static IEnumerable <KeyValuePair <uint, TField> > FindDocumentsRangeExclusiveInclusive <TDocument, TField>(this IDocumentCollection <TDocument> collection, string fieldName, TField startValue, TField endValue) where TDocument : AbstractDocument, new()where TField : IComparable <TField>
 {
     return(collection.FindDocuments(fieldName, startValue, (TField v) => NullSafeComparer.Compare(v, startValue) > 0 && NullSafeComparer.Compare(v, endValue) <= 0));
 }
コード例 #5
0
 public static IEnumerable <uint> FindDocumentIdsEqual <TDocument, TField>(this IDocumentCollection <TDocument> collection, string fieldName, TField value) where TDocument : AbstractDocument, new()where TField : IComparable <TField>
 {
     return(collection.FindDocumentIds(fieldName, value, (TField v) => NullSafeComparer.Compare(v, value) == 0));
 }