-
Notifications
You must be signed in to change notification settings - Fork 65
/
FluentConfiguration.cs
49 lines (35 loc) · 1.22 KB
/
FluentConfiguration.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using Lucene.Net.Linq.Fluent;
using Lucene.Net.Linq.Tests.Integration;
using Version = Lucene.Net.Util.Version;
namespace Sample
{
public class FluentConfiguration
{
public void CreateMapping()
{
var map = new ClassMap<Package>(Version.LUCENE_30);
map.Key(p => p.Id);
map.Key(p => p.Version).ConvertWith(new VersionConverter());
map.Property(p => p.Description)
.AnalyzeWith(new PorterStemAnalyzer(Version.LUCENE_30))
.WithTermVector.PositionsAndOffsets();
map.Property(p => p.DownloadCount)
.AsNumericField()
.WithPrecisionStep(8);
map.Property(p => p.IconUrl).NotIndexed();
map.Score(p => p.Score);
map.DocumentBoost(p => p.Boost);
}
public class Package
{
public string Id { get; set; }
public Version Version { get; set; }
public Uri IconUrl { get; set; }
public string Description { get; set; }
public int DownloadCount { get; set; }
public float Score { get; set; }
public float Boost { get; set; }
}
}
}