コード例 #1
0
ファイル: SolrConnection.cs プロジェクト: ELEMENTSECM/SolrNet
        /// <summary>
        /// Gets the Query
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        private string GetQuery(IEnumerable <KeyValuePair <string, string> > parameters)
        {
            var param = new List <KeyValuePair <string, string> >();

            if (parameters != null)
            {
                param.AddRange(parameters);
            }

            param.Add(KV.Create("version", version));
            return(string.Join("&", param
                               .Select(kv => KV.Create(HttpUtility.UrlEncode(kv.Key), HttpUtility.UrlEncode(kv.Value)))
                               .Select(kv => string.Format("{0}={1}", kv.Key, kv.Value))
                               .ToArray()));
        }
コード例 #2
0
ファイル: SolrConnection.cs プロジェクト: zahrahamzah/SolrNet
        /// <summary>
        /// Gets the Query
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        private string GetQuery(IEnumerable <KeyValuePair <string, string> > parameters)
        {
            var param = new List <KeyValuePair <string, string> >();

            if (parameters != null)
            {
                param.AddRange(parameters);
            }

            param.Add(KV.Create("version", version));

            if (param.All(x => x.Key != "wt"))
            {
                // only set wt=xml if wt wasn't already set by the caller
                param.Add(KV.Create("wt", "xml"));
            }

            return(string.Join("&", param
                               .Select(kv => KV.Create(HttpUtility.UrlEncode(kv.Key), HttpUtility.UrlEncode(kv.Value)))
                               .Select(kv => string.Format("{0}={1}", kv.Key, kv.Value))
                               .ToArray()));
        }