Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ayende committed Aug 16, 2023
1 parent 99a1929 commit 28ce72a
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,18 @@ public AnonymousCoraxDocumentConverterBase(Index index, int numberOfBaseFields =

unsafe void HandleCompoundFields()
{
/* Rules:
* - if total size > max size - throw or hash - probably hash
* - field is missing means that we just skip it: "foo|bar|", "|bar|", "foo||"
* - reject arrays
*/
// edge cases:
// total size > max key size
// string too big?
// some fields are missing
// numeric data - long
// numeric data - double
// what if we have multiple items?
// what if we have multiple items? - reject

var baseLine = _index.Definition.IndexFields.Count;
Span<byte> buffer = stackalloc byte[Voron.Global.Constants.CompactTree.MaximumKeySize];
Expand All @@ -119,6 +124,14 @@ unsafe void HandleCompoundFields()
ValueType valueType = GetValueType(v);
switch (valueType)
{
case ValueType.Null:
// for nulls, we put no value and it will sort at the beginning

// moo
// NULL_VALUE
// yolo

break;
case ValueType.String:
index += Encoding.UTF8.GetBytes((string)v, buffer[index..]);
break;
Expand All @@ -131,6 +144,9 @@ unsafe void HandleCompoundFields()
var ticks = ((DateTime)v).Ticks;
BitConverter.TryWriteBytes(buffer[index..], Bits.SwapBytes(ticks));
index += sizeof(long);
break;
case ValueType.Double:

break;
}
buffer[index++] = SpecialChars.RecordSeparator;
Expand Down

0 comments on commit 28ce72a

Please sign in to comment.