コード例 #1
0
        public async Task <SolrQueryResults <T> > ExecuteAsync(ISolrQuery q, QueryOptions options, CancellationToken cancellationToken = default(CancellationToken))
        {
            var handler = options?.RequestHandler?.HandlerUrl ?? DefaultHandler;
            var param   = GetAllParameters(q, options);
            var results = new SolrQueryResults <T>();

            XDocument xml;

            if (connection is IStreamSolrConnection cc)
            {
                using (var r = await cc.GetAsStreamAsync(handler, param, cancellationToken))
                {
                    xml = XDocument.Load(r);
                }
            }
            else
            {
                var r = await connection.GetAsync(handler, param, cancellationToken);

                xml = XDocument.Parse(r);
            }

            resultParser.Parse(xml, results);
            return(results);
        }
コード例 #2
0
        /// <inheritdoc />
        public async Task <SolrSchema> GetSchemaAsync(string schemaFileName)
        {
            string schemaXml = await connection.GetAsync("/admin/file", new[] { new KeyValuePair <string, string>("file", schemaFileName) });

            var schema = XDocument.Parse(schemaXml);

            return(schemaParser.Parse(schema));
        }
コード例 #3
0
        public async Task <SolrQueryResults <T> > ExecuteAsync(ISolrQuery q, QueryOptions options)
        {
            var param   = GetAllParameters(q, options);
            var results = new SolrQueryResults <T>();
            var r       = await connection.GetAsync(Handler, param);

            var xml = XDocument.Parse(r);

            resultParser.Parse(xml, results);
            return(results);
        }
コード例 #4
0
        public virtual async Task <string> GetAsync(string relativeUrl, IEnumerable <KeyValuePair <string, string> > parameters, CancellationToken cancellationToken = default(CancellationToken))
        {
            Console.WriteLine("Getting Async");
            var r = await conn.GetAsync(relativeUrl, parameters, cancellationToken);

            Console.WriteLine("Result is:\n" + r);
            return(r);
        }
コード例 #5
0
 public async Task <string> GetAsync(string relativeUrl, IEnumerable <KeyValuePair <string, string> > parameters,
                                     CancellationToken cancellationToken = new CancellationToken())
 {
     Log(
         $"{nameof(relativeUrl)}={relativeUrl}, " +
         $"{nameof(parameters)}={string.Join(", ", parameters.Select(p => $"{p.Key}={p.Value}"))}"
         );
     return(await _connection.GetAsync(relativeUrl, parameters, cancellationToken));
 }
コード例 #6
0
 public Task <string> ExecuteAsync(ISolrConnection connection)
 {
     return(connection.GetAsync("/admin/ping", new Dictionary <string, string>()));
 }
        public Task <string> GetAsync(string relativeUrl, IEnumerable <KeyValuePair <string, string> > parameters)
        {
            var stringParams = string.Join(", ", parameters.Select(p => string.Format("{0}={1}", p.Key, p.Value)).ToArray());

            return(connection.GetAsync(relativeUrl, parameters));
        }
コード例 #8
0
 public Task <string> ExecuteAsync(ISolrConnection connection)
 {
     return(connection.GetAsync("/replication", Parameters.ToArray()));
 }
コード例 #9
0
 public Task <string> ExecuteAsync(ISolrConnection connection)
 {
     return(connection.GetAsync("/admin/cores", Parameters.ToArray()));
 }