예제 #1
0
        private void LearnCommandForInput(IndexWriter writer, IndexReader reader, DocumentId completionId, string input)
        {
            // fickle command, isn't learnable
            if (completionId == null)
            {
                return;
            }

            var document = CoreDocument.Rehydrate(PopDocument(writer, reader, completionId.GetId()));

            if (document == null)
            {
                throw new InvalidOperationException(string.Format("Didn't find command {0}", completionId));
            }

            var learnings = _learningRepository.LearnFor(input, completionId.GetLearningId());

            document.SetLearnings(learnings);

            writer.AddDocument(document);
        }