Skip to content

Commit

Permalink
Updated SolrField.cs & SolrSchemaParser.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
fatmuis committed Jan 16, 2014
1 parent 8926849 commit 6e42480
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 93 deletions.
4 changes: 4 additions & 0 deletions Documentation/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ It's very uncommon for Solr to make breaking changes in core functionality betwe

You're probably using an outdated version. [Upgrade to a recent build](README.md#downloads)

#### I'm getting a 404 (not found) response from Solr when doing any operation with SolrNet

You're probably missing the core name in the URL you're passing to Startup.Init

#### I'm getting an error "'SolrConnection' already registered in container"

Make sure you call `Startup.Init` [only once per document type in your application](Initialization.md).
Expand Down
4 changes: 4 additions & 0 deletions SampleSolrApp.Tests/MSolrReadOnlyOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public ResponseHeader Ping() {
throw new NotImplementedException();
}

public SolrSchema GetSchema(string filename) {
throw new NotImplementedException();
}

public SolrSchema GetSchema() {
throw new NotImplementedException();
}
Expand Down
40 changes: 0 additions & 40 deletions SolrNet.Tests/GetSchemaCommandTests.cs

This file was deleted.

2 changes: 1 addition & 1 deletion SolrNet.Tests/Mocks/MSolrBasicOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public ResponseHeader Ping() {

public MFunc<SolrSchema> getSchema;

public SolrSchema GetSchema() {
public SolrSchema GetSchema(string schemaFileName) {
return getSchema.Invoke();
}

Expand Down
2 changes: 1 addition & 1 deletion SolrNet.Tests/Mocks/MSolrOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public ResponseHeader Ping() {
throw new NotImplementedException();
}

public SolrSchema GetSchema() {
public SolrSchema GetSchema(string schemaFileName) {
throw new NotImplementedException();
}

Expand Down
1 change: 0 additions & 1 deletion SolrNet.Tests/SolrNet.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
<Compile Include="CommonServiceLocatorTests.cs" />
<Compile Include="DateTimeFieldParserTests.cs" />
<Compile Include="GenericDictionaryFieldSerializerTests.cs" />
<Compile Include="GetSchemaCommandTests.cs" />
<Compile Include="InferringFieldParserTests.cs" />
<Compile Include="DefaultFieldParserTests.cs" />
<Compile Include="DeleteCommandTests.cs" />
Expand Down
35 changes: 0 additions & 35 deletions SolrNet/Commands/GetSchemaCommand.cs

This file was deleted.

15 changes: 8 additions & 7 deletions SolrNet/ISolrBasicReadOnlyOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ public interface ISolrBasicReadOnlyOperations<T> {
/// It can be used by a load balancer in front of a set of Solr servers to check response time of all the Solr servers in order to do response time based load balancing.
/// See http://wiki.apache.org/solr/SolrConfigXml for more information.
/// </summary>
ResponseHeader Ping();

/// <summary>
/// Gets the schema.
/// </summary>
/// <returns>Solr schema</returns>
SolrSchema GetSchema();
ResponseHeader Ping();

/// <summary>
/// Gets the schema.
/// </summary>
/// <param name="schemaFileName">Name of the schema file.</param>
/// <returns> Solr schema </returns>
SolrSchema GetSchema(string schemaFileName);

/// <summary>
/// Gets the current status of the DataImportHandler.
Expand Down
8 changes: 4 additions & 4 deletions SolrNet/Impl/SolrBasicServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ public ResponseHeader SendAndParseHeader(ISolrCommand cmd) {

public ResponseHeader Ping() {
return SendAndParseHeader(new PingCommand());
}

public SolrSchema GetSchema() {
string schemaXml = new GetSchemaCommand().Execute(connection);
}

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);
}
Expand Down
6 changes: 5 additions & 1 deletion SolrNet/Impl/SolrServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,11 @@ public ResponseHeader Add(T doc, AddParameters parameters) {
}

public SolrSchema GetSchema() {
return basicServer.GetSchema();
return basicServer.GetSchema("schema.xml");
}

public SolrSchema GetSchema(string schemaFileName) {
return basicServer.GetSchema(schemaFileName);
}

public IEnumerable<ValidationResult> EnumerateValidationResults() {
Expand Down
26 changes: 25 additions & 1 deletion SolrNet/Schema/SolrField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,31 @@ public SolrField(string name, SolrFieldType type) {
/// <value>
/// <c>true</c> if this instance is multi valued; otherwise, <c>false</c>.
/// </value>
public bool IsMultiValued { get; set; }
public bool IsMultiValued { get; set; }

/// <summary>
/// Gets or sets a value indicating whether this instance is indexed.
/// </summary>
/// <value>
/// <c>true</c> if this instance is indexed; otherwise, <c>false</c>.
/// </value>
public bool IsIndexed { get; set; }

/// <summary>
/// Gets or sets a value indicating whether this instance is stored.
/// </summary>
/// <value>
/// <c>true</c> if this instance is stored; otherwise, <c>false</c>.
/// </value>
public bool IsStored { get; set; }

/// <summary>
/// Gets or sets a value indicating whether this instance is docValues.
/// </summary>
/// <value>
/// <c>true</c> if this instance is docValues; otherwise, <c>false</c>.
/// </value>
public bool IsDocValues { get; set; }

/// <summary>
/// Field type
Expand Down
6 changes: 5 additions & 1 deletion SolrNet/Schema/SolrSchemaParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ public SolrSchema Parse(XDocument solrSchemaXml) {
throw new SolrNetException(string.Format("Field type '{0}' not found", fieldTypeName));
var field = new SolrField(fieldNode.Attribute("name").Value, fieldType);
field.IsRequired = fieldNode.Attribute("required") != null ? fieldNode.Attribute("required").Value.ToLower().Equals(Boolean.TrueString.ToLower()) : false;
field.IsMultiValued = fieldNode.Attribute("multiValued") != null ? fieldNode.Attribute("multiValued").Value.ToLower().Equals(Boolean.TrueString.ToLower()) : false;
field.IsMultiValued = fieldNode.Attribute("multiValued") != null ? fieldNode.Attribute("multiValued").Value.ToLower().Equals(Boolean.TrueString.ToLower()) : false;
field.IsStored = fieldNode.Attribute("stored") != null ? fieldNode.Attribute("stored").Value.ToLower().Equals(Boolean.TrueString.ToLower()) : false;
field.IsIndexed = fieldNode.Attribute("indexed") != null ? fieldNode.Attribute("indexed").Value.ToLower().Equals(Boolean.TrueString.ToLower()) : false;
field.IsDocValues = fieldNode.Attribute("docValues") != null ? fieldNode.Attribute("docValues").Value.ToLower().Equals(Boolean.TrueString.ToLower()) : false;

result.SolrFields.Add(field);
}

Expand Down
1 change: 0 additions & 1 deletion SolrNet/SolrNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
<Compile Include="AddParameters.cs" />
<Compile Include="CollapsedDocument.cs" />
<Compile Include="Commands\ExtractCommand.cs" />
<Compile Include="Commands\GetSchemaCommand.cs" />
<Compile Include="Commands\Parameters\CollapseParameters.cs" />
<Compile Include="Commands\Parameters\DeleteByIdAndOrQueryParam.cs" />
<Compile Include="Commands\Parameters\FacetParameters.cs" />
Expand Down
Binary file added UpgradeLog.htm
Binary file not shown.

0 comments on commit 6e42480

Please sign in to comment.