Author: ssmiweve
Date: 2009-09-30 14:34:54 +0200 (Wed, 30 Sep 2009)
New Revision: 7298
Modified:
branches/2.18/query-api/src/main/java/no/sesat/search/query/parser/AbstractClause.java
branches/2.18/query-api/src/main/java/no/sesat/search/query/token/DeadTokenEvaluationEngineImpl.java
branches/2.18/query-api/src/main/java/no/sesat/search/query/token/EvaluationRuntimeException.java
Log:
use a subclass DeadEvaluationRuntimeException to notify any intentional
EvaluationRuntimeException.
this allows us to avoid logging ERROR every dead evaluation attempt.
Modified:
branches/2.18/query-api/src/main/java/no/sesat/search/query/parser/AbstractClause.java
===================================================================
---
branches/2.18/query-api/src/main/java/no/sesat/search/query/parser/AbstractClause.java
2009-09-30 10:13:42 UTC (rev 7297)
+++
branches/2.18/query-api/src/main/java/no/sesat/search/query/parser/AbstractClause.java
2009-09-30 12:34:54 UTC (rev 7298)
@@ -1,4 +1,4 @@
-/* Copyright (2005-2008) Schibsted ASA
+/* Copyright (2005-2009) Schibsted ASA
* This file is part of SESAT.
*
* SESAT is free software: you can redistribute it and/or modify
@@ -27,6 +27,7 @@
import no.sesat.commons.ref.ReferenceMap;
import no.sesat.search.query.Clause;
import no.sesat.commons.visitor.Visitor;
+import
no.sesat.search.query.token.DeadTokenEvaluationEngineImpl.DeadEvaluationRuntimeException;
import no.sesat.search.query.token.TokenEvaluator;
import no.sesat.search.query.token.TokenEvaluationEngine;
import no.sesat.search.query.token.TokenPredicate;
@@ -180,6 +181,9 @@
success = false;
LOG.error(ERR_FAILED_TO_FIND_ALL_PREDICATES + currTerm);
}
+ }catch(DeadEvaluationRuntimeException dere){
+ success |= false;
+ // don't log this as it is intentional evaluation failure
}catch(EvaluationRuntimeException ee){
if(success){
success = false;
@@ -211,6 +215,7 @@
* Does not include any field values (eg "firstname:").
* @return the term for this clause.
*/
+ @Override
public String getTerm() {
return term;
}
@@ -220,6 +225,7 @@
* The set is unmodifiable.
* @return set of knownPredicates.
*/
+ @Override
public Set<TokenPredicate> getKnownPredicates() {
return knownPredicates;
}
@@ -229,11 +235,13 @@
* The set is unmodifiable.
* @return set of possiblePredicates.
*/
+ @Override
public Set<TokenPredicate> getPossiblePredicates() {
return possiblePredicates;
}
+ @Override
public void accept(final Visitor visitor) {
visitor.visit(this);
}
Modified:
branches/2.18/query-api/src/main/java/no/sesat/search/query/token/DeadTokenEvaluationEngineImpl.java
===================================================================
---
branches/2.18/query-api/src/main/java/no/sesat/search/query/token/DeadTokenEvaluationEngineImpl.java
2009-09-30 10:13:42 UTC (rev 7297)
+++
branches/2.18/query-api/src/main/java/no/sesat/search/query/token/DeadTokenEvaluationEngineImpl.java
2009-09-30 12:34:54 UTC (rev 7298)
@@ -1,5 +1,5 @@
/*
- * Copyright (2008) Schibsted ASA
+ * Copyright (2008-2009) Schibsted ASA
* This file is part of SESAT.
*
* SESAT is free software: you can redistribute it and/or modify
@@ -27,6 +27,8 @@
*/
public final class DeadTokenEvaluationEngineImpl extends
TokenEvaluationEngineImpl {
+ private static final String DEAD_EXCEPTION_TITLE = "DEAD_EVALUATOR";
+
public DeadTokenEvaluationEngineImpl(final Context cxt) {
super(cxt);
}
@@ -38,8 +40,13 @@
@Override
public boolean evaluate(final TokenPredicate token) {
- throw new EvaluationRuntimeException(
- new EvaluationException("DEAD_EVALUATOR", null));
+ throw new DeadEvaluationRuntimeException();
}
+ public static final class DeadEvaluationRuntimeException extends
EvaluationRuntimeException{
+ DeadEvaluationRuntimeException(){
+ super(new EvaluationException(DEAD_EXCEPTION_TITLE, null));
+ }
+ }
+
}
Modified:
branches/2.18/query-api/src/main/java/no/sesat/search/query/token/EvaluationRuntimeException.java
===================================================================
---
branches/2.18/query-api/src/main/java/no/sesat/search/query/token/EvaluationRuntimeException.java
2009-09-30 10:13:42 UTC (rev 7297)
+++
branches/2.18/query-api/src/main/java/no/sesat/search/query/token/EvaluationRuntimeException.java
2009-09-30 12:34:54 UTC (rev 7298)
@@ -1,4 +1,4 @@
-/* Copyright (2008) Schibsted ASA
+/* Copyright (2008-2009) Schibsted ASA
* This file is part of SESAT.
*
* SESAT is free software: you can redistribute it and/or modify
@@ -21,7 +21,7 @@
* Note that a similar named EvaluationException exists within this package.
* @version $Id$
*/
-public final class EvaluationRuntimeException extends RuntimeException {
+public class EvaluationRuntimeException extends RuntimeException {
public EvaluationRuntimeException(final EvaluationException vflqe) {
super(vflqe);
}
_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits