private void BindTermDocs(Term term) { if (CurrentIndex.IsIndexBeOpend()) { IOpen open = CurrentIndex.GetCurrentOpendIndex(); TermDocumentsRelation tdr = new TermDocumentsRelation(open); docs = tdr.DocumentCount(term); label6.Text = string.Format("文档数:{0}", docs.Count); } }
private void ShowDocument(int docId) { listView1.Clear(); listView1.Columns.Add("Field", 120); listView1.Columns.Add("Norm", 120); listView1.Columns.Add("Text", 400); IOpen open = CurrentIndex.GetCurrentOpendIndex(); if (docId >= open.Reader.NumDocs()) { MessageHelper.ShowErrorMessage("当前Id超出文档最大Id。"); return; } Document doc = open.Reader.Document(docId); IList list = doc.GetFields(); for (int i = 0; i < list.Count; i++) { Field f = list[i] as Field; listView1.Items.Add(new ListViewItem(new string[] { f.Name(), TermDocumentsRelation.GetNorm(CurrentIndex.GetCurrentOpendIndex().Reader, f.Name(), docId).ToString(), f.StringValue() })); } }