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.
upgraded structuremap to the latest version
fixed broken injections ilmerge not fixed.... I dont care
- Loading branch information
unknown
authored and
unknown
committed
Jan 7, 2015
1 parent
6100e27
commit 95191c3
Showing
18 changed files
with
1,102 additions
and
1,011 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Castle.Core" version="3.2.0" targetFramework="net35" /> | ||
<package id="Castle.Windsor" version="3.2.0" targetFramework="net35" /> | ||
<package id="Castle.Core" version="3.2.0" targetFramework="net35" requireReinstallation="True" /> | ||
<package id="Castle.Windsor" version="3.2.0" targetFramework="net35" requireReinstallation="True" /> | ||
</packages> |
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,35 +1,35 @@ | ||
#region license | ||
// Copyright (c) 2007-2010 Mauricio Scheffer | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
#endregion | ||
|
||
using System.Collections.Generic; | ||
#region license | ||
// Copyright (c) 2007-2010 Mauricio Scheffer | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
#endregion | ||
|
||
using System.Collections.Generic; | ||
using SolrNet.Commands.Parameters; | ||
using SolrNet.Impl; | ||
|
||
namespace SolrNet { | ||
/// <summary> | ||
/// Executable query | ||
/// </summary> | ||
/// <typeparam name="T">Document type</typeparam> | ||
public interface ISolrQueryExecuter<T> { | ||
/// <summary> | ||
/// Executes the query and returns results | ||
/// </summary> | ||
/// <returns>query results</returns> | ||
namespace SolrNet { | ||
/// <summary> | ||
/// Executable query | ||
/// </summary> | ||
/// <typeparam name="T">Document type</typeparam> | ||
public interface ISolrQueryExecuter<T> { | ||
/// <summary> | ||
/// Executes the query and returns results | ||
/// </summary> | ||
/// <returns>query results</returns> | ||
SolrQueryResults<T> Execute(ISolrQuery q, QueryOptions options); | ||
|
||
SolrMoreLikeThisHandlerResults<T> Execute(SolrMLTQuery query, MoreLikeThisHandlerQueryOptions options); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,138 +1,138 @@ | ||
#region license | ||
// Copyright (c) 2007-2010 Mauricio Scheffer | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
#endregion | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Xml.Linq; | ||
using SolrNet.Commands; | ||
using SolrNet.Commands.Parameters; | ||
using SolrNet.Schema; | ||
|
||
namespace SolrNet.Impl { | ||
/// <summary> | ||
/// Implements the basic Solr operations | ||
/// </summary> | ||
/// <typeparam name="T">Document type</typeparam> | ||
public class SolrBasicServer<T> : ISolrBasicOperations<T> { | ||
private readonly ISolrConnection connection; | ||
private readonly ISolrQueryExecuter<T> queryExecuter; | ||
private readonly ISolrDocumentSerializer<T> documentSerializer; | ||
private readonly ISolrSchemaParser schemaParser; | ||
private readonly ISolrHeaderResponseParser headerParser; | ||
private readonly ISolrQuerySerializer querySerializer; | ||
private readonly ISolrDIHStatusParser dihStatusParser; | ||
private readonly ISolrExtractResponseParser extractResponseParser; | ||
|
||
public SolrBasicServer(ISolrConnection connection, ISolrQueryExecuter<T> queryExecuter, ISolrDocumentSerializer<T> documentSerializer, ISolrSchemaParser schemaParser, ISolrHeaderResponseParser headerParser, ISolrQuerySerializer querySerializer, ISolrDIHStatusParser dihStatusParser, ISolrExtractResponseParser extractResponseParser) { | ||
this.connection = connection; | ||
this.extractResponseParser = extractResponseParser; | ||
this.queryExecuter = queryExecuter; | ||
this.documentSerializer = documentSerializer; | ||
this.schemaParser = schemaParser; | ||
this.headerParser = headerParser; | ||
this.querySerializer = querySerializer; | ||
this.dihStatusParser = dihStatusParser; | ||
} | ||
|
||
public ResponseHeader Commit(CommitOptions options) { | ||
options = options ?? new CommitOptions(); | ||
var cmd = new CommitCommand { | ||
WaitFlush = options.WaitFlush, | ||
WaitSearcher = options.WaitSearcher, | ||
ExpungeDeletes = options.ExpungeDeletes, | ||
MaxSegments = options.MaxSegments, | ||
}; | ||
return SendAndParseHeader(cmd); | ||
} | ||
|
||
public ResponseHeader Optimize(CommitOptions options) { | ||
options = options ?? new CommitOptions(); | ||
var cmd = new OptimizeCommand { | ||
WaitFlush = options.WaitFlush, | ||
WaitSearcher = options.WaitSearcher, | ||
ExpungeDeletes = options.ExpungeDeletes, | ||
MaxSegments = options.MaxSegments, | ||
}; | ||
return SendAndParseHeader(cmd); | ||
} | ||
|
||
public ResponseHeader Rollback() { | ||
return SendAndParseHeader(new RollbackCommand()); | ||
} | ||
|
||
public ResponseHeader AddWithBoost(IEnumerable<KeyValuePair<T, double?>> docs, AddParameters parameters) { | ||
var cmd = new AddCommand<T>(docs, documentSerializer, parameters); | ||
return SendAndParseHeader(cmd); | ||
} | ||
|
||
public ExtractResponse Extract(ExtractParameters parameters) { | ||
var cmd = new ExtractCommand(parameters); | ||
return SendAndParseExtract(cmd); | ||
#region license | ||
// Copyright (c) 2007-2010 Mauricio Scheffer | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
#endregion | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Xml.Linq; | ||
using SolrNet.Commands; | ||
using SolrNet.Commands.Parameters; | ||
using SolrNet.Schema; | ||
|
||
namespace SolrNet.Impl { | ||
/// <summary> | ||
/// Implements the basic Solr operations | ||
/// </summary> | ||
/// <typeparam name="T">Document type</typeparam> | ||
public class SolrBasicServer<T> : ISolrBasicOperations<T> { | ||
private readonly ISolrConnection connection; | ||
private readonly ISolrQueryExecuter<T> queryExecuter; | ||
private readonly ISolrDocumentSerializer<T> documentSerializer; | ||
private readonly ISolrSchemaParser schemaParser; | ||
private readonly ISolrHeaderResponseParser headerParser; | ||
private readonly ISolrQuerySerializer querySerializer; | ||
private readonly ISolrDIHStatusParser dihStatusParser; | ||
private readonly ISolrExtractResponseParser extractResponseParser; | ||
|
||
public SolrBasicServer(ISolrConnection connection, ISolrQueryExecuter<T> queryExecuter, ISolrDocumentSerializer<T> documentSerializer, ISolrSchemaParser schemaParser, ISolrHeaderResponseParser headerParser, ISolrQuerySerializer querySerializer, ISolrDIHStatusParser dihStatusParser, ISolrExtractResponseParser extractResponseParser) { | ||
this.connection = connection; | ||
this.extractResponseParser = extractResponseParser; | ||
this.queryExecuter = queryExecuter; | ||
this.documentSerializer = documentSerializer; | ||
this.schemaParser = schemaParser; | ||
this.headerParser = headerParser; | ||
this.querySerializer = querySerializer; | ||
this.dihStatusParser = dihStatusParser; | ||
} | ||
|
||
public ResponseHeader Commit(CommitOptions options) { | ||
options = options ?? new CommitOptions(); | ||
var cmd = new CommitCommand { | ||
WaitFlush = options.WaitFlush, | ||
WaitSearcher = options.WaitSearcher, | ||
ExpungeDeletes = options.ExpungeDeletes, | ||
MaxSegments = options.MaxSegments, | ||
}; | ||
return SendAndParseHeader(cmd); | ||
} | ||
|
||
public ResponseHeader Optimize(CommitOptions options) { | ||
options = options ?? new CommitOptions(); | ||
var cmd = new OptimizeCommand { | ||
WaitFlush = options.WaitFlush, | ||
WaitSearcher = options.WaitSearcher, | ||
ExpungeDeletes = options.ExpungeDeletes, | ||
MaxSegments = options.MaxSegments, | ||
}; | ||
return SendAndParseHeader(cmd); | ||
} | ||
|
||
public ResponseHeader Rollback() { | ||
return SendAndParseHeader(new RollbackCommand()); | ||
} | ||
|
||
public ResponseHeader AddWithBoost(IEnumerable<KeyValuePair<T, double?>> docs, AddParameters parameters) { | ||
var cmd = new AddCommand<T>(docs, documentSerializer, parameters); | ||
return SendAndParseHeader(cmd); | ||
} | ||
|
||
public ExtractResponse Extract(ExtractParameters parameters) { | ||
var cmd = new ExtractCommand(parameters); | ||
return SendAndParseExtract(cmd); | ||
} | ||
|
||
public ResponseHeader Delete(IEnumerable<string> ids, ISolrQuery q, DeleteParameters parameters) | ||
{ | ||
var delete = new DeleteCommand(new DeleteByIdAndOrQueryParam(ids, q, querySerializer), parameters); | ||
return SendAndParseHeader(delete); | ||
} | ||
|
||
public ResponseHeader Delete(IEnumerable<string> ids, ISolrQuery q) { | ||
var delete = new DeleteCommand(new DeleteByIdAndOrQueryParam(ids, q, querySerializer), null); | ||
return SendAndParseHeader(delete); | ||
} | ||
|
||
public SolrQueryResults<T> Query(ISolrQuery query, QueryOptions options) { | ||
return queryExecuter.Execute(query, options); | ||
} | ||
|
||
public string Send(ISolrCommand cmd) { | ||
return cmd.Execute(connection); | ||
} | ||
|
||
public ExtractResponse SendAndParseExtract(ISolrCommand cmd) { | ||
var r = Send(cmd); | ||
var xml = XDocument.Parse(r); | ||
return extractResponseParser.Parse(xml); | ||
} | ||
|
||
public ResponseHeader SendAndParseHeader(ISolrCommand cmd) { | ||
var r = Send(cmd); | ||
var xml = XDocument.Parse(r); | ||
return headerParser.Parse(xml); | ||
} | ||
|
||
public ResponseHeader Ping() { | ||
return SendAndParseHeader(new PingCommand()); | ||
} | ||
|
||
public ResponseHeader Delete(IEnumerable<string> ids, ISolrQuery q) { | ||
var delete = new DeleteCommand(new DeleteByIdAndOrQueryParam(ids, q, querySerializer), null); | ||
return SendAndParseHeader(delete); | ||
} | ||
|
||
public SolrQueryResults<T> Query(ISolrQuery query, QueryOptions options) { | ||
return queryExecuter.Execute(query, options); | ||
} | ||
|
||
public string Send(ISolrCommand cmd) { | ||
return cmd.Execute(connection); | ||
} | ||
|
||
public ExtractResponse SendAndParseExtract(ISolrCommand cmd) { | ||
var r = Send(cmd); | ||
var xml = XDocument.Parse(r); | ||
return extractResponseParser.Parse(xml); | ||
} | ||
|
||
public ResponseHeader SendAndParseHeader(ISolrCommand cmd) { | ||
var r = Send(cmd); | ||
var xml = XDocument.Parse(r); | ||
return headerParser.Parse(xml); | ||
} | ||
|
||
public ResponseHeader Ping() { | ||
return SendAndParseHeader(new PingCommand()); | ||
} | ||
|
||
public SolrSchema GetSchema(string schemaFileName) { | ||
string schemaXml = connection.Get("/admin/file", new[] { new KeyValuePair<string, string>("file", schemaFileName) }); | ||
var schema = XDocument.Parse(schemaXml); | ||
return schemaParser.Parse(schema); | ||
} | ||
|
||
public SolrDIHStatus GetDIHStatus(KeyValuePair<string, string> options) { | ||
var response = connection.Get("/dataimport", null); | ||
var dihstatus = XDocument.Parse(response); | ||
return dihStatusParser.Parse(dihstatus); | ||
string schemaXml = connection.Get("/admin/file", new[] { new KeyValuePair<string, string>("file", schemaFileName) }); | ||
var schema = XDocument.Parse(schemaXml); | ||
return schemaParser.Parse(schema); | ||
} | ||
|
||
public SolrDIHStatus GetDIHStatus(KeyValuePair<string, string> options) { | ||
var response = connection.Get("/dataimport", null); | ||
var dihstatus = XDocument.Parse(response); | ||
return dihStatusParser.Parse(dihstatus); | ||
} | ||
|
||
public SolrMoreLikeThisHandlerResults<T> MoreLikeThis(SolrMLTQuery query, MoreLikeThisHandlerQueryOptions options) | ||
{ | ||
return this.queryExecuter.Execute(query, options); | ||
} | ||
} | ||
} | ||
{ | ||
return this.queryExecuter.Execute(query, options); | ||
} | ||
} | ||
} |
Oops, something went wrong.