Skip to content

Added TermVector support #610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 28, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Elasticsearch.Net/Domain/Enums.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

///This file contains all the typed enums that the client rest api spec exposes.
///This file is automatically generated from https://github.com/elasticsearch/elasticsearch-rest-api-spec
///Generated of commit 5f64a7f7e8
///Generated of commit
namespace Elasticsearch.Net
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

///This file contains all the typed querystring parameters that are generated of the client spec.
///This file is automatically generated from https://github.com/elasticsearch/elasticsearch-rest-api-spec
///Generated of commit 5f64a7f7e8
///Generated of commit

namespace Elasticsearch.Net
{
Expand Down
2 changes: 1 addition & 1 deletion src/Elasticsearch.Net/IElasticsearchClient.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Elasticsearch.Net
///This file is automatically generated from https://github.com/elasticsearch/elasticsearch-rest-api-spec
///</pre>
///<pre>
///Generated of commit 5f64a7f7e8
///Generated of commit
///</pre>
///</summary>
public interface IElasticsearchClient
Expand Down
20 changes: 20 additions & 0 deletions src/Nest/DSL/MultiTermVectorsDescriptor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Elasticsearch.Net;

namespace Nest
{
public partial class MtermvectorsDescriptor<T> : DocumentPathDescriptorBase<MtermvectorsDescriptor<T>, T, MtermvectorsRequestParameters>
, IPathInfo<MtermvectorsRequestParameters> where T : class
{
ElasticsearchPathInfo<MtermvectorsRequestParameters> IPathInfo<MtermvectorsRequestParameters>.ToPathInfo(IConnectionSettingsValues settings)
{
var pathInfo = base.ToPathInfo<MtermvectorsRequestParameters>(settings, this._QueryString);
pathInfo.HttpMethod = PathInfoHttpMethod.POST;

return pathInfo;
}
}
}
20 changes: 20 additions & 0 deletions src/Nest/DSL/TermVectorDescriptor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Elasticsearch.Net;

namespace Nest
{
public partial class TermvectorDescriptor<T> : DocumentPathDescriptorBase<TermvectorDescriptor<T>, T, TermvectorRequestParameters>
, IPathInfo<TermvectorRequestParameters> where T : class
{
ElasticsearchPathInfo<TermvectorRequestParameters> IPathInfo<TermvectorRequestParameters>.ToPathInfo(IConnectionSettingsValues settings)
{
var pathInfo = base.ToPathInfo<TermvectorRequestParameters>(settings, this._QueryString);
pathInfo.HttpMethod = PathInfoHttpMethod.GET;

return pathInfo;
}
}
}
48 changes: 24 additions & 24 deletions src/Nest/DSL/_Descriptors.generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Elasticsearch.Net;
///This file lays the base for all the descriptors based on the query string parameters in the spec for IElasticClient.
///This file is automatically generated from https://github.com/elasticsearch/elasticsearch-rest-api-spec
///Generated of commit 5f64a7f7e8
///Generated of commit

namespace Nest
{
Expand Down Expand Up @@ -4081,45 +4081,45 @@ public MultiSearchDescriptor SearchType(SearchTypeOptions search_type)
///http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/docs-multi-termvectors.html
///</pre>
///</summary>
public partial class MtermvectorsDescriptor
public partial class MtermvectorsDescriptor<T>
{
internal MtermvectorsRequestParameters _QueryString = new MtermvectorsRequestParameters();


///<summary>A comma-separated list of documents ids. You must define ids as parameter or set &quot;ids&quot; or &quot;docs&quot; in the request body</summary>
public MtermvectorsDescriptor Ids(params string[] ids)
public MtermvectorsDescriptor<T> Ids(params string[] ids)
{
this._QueryString.Ids(ids);
return this;
}


///<summary>Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body &quot;params&quot; or &quot;docs&quot;.</summary>
public MtermvectorsDescriptor TermStatistics(bool term_statistics = true)
public MtermvectorsDescriptor<T> TermStatistics(bool term_statistics = true)
{
this._QueryString.TermStatistics(term_statistics);
return this;
}


///<summary>Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified in body &quot;params&quot; or &quot;docs&quot;.</summary>
public MtermvectorsDescriptor FieldStatistics(bool field_statistics = true)
public MtermvectorsDescriptor<T> FieldStatistics(bool field_statistics = true)
{
this._QueryString.FieldStatistics(field_statistics);
return this;
}


///<summary>A comma-separated list of fields to return. Applies to all returned documents unless otherwise specified in body &quot;params&quot; or &quot;docs&quot;.</summary>
public MtermvectorsDescriptor Fields(params string[] fields)
public MtermvectorsDescriptor<T> Fields(params string[] fields)
{
this._QueryString.Fields(fields);
return this;
}


///<summary>A comma-separated list of fields to return. Applies to all returned documents unless otherwise specified in body &quot;params&quot; or &quot;docs&quot;.</summary>
public MtermvectorsDescriptor Fields<T>(params Expression<Func<T, object>>[] typedPathLookups) where T : class
public MtermvectorsDescriptor<T> Fields(params Expression<Func<T, object>>[] typedPathLookups)
{
if (!typedPathLookups.HasAny())
return this;
Expand All @@ -4130,47 +4130,47 @@ public MtermvectorsDescriptor Fields<T>(params Expression<Func<T, object>>[] typ


///<summary>Specifies if term offsets should be returned. Applies to all returned documents unless otherwise specified in body &quot;params&quot; or &quot;docs&quot;.</summary>
public MtermvectorsDescriptor Offsets(bool offsets = true)
public MtermvectorsDescriptor<T> Offsets(bool offsets = true)
{
this._QueryString.Offsets(offsets);
return this;
}


///<summary>Specifies if term positions should be returned. Applies to all returned documents unless otherwise specified in body &quot;params&quot; or &quot;docs&quot;.</summary>
public MtermvectorsDescriptor Positions(bool positions = true)
public MtermvectorsDescriptor<T> Positions(bool positions = true)
{
this._QueryString.Positions(positions);
return this;
}


///<summary>Specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body &quot;params&quot; or &quot;docs&quot;.</summary>
public MtermvectorsDescriptor Payloads(bool payloads = true)
public MtermvectorsDescriptor<T> Payloads(bool payloads = true)
{
this._QueryString.Payloads(payloads);
return this;
}


///<summary>Specify the node or shard the operation should be performed on (default: random) .Applies to all returned documents unless otherwise specified in body &quot;params&quot; or &quot;docs&quot;.</summary>
public MtermvectorsDescriptor Preference(string preference)
public MtermvectorsDescriptor<T> Preference(string preference)
{
this._QueryString.Preference(preference);
return this;
}


///<summary>Specific routing value. Applies to all returned documents unless otherwise specified in body &quot;params&quot; or &quot;docs&quot;.</summary>
public MtermvectorsDescriptor Routing(string routing)
public MtermvectorsDescriptor<T> Routing(string routing)
{
this._QueryString.Routing(routing);
return this;
}


///<summary>Parent id of documents. Applies to all returned documents unless otherwise specified in body &quot;params&quot; or &quot;docs&quot;.</summary>
public MtermvectorsDescriptor Parent(string parent)
public MtermvectorsDescriptor<T> Parent(string parent)
{
this._QueryString.Parent(parent);
return this;
Expand Down Expand Up @@ -4981,37 +4981,37 @@ public SuggestDescriptor<T> Source(string source)
///http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/docs-termvectors.html
///</pre>
///</summary>
public partial class TermvectorDescriptor
public partial class TermvectorDescriptor<T>
{
internal TermvectorRequestParameters _QueryString = new TermvectorRequestParameters();


///<summary>Specifies if total term frequency and document frequency should be returned.</summary>
public TermvectorDescriptor TermStatistics(bool term_statistics = true)
public TermvectorDescriptor<T> TermStatistics(bool term_statistics = true)
{
this._QueryString.TermStatistics(term_statistics);
return this;
}


///<summary>Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned.</summary>
public TermvectorDescriptor FieldStatistics(bool field_statistics = true)
public TermvectorDescriptor<T> FieldStatistics(bool field_statistics = true)
{
this._QueryString.FieldStatistics(field_statistics);
return this;
}


///<summary>A comma-separated list of fields to return.</summary>
public TermvectorDescriptor Fields(params string[] fields)
public TermvectorDescriptor<T> Fields(params string[] fields)
{
this._QueryString.Fields(fields);
return this;
}


///<summary>A comma-separated list of fields to return.</summary>
public TermvectorDescriptor Fields<T>(params Expression<Func<T, object>>[] typedPathLookups) where T : class
public TermvectorDescriptor<T> Fields(params Expression<Func<T, object>>[] typedPathLookups)
{
if (!typedPathLookups.HasAny())
return this;
Expand All @@ -5022,47 +5022,47 @@ public TermvectorDescriptor Fields<T>(params Expression<Func<T, object>>[] typed


///<summary>Specifies if term offsets should be returned.</summary>
public TermvectorDescriptor Offsets(bool offsets = true)
public TermvectorDescriptor<T> Offsets(bool offsets = true)
{
this._QueryString.Offsets(offsets);
return this;
}


///<summary>Specifies if term positions should be returned.</summary>
public TermvectorDescriptor Positions(bool positions = true)
public TermvectorDescriptor<T> Positions(bool positions = true)
{
this._QueryString.Positions(positions);
return this;
}


///<summary>Specifies if term payloads should be returned.</summary>
public TermvectorDescriptor Payloads(bool payloads = true)
public TermvectorDescriptor<T> Payloads(bool payloads = true)
{
this._QueryString.Payloads(payloads);
return this;
}


///<summary>Specify the node or shard the operation should be performed on (default: random).</summary>
public TermvectorDescriptor Preference(string preference)
public TermvectorDescriptor<T> Preference(string preference)
{
this._QueryString.Preference(preference);
return this;
}


///<summary>Specific routing value.</summary>
public TermvectorDescriptor Routing(string routing)
public TermvectorDescriptor<T> Routing(string routing)
{
this._QueryString.Routing(routing);
return this;
}


///<summary>Parent id of documents.</summary>
public TermvectorDescriptor Parent(string parent)
public TermvectorDescriptor<T> Parent(string parent)
{
this._QueryString.Parent(parent);
return this;
Expand Down
2 changes: 1 addition & 1 deletion src/Nest/Domain/RequestParametersExtensions.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

///This file contains all the typed request parameters that are generated of the client spec.
///This file is automatically generated from https://github.com/elasticsearch/elasticsearch-rest-api-spec
///Generated of commit 5f64a7f7e8
///Generated of commit

namespace Nest
{
Expand Down
26 changes: 26 additions & 0 deletions src/Nest/Domain/Responses/MultiTermVectorResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;

namespace Nest
{
public interface IMultiTermVectorResponse : IResponse
{
IEnumerable<TermVectorResponse> Documents { get; }
}

[JsonObject]
public class MultiTermVectorResponse : BaseResponse, IMultiTermVectorResponse
{
public MultiTermVectorResponse()
{
IsValid = true;
Documents = new List<TermVectorResponse>();
}

[JsonProperty("docs")]
public IEnumerable<TermVectorResponse> Documents { get; internal set; }
}
}
30 changes: 30 additions & 0 deletions src/Nest/Domain/Responses/TermVectorResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;

namespace Nest
{
public interface ITermVectorResponse : IResponse
{
bool Found { get; }
IDictionary<string, TermVector> TermVectors { get; }
}

[JsonObject]
public class TermVectorResponse : BaseResponse, ITermVectorResponse
{
public TermVectorResponse()
{
IsValid = true;
TermVectors = new Dictionary<string, TermVector>();
}

[JsonProperty("found")]
public bool Found { get; internal set; }

[JsonProperty("term_vectors")]
public IDictionary<string, TermVector> TermVectors { get; internal set; }
}
}
21 changes: 21 additions & 0 deletions src/Nest/Domain/TermVector/FieldStatistics.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;

namespace Nest
{
[JsonObject]
public class FieldStatistics
{
[JsonProperty("doc_count")]
public int DocumentCount { get; internal set; }

[JsonProperty("sum_doc_freq")]
public int SumOfDocumentFrequencies { get; internal set; }

[JsonProperty("sum_ttf")]
public int SumOfTotalTermFrequencies { get; internal set; }
}
}
23 changes: 23 additions & 0 deletions src/Nest/Domain/TermVector/TermVector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;

namespace Nest
{
[JsonObject]
public class TermVector
{
public TermVector()
{
Terms = new Dictionary<string, TermVectorTerm>();
}

[JsonProperty("field_statistics")]
public FieldStatistics FieldStatistics { get; internal set; }

[JsonProperty("terms")]
public IDictionary<string, TermVectorTerm> Terms { get; internal set; }
}
}
Loading