Пример #1
0
        public virtual Explanation CustomExplain(int doc, Explanation subQueryExpl, Explanation[] valSrcExpls)
        {
            if (valSrcExpls.Length == 1)
            {
                return(CustomExplain(doc, subQueryExpl, valSrcExpls[0]));
            }
            if (valSrcExpls.Length == 0)
            {
                return(subQueryExpl);
            }
            float valSrcScore = 1;

            for (int i = 0; i < valSrcExpls.Length; i++)
            {
                valSrcScore *= valSrcExpls[i].GetValue();
            }
            Explanation exp = new Explanation(valSrcScore * subQueryExpl.GetValue(), "custom score: product of:");

            exp.AddDetail(subQueryExpl);
            for (int i = 0; i < valSrcExpls.Length; i++)
            {
                exp.AddDetail(valSrcExpls[i]);
            }
            return(exp);
        }
Пример #2
0
        public virtual Explanation CustomExplain(int doc, Explanation subQueryExpl, Explanation valSrcExpl)
        {
            float valSrcScore = 1;

            if (valSrcExpl != null)
            {
                valSrcScore *= valSrcExpl.GetValue();
            }
            Explanation exp = new Explanation(valSrcScore * subQueryExpl.GetValue(), "custom score: product of:");

            exp.AddDetail(subQueryExpl);
            exp.AddDetail(valSrcExpl);
            return(exp);
        }
Пример #3
0
            public override Explanation Explain(int doc)
            {
                Explanation result         = new Explanation();
                Explanation nonPayloadExpl = base.Explain(doc);

                result.AddDetail(nonPayloadExpl);
                Explanation payloadBoost = new Explanation();

                result.AddDetail(payloadBoost);
                float avgPayloadScore = (payloadsSeen > 0?(payloadScore / payloadsSeen):1);

                payloadBoost.SetValue(avgPayloadScore);
                payloadBoost.SetDescription("scorePayload(...)");
                result.SetValue(nonPayloadExpl.GetValue() * avgPayloadScore);
                result.SetDescription("bnq, product of:");
                return(result);
            }
Пример #4
0
			public override Explanation Explain(int doc)
			{
				Explanation result = new Explanation();
				Explanation nonPayloadExpl = base.Explain(doc);
				result.AddDetail(nonPayloadExpl);
				Explanation payloadBoost = new Explanation();
				result.AddDetail(payloadBoost);
				float avgPayloadScore = (payloadsSeen > 0?(payloadScore / payloadsSeen):1);
				payloadBoost.SetValue(avgPayloadScore);
				payloadBoost.SetDescription("scorePayload(...)");
				result.SetValue(nonPayloadExpl.GetValue() * avgPayloadScore);
				result.SetDescription("bnq, product of:");
				return result;
			}
Пример #5
0
		public virtual Explanation CustomExplain(int doc, Explanation subQueryExpl, Explanation valSrcExpl)
		{
			float valSrcScore = 1;
			if (valSrcExpl != null)
			{
				valSrcScore *= valSrcExpl.GetValue();
			}
			Explanation exp = new Explanation(valSrcScore * subQueryExpl.GetValue(), "custom score: product of:");
			exp.AddDetail(subQueryExpl);
			exp.AddDetail(valSrcExpl);
			return exp;
		}
Пример #6
0
		public virtual Explanation CustomExplain(int doc, Explanation subQueryExpl, Explanation[] valSrcExpls)
		{
			if (valSrcExpls.Length == 1)
			{
				return CustomExplain(doc, subQueryExpl, valSrcExpls[0]);
			}
			if (valSrcExpls.Length == 0)
			{
				return subQueryExpl;
			}
			float valSrcScore = 1;
			for (int i = 0; i < valSrcExpls.Length; i++)
			{
				valSrcScore *= valSrcExpls[i].GetValue();
			}
			Explanation exp = new Explanation(valSrcScore * subQueryExpl.GetValue(), "custom score: product of:");
			exp.AddDetail(subQueryExpl);
			for (int i = 0; i < valSrcExpls.Length; i++)
			{
				exp.AddDetail(valSrcExpls[i]);
			}
			return exp;
		}