Skip to content

Commit

Permalink
issue-94-patch
Browse files Browse the repository at this point in the history
git-svn-id: http://solrnet.googlecode.com/svn/trunk@516 66c3f25c-543c-0410-ae2e-6f2ca0bd8c61
  • Loading branch information
mausch committed Feb 6, 2010
1 parent ca2c799 commit baeb72c
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions SolrNet/SolrMultipleCriteriaQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#endregion

using System.Collections.Generic;
using System.Text;
using SolrNet.Utils;

namespace SolrNet {
Expand Down Expand Up @@ -78,12 +79,22 @@ public class Operator {
/// </summary>
public override string Query {
get {
var queryStrings = Func.Filter(queries, x => x != null && !string.IsNullOrEmpty(x.Query));
var q = Func.Join(string.Format(" {0} ", oper), queryStrings, query => query.Query, true);
if (!string.IsNullOrEmpty(q))
q = "(" + q + ")";
return q;
}
var queryBuilder = new StringBuilder();
foreach (var query in Queries) {
if (query == null)
continue;
var q = query.Query;
if (string.IsNullOrEmpty(q))
continue;
if (queryBuilder.Length > 0)
queryBuilder.AppendFormat(" {0} ", oper);
queryBuilder.Append(q);
}
var queryString = queryBuilder.ToString();
if (!string.IsNullOrEmpty(queryString))
queryString = "(" + queryString + ")";
return queryString;
}
}
}
}

0 comments on commit baeb72c

Please sign in to comment.