示例#1
0
		public override ISnippetReader GetSnippet (string [] query_terms, Hit hit, bool full_text, int ctx_length, int snp_length)
		{
			TextReader reader = TextCache.UserCache.GetReader (hit.Uri);

			if (reader == null)
				return null;

			string line = reader.ReadLine ();

			if (line[0] == '<')
				reader = new HtmlRemovingReader (reader);

			return SnippetFu.GetSnippet (query_terms, reader, full_text, ctx_length, snp_length);
		}
示例#2
0
		protected override void Load ()
		{
			ClearUtterances ();

			string line = TextReader.ReadLine (); // throw away first line

			if (line == null)
				return;

			TextReader reader = base.TextReader;

			// Could the second line ever start w/ < in a non-html log?
			// I hope not!
			if (line.Length > 0 && line [0] == '<')
				reader = new HtmlRemovingReader (TextReader);
				
			while ((line = reader.ReadLine ()) != null) {
				try {
					ProcessLine (line);
				} catch (Exception e) {
					Logger.Log.Warn ("Could not parse line in '{0}'", File.FullName);
					Logger.Log.Warn (e);
				}
			}
		}
示例#3
0
		protected override void DoPull ()
		{
			string line = TextReader.ReadLine ();

			if (String.IsNullOrEmpty (line)) {
				Error ();
				return;
			}

			TextReader reader = base.TextReader;

			// If this is a HTML log, use our totally awesome HTML
			// removing TextReader :-)
			if (line [0] == '<')
				reader = new HtmlRemovingReader (TextReader);

			while ((line = reader.ReadLine ()) != null) {
				string text = null;

				try {
					text = ProcessLine (line);
				} catch (Exception e) {
					Logger.Log.Error ("Could not parse line in: '{0}'", FileInfo.FullName);
					Logger.Log.Error (e);
				}

				if (!String.IsNullOrEmpty (text)) {
					AppendText (text);
					AppendWhiteSpace ();
				}
			}

			reader.Close ();
			Finished ();
		}