19 using System.Collections.Generic;
22 using Lucene.Net.Documents;
23 using Lucene.Net.Search;
24 using Lucene.Net.Index;
26 using Toffs = Lucene.Net.Search.Vectorhighlight.FieldPhraseList.WeightedPhraseInfo.Toffs;
30 namespace Lucene.Net.Search.Vectorhighlight
38 private int fragCharSize;
39 public List<WeightedFragInfo> fragInfos =
new List<WeightedFragInfo>();
48 this.fragCharSize = fragCharSize;
57 public void Add(
int startOffset,
int endOffset, List<WeightedPhraseInfo> phraseInfoList)
65 internal List<SubInfo> subInfos;
66 internal float totalBoost;
67 internal int startOffset;
68 internal int endOffset;
70 public WeightedFragInfo(
int startOffset,
int endOffset, List<WeightedPhraseInfo> phraseInfoList)
72 this.startOffset = startOffset;
73 this.endOffset = endOffset;
74 subInfos =
new List<SubInfo>();
77 SubInfo subInfo =
new SubInfo(phraseInfo.text, phraseInfo.termsOffsets, phraseInfo.seqnum);
78 subInfos.Add(subInfo);
79 totalBoost += phraseInfo.boost;
83 public override string ToString()
85 StringBuilder sb =
new StringBuilder();
86 sb.Append(
"subInfos=(");
87 foreach (
SubInfo si
in subInfos)
88 sb.Append(si.ToString());
89 sb.Append(
")/").Append(totalBoost.ToString(
".0").Replace(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator,
".")).Append(
'(').Append(startOffset).Append(
',').Append(endOffset).Append(
')');
96 internal List<Toffs> termsOffsets;
99 internal SubInfo(String text, List<Toffs> termsOffsets,
int seqnum)
102 this.termsOffsets = termsOffsets;
103 this.seqnum = seqnum;
106 public override string ToString()
108 StringBuilder sb =
new StringBuilder();
109 sb.Append(text).Append(
'(');
110 foreach (
Toffs to
in termsOffsets)
111 sb.Append(to.ToString());
113 return sb.ToString();