private static void PopulateResult( string fieldName, IFieldBridge fieldBridge, Attributes.Store fieldStore, string[] fields, object[] result, Document document ) { int matchingPosition = GetFieldPosition(fields, fieldName); if (matchingPosition != -1) { //TODO make use of an isTwoWay() method if (fieldStore != Attributes.Store.No && fieldBridge is ITwoWayFieldBridge) { result[matchingPosition] = ((ITwoWayFieldBridge)fieldBridge).Get(fieldName, document); if (logger.IsInfoEnabled) { logger.Info("Field " + fieldName + " projected as " + result[matchingPosition]); } } else { if (fieldStore == Attributes.Store.No) { throw new SearchException("Projecting an unstored field: " + fieldName); } throw new SearchException("IFieldBridge is not a ITwoWayFieldBridge: " + fieldBridge.GetType()); } } }
private static Field.Store GetStore(Attributes.Store store) { switch (store) { case Attributes.Store.No: return(Field.Store.NO); case Attributes.Store.Yes: return(Field.Store.YES); default: throw new AssertionFailure("Unexpected Store: " + store); } }
private static Field.Store GetStore(Attributes.Store store) { switch (store) { case Attributes.Store.No: return(Field.Store.NO); case Attributes.Store.Yes: return(Field.Store.YES); case Attributes.Store.Compress: // TODO:RB Refactor compress in NHSearch.Attributes throw new Exception("Compress is depricated"); default: throw new AssertionFailure("Unexpected Store: " + store); } }