internal void Deserialize(IBinaryReader reader, int count)
        {
            for (int i = 0; i < count; i++)
            {
                SearchQueryResult result = new SearchQueryResult();
                result.Deserialize(reader);
				_queryResults.Add(result);
            }
        }
Exemplo n.º 2
0
 internal void Deserialize(IBinaryReader reader, int count)
 {
     for (int i = 0; i < count; i++)
     {
         SearchQueryResult result = new SearchQueryResult();
         result.Deserialize(reader);
         _queryResults.Add(result);
     }
 }
Exemplo n.º 3
0
        private string ParseResult(SearchQueryResult res)
        {
            StringBuilder output = new StringBuilder();
            output.Append(RES_HEADER_TEMPLATE);
            output.AppendFormat("<h1>Server response status: {0}</h1>", Enum.GetName(typeof(CommandStatus), res.Status));
            if (res.HasWarning)
                output.AppendFormat("<h2 style='color: olive;'>Warning: {0}</h2>", res.Warning);
            output.AppendFormat("<h2>Matches count: {0}</h2>", res.Matches.Count);
            output.Append("<table border=1><tr><th>Document ID</th><th>Weight</th><th>Attributes</th></tr>");
            foreach (Match match in res.Matches)
            {
                output.Append("<tr>");
                output.AppendFormat("<td>{0}</td>", match.DocumentId);
                output.AppendFormat("<td>{0}</td>", match.Weight);
                output.AppendFormat("<td><div>Attributes count: {0}</div>", match.AttributesValues.Count);
                output.AppendFormat("<table border=1><tr><th>Name</th><th>Value</th><th>Type</th></tr>");
                foreach (AttributeBase attr in match.AttributesValues)
                {
                    string name = attr.Name;
                    string type = Enum.GetName(typeof(AttributeType), attr.AttributeType);
                    string val = GetAttributeValueAsString(attr);
                    
                    output.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>", name, val, type);
                }
                output.Append("</table></td></tr>");
            }
            output.Append("</table>");
            output.AppendFormat("<h2>Words count: {0}</h2>", res.Words.Count);
            output.Append("<table border=1><tr><th>Word</th><th>Hits</th><th>Documents</th></tr>");
            foreach (WordInfo w in res.Words)
            {
                output.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>", w.Word, w.Hits, w.Documents);
            }
            output.Append("</table>");
            output.AppendFormat("<p>Elapsed time: {0}</p>", res.ElapsedTime);
            output.AppendFormat("<p>Count in list: {0}</p>", res.Count);
            output.AppendFormat("<p>Total found: {0}</p>", res.TotalFound);

            output.Append(RES_FOOTER_TEMPLATE);
            return output.ToString();
        }