-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathDocumentKeys.cs
46 lines (42 loc) · 1.17 KB
/
DocumentKeys.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
using Lucene.Net.Linq.Mapping;
namespace Sample1
{
/// <remarks>
/// Note how Article and Comment use a different property for their
/// key. If they both used Id, Lucene.Net.Linq would have no way
/// to distinguish them as different types of documents.
/// </remarks>
public class Article
{
[Field(Key = true)]
public long ArticleId { get; set; }
}
public class Comment
{
[Field(Key = true)]
public long CommentId { get; set; }
}
}
namespace Sample2
{
/// <remarks>
/// In this example a DocumentKey is added to each class
/// to add a fixed-value field to each document that will
/// be used to distinguish entities of different types.
///
/// In this example both Article and Commend use Id as
/// the unique identifier for each entity.
/// </remarks>
[DocumentKey(FieldName = "Type", Value = "Article")]
public class Article
{
[Field(Key = true)]
public long Id { get; set; }
}
[DocumentKey(FieldName = "Type", Value = "Comment")]
public class Comment
{
[Field(Key = true)]
public long Id { get; set; }
}
}