Skip to content

Commit a58f60c

Browse files
authored
chore: allow git to handle line endings (#42)
1 parent 0979c45 commit a58f60c

File tree

269 files changed

+16598
-16562
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

269 files changed

+16598
-16562
lines changed

.gitattributes

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Explicitly declare text files you want to always be normalized and converted
5+
# to native line endings on checkout.
6+
*.cs text diff=csharp
7+
*.xaml text
8+
*.txt text
9+
*.tt text
10+
*.ps1 text
11+
*.cmd text
12+
*.msbuild text
13+
*.md text
14+
15+
*.sln text eol=crlf
16+
*.csproj text eol=crlf
17+
*.vbproj text eol=crlf
18+
*.fsproj text eol=crlf
19+
*.dbproj text eol=crlf
20+
21+
# Resharper DotSettings files are in Unix format
22+
*.DotSettings text eol=lf
23+
24+
# Binary files
25+
*.png binary
26+
*.jpg binary
27+
*.dll binary
28+
*.exe binary
Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
1-
using NHibernate.Search.Attributes;
2-
3-
namespace NHibernate.Search.Tests
4-
{
5-
/// <summary> Example of 2 entities mapped in the same index</summary>
6-
[Indexed(Index = "Documents")]
7-
public class AlternateDocument
8-
{
9-
private int id;
10-
private string title;
11-
private string summary;
12-
private string text;
13-
14-
public AlternateDocument() { }
15-
16-
public AlternateDocument(int id, string title, string summary, string text)
17-
{
18-
this.id = id;
19-
this.title = title;
20-
this.summary = summary;
21-
this.text = text;
22-
}
23-
24-
[DocumentId]
25-
public virtual int Id
26-
{
27-
get { return id; }
28-
set { id = value; }
29-
}
30-
31-
[Field(Index.Tokenized, Store = Attributes.Store.Yes, Name = "alt_title")]
32-
[Boost(2)]
33-
public virtual string Title
34-
{
35-
get { return title; }
36-
set { title = value; }
37-
}
38-
39-
[Field(Index.Tokenized, Name = "Abstract", Store = Attributes.Store.No)]
40-
public virtual string Summary
41-
{
42-
get { return summary; }
43-
set { summary = value; }
44-
}
45-
46-
[Field(Index.Tokenized, Store = Attributes.Store.No)]
47-
public virtual string Text
48-
{
49-
get { return text; }
50-
set { text = value; }
51-
}
52-
}
1+
using NHibernate.Search.Attributes;
2+
3+
namespace NHibernate.Search.Tests
4+
{
5+
/// <summary> Example of 2 entities mapped in the same index</summary>
6+
[Indexed(Index = "Documents")]
7+
public class AlternateDocument
8+
{
9+
private int id;
10+
private string title;
11+
private string summary;
12+
private string text;
13+
14+
public AlternateDocument() { }
15+
16+
public AlternateDocument(int id, string title, string summary, string text)
17+
{
18+
this.id = id;
19+
this.title = title;
20+
this.summary = summary;
21+
this.text = text;
22+
}
23+
24+
[DocumentId]
25+
public virtual int Id
26+
{
27+
get { return id; }
28+
set { id = value; }
29+
}
30+
31+
[Field(Index.Tokenized, Store = Attributes.Store.Yes, Name = "alt_title")]
32+
[Boost(2)]
33+
public virtual string Title
34+
{
35+
get { return title; }
36+
set { title = value; }
37+
}
38+
39+
[Field(Index.Tokenized, Name = "Abstract", Store = Attributes.Store.No)]
40+
public virtual string Summary
41+
{
42+
get { return summary; }
43+
set { summary = value; }
44+
}
45+
46+
[Field(Index.Tokenized, Store = Attributes.Store.No)]
47+
public virtual string Text
48+
{
49+
get { return text; }
50+
set { text = value; }
51+
}
52+
}
5353
}
Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
using System.IO;
2-
using Lucene.Net.Analysis;
3-
using Lucene.Net.Analysis.Standard;
4-
using Lucene.Net.Analysis.TokenAttributes;
5-
using Lucene.Net.Util;
6-
7-
namespace NHibernate.Search.Tests.Analyzer
8-
{
9-
public abstract class AbstractTestAnalyzer : Lucene.Net.Analysis.Analyzer
10-
{
11-
protected abstract string[] Tokens { get; }
12-
13-
protected override TokenStreamComponents CreateComponents(string fieldName, TextReader reader)
14-
{
15-
return new TokenStreamComponents(
16-
new StandardTokenizer(LuceneVersion.LUCENE_48, reader),
17-
new InternalTokenStream(Tokens));
18-
}
19-
20-
private sealed class InternalTokenStream : TokenStream
21-
{
22-
private readonly string[] tokens;
23-
private int position;
24-
private readonly IPayloadAttribute attribute;
25-
26-
public InternalTokenStream(string[] tokens)
27-
{
28-
this.tokens = tokens;
29-
attribute = AddAttribute<IPayloadAttribute>();
30-
}
31-
32-
public override bool IncrementToken()
33-
{
34-
ClearAttributes();
35-
if (position < tokens.Length)
36-
{
37-
attribute.Payload = new BytesRef(tokens[position++]);
38-
}
39-
40-
return false;
41-
}
42-
43-
protected override void Dispose(bool disposing)
44-
{
45-
}
46-
}
47-
}
1+
using System.IO;
2+
using Lucene.Net.Analysis;
3+
using Lucene.Net.Analysis.Standard;
4+
using Lucene.Net.Analysis.TokenAttributes;
5+
using Lucene.Net.Util;
6+
7+
namespace NHibernate.Search.Tests.Analyzer
8+
{
9+
public abstract class AbstractTestAnalyzer : Lucene.Net.Analysis.Analyzer
10+
{
11+
protected abstract string[] Tokens { get; }
12+
13+
protected override TokenStreamComponents CreateComponents(string fieldName, TextReader reader)
14+
{
15+
return new TokenStreamComponents(
16+
new StandardTokenizer(LuceneVersion.LUCENE_48, reader),
17+
new InternalTokenStream(Tokens));
18+
}
19+
20+
private sealed class InternalTokenStream : TokenStream
21+
{
22+
private readonly string[] tokens;
23+
private int position;
24+
private readonly IPayloadAttribute attribute;
25+
26+
public InternalTokenStream(string[] tokens)
27+
{
28+
this.tokens = tokens;
29+
attribute = AddAttribute<IPayloadAttribute>();
30+
}
31+
32+
public override bool IncrementToken()
33+
{
34+
ClearAttributes();
35+
if (position < tokens.Length)
36+
{
37+
attribute.Payload = new BytesRef(tokens[position++]);
38+
}
39+
40+
return false;
41+
}
42+
43+
protected override void Dispose(bool disposing)
44+
{
45+
}
46+
}
47+
}
4848
}
Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
1-
using System.Collections;
2-
using System.Collections.Generic;
3-
using Lucene.Net.Analysis.Standard;
4-
using Lucene.Net.QueryParsers.Classic;
5-
using Lucene.Net.Util;
6-
using NUnit.Framework;
7-
8-
namespace NHibernate.Search.Tests.Analyzer
9-
{
10-
[TestFixture]
11-
public class AnalyzerTest : SearchTestCase
12-
{
13-
protected override IEnumerable<string> Mappings
14-
{
15-
get { return new string[] { "Analyzer.MyEntity.hbm.xml" }; }
16-
}
17-
18-
[Test, Explicit("Broken after 3.0.3 upgrade")]
19-
public void TestScopedAnalyzers()
20-
{
21-
MyEntity en = new MyEntity();
22-
en.Entity = "Entity";
23-
en.Field = "Field";
24-
en.Property = "Property";
25-
en.Component = new MyComponent();
26-
en.Component.ComponentProperty = "component property";
27-
28-
IFullTextSession s = Search.CreateFullTextSession(OpenSession());
29-
ITransaction tx = s.BeginTransaction();
30-
s.Save(en);
31-
s.Flush();
32-
tx.Commit();
33-
34-
tx = s.BeginTransaction();
35-
36-
QueryParser parser = new QueryParser(LuceneVersion.LUCENE_48, "id", new StandardAnalyzer(LuceneVersion.LUCENE_48));
37-
Lucene.Net.Search.Query luceneQuery = parser.Parse("entity:alarm");
38-
IFullTextQuery query = s.CreateFullTextQuery(luceneQuery, typeof(MyEntity));
39-
Assert.AreEqual(1, query.ResultSize, "Entity query");
40-
41-
luceneQuery = parser.Parse("property:cat");
42-
query = s.CreateFullTextQuery(luceneQuery, typeof(MyEntity));
43-
Assert.AreEqual(1, query.ResultSize, "Property query");
44-
45-
luceneQuery = parser.Parse("field:energy");
46-
query = s.CreateFullTextQuery(luceneQuery, typeof(MyEntity));
47-
Assert.AreEqual(1, query.ResultSize, "Field query");
48-
49-
luceneQuery = parser.Parse("component.componentProperty:noise");
50-
query = s.CreateFullTextQuery(luceneQuery);
51-
Assert.AreEqual(1, query.ResultSize, "Component query");
52-
53-
s.Delete(query.UniqueResult());
54-
tx.Commit();
55-
56-
s.Close();
57-
}
58-
}
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using Lucene.Net.Analysis.Standard;
4+
using Lucene.Net.QueryParsers.Classic;
5+
using Lucene.Net.Util;
6+
using NUnit.Framework;
7+
8+
namespace NHibernate.Search.Tests.Analyzer
9+
{
10+
[TestFixture]
11+
public class AnalyzerTest : SearchTestCase
12+
{
13+
protected override IEnumerable<string> Mappings
14+
{
15+
get { return new string[] { "Analyzer.MyEntity.hbm.xml" }; }
16+
}
17+
18+
[Test, Explicit("Broken after 3.0.3 upgrade")]
19+
public void TestScopedAnalyzers()
20+
{
21+
MyEntity en = new MyEntity();
22+
en.Entity = "Entity";
23+
en.Field = "Field";
24+
en.Property = "Property";
25+
en.Component = new MyComponent();
26+
en.Component.ComponentProperty = "component property";
27+
28+
IFullTextSession s = Search.CreateFullTextSession(OpenSession());
29+
ITransaction tx = s.BeginTransaction();
30+
s.Save(en);
31+
s.Flush();
32+
tx.Commit();
33+
34+
tx = s.BeginTransaction();
35+
36+
QueryParser parser = new QueryParser(LuceneVersion.LUCENE_48, "id", new StandardAnalyzer(LuceneVersion.LUCENE_48));
37+
Lucene.Net.Search.Query luceneQuery = parser.Parse("entity:alarm");
38+
IFullTextQuery query = s.CreateFullTextQuery(luceneQuery, typeof(MyEntity));
39+
Assert.AreEqual(1, query.ResultSize, "Entity query");
40+
41+
luceneQuery = parser.Parse("property:cat");
42+
query = s.CreateFullTextQuery(luceneQuery, typeof(MyEntity));
43+
Assert.AreEqual(1, query.ResultSize, "Property query");
44+
45+
luceneQuery = parser.Parse("field:energy");
46+
query = s.CreateFullTextQuery(luceneQuery, typeof(MyEntity));
47+
Assert.AreEqual(1, query.ResultSize, "Field query");
48+
49+
luceneQuery = parser.Parse("component.componentProperty:noise");
50+
query = s.CreateFullTextQuery(luceneQuery);
51+
Assert.AreEqual(1, query.ResultSize, "Component query");
52+
53+
s.Delete(query.UniqueResult());
54+
tx.Commit();
55+
56+
s.Close();
57+
}
58+
}
5959
}
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
using NHibernate.Search.Attributes;
2-
3-
namespace NHibernate.Search.Tests.Analyzer
4-
{
5-
public class MyComponent
6-
{
7-
[Field(Index.Tokenized)]
8-
[Analyzer(typeof(Test4Analyzer))]
9-
private string componentProperty;
10-
11-
public string ComponentProperty
12-
{
13-
get { return componentProperty; }
14-
set { componentProperty = value; }
15-
}
16-
}
1+
using NHibernate.Search.Attributes;
2+
3+
namespace NHibernate.Search.Tests.Analyzer
4+
{
5+
public class MyComponent
6+
{
7+
[Field(Index.Tokenized)]
8+
[Analyzer(typeof(Test4Analyzer))]
9+
private string componentProperty;
10+
11+
public string ComponentProperty
12+
{
13+
get { return componentProperty; }
14+
set { componentProperty = value; }
15+
}
16+
}
1717
}

0 commit comments

Comments
 (0)