forked from SolrNet/SolrNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://solrnet.googlecode.com/svn/trunk@50 66c3f25c-543c-0410-ae2e-6f2ca0bd8c61
- Loading branch information
Showing
25 changed files
with
230 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace SolrNet.DSL { | ||
public class DSLRun<T> : IDSLRun<T> where T : ISolrDocument, new() { | ||
private ICollection<SortOrder> order = new List<SortOrder>(); | ||
protected ISolrConnection connection; | ||
protected ISolrQuery<T> query; | ||
|
||
public DSLRun(ISolrConnection connection) { | ||
this.connection = connection; | ||
} | ||
|
||
public DSLRun(ISolrConnection connection, ISolrQuery<T> query) { | ||
this.connection = connection; | ||
this.query = query; | ||
} | ||
|
||
public DSLRun(ISolrConnection connection, ISolrQuery<T> query, ICollection<SortOrder> order) { | ||
this.connection = connection; | ||
this.query = query; | ||
this.order = order; | ||
} | ||
|
||
public ISolrQueryResults<T> Run() { | ||
ISolrQueryExecuter<T> exe = new SolrQueryExecuter<T>(connection, query); | ||
exe.OrderBy = order; | ||
return exe.Execute(); | ||
} | ||
|
||
public ISolrQueryResults<T> Run(int start, int rows) { | ||
ISolrQueryExecuter<T> exe = new SolrQueryExecuter<T>(connection, query); | ||
exe.OrderBy = order; | ||
return exe.Execute(start, rows); | ||
} | ||
|
||
public IDSLRun<T> OrderBy(string fieldName) { | ||
List<SortOrder> newOrder = new List<SortOrder>(order); | ||
newOrder.Add(new SortOrder(fieldName)); | ||
return new DSLRun<T>(connection, query, newOrder); | ||
} | ||
|
||
public IDSLRun<T> OrderBy(string fieldName, Order o) { | ||
List<SortOrder> newOrder = new List<SortOrder>(order); | ||
newOrder.Add(new SortOrder(fieldName, o)); | ||
return new DSLRun<T>(connection, query, newOrder); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace SolrNet.DSL { | ||
public interface IDSLRun<T> where T : ISolrDocument, new() { | ||
ISolrQueryResults<T> Run(); | ||
ISolrQueryResults<T> Run(int start, int rows); | ||
IDSLRun<T> OrderBy(string fieldName); | ||
IDSLRun<T> OrderBy(string fieldName, Order o); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.