标签:
[TestMethod] public void Analyze() { string[] d = mIndex.Analyze("c# socket", "ik"); } [TestMethod] public void match() { IList<Blog> items = mIndex.Query<Blog>(q => q.Match(new SearchMatch { field = "title", query = "c# socket" })); } [TestMethod] public void querytring() { IList<Blog> items = mIndex.Query<Blog>(q => q.QueryString(new QueryString { fields = new string[] { "title", "description" }, query = "c# socket" })); } [TestMethod] public void match_all() { IList<Blog> items = mIndex.Query<Blog>(q => q.Match_all()); } [IndexType("blog")] public class Blog { [ID] [Column(Type = ColumnType._string, Store = true, Index = IndexType._not_analyzed)] public string id { get; set; } [Column(Type = ColumnType._string, indexAnalyzer = "ik", searchAnalyzer = "ik")] public string title { get; set; } [Column(Type = ColumnType._string, Index = IndexType._no)] public string url { get; set; } [Column(Type = ColumnType._string)] public string author { get; set; } [Column(Type = ColumnType._string, indexAnalyzer = "ik", searchAnalyzer = "ik")] public string description { get; set; } [Column(Type = ColumnType._string, Index = IndexType._no)] public string content { get; set; } [Column(Type = ColumnType._date, Index = IndexType._not_analyzed)] public DateTime createTime { get; set; } }
标签:
原文地址:http://my.oschina.net/ikende/blog/395843