Author: sshafroi
Date: 2008-06-12 11:44:04 +0200 (Thu, 12 Jun 2008)
New Revision: 6686

Modified:
   
branches/2.17/query-api/src/main/java/no/sesat/search/query/token/JepTokenEvaluator.java
Log:
SEARCH-4859 - S?\195?\184k p?\195?\165 telefonnummer gir kalkulator, ikke 
berikelse

I will do a regexp search now to see if the query matches "[0-9.]+". If it does 
then set the result to null instead of parsing and evaluating it.



Modified: 
branches/2.17/query-api/src/main/java/no/sesat/search/query/token/JepTokenEvaluator.java
===================================================================
--- 
branches/2.17/query-api/src/main/java/no/sesat/search/query/token/JepTokenEvaluator.java
    2008-06-10 12:02:03 UTC (rev 6685)
+++ 
branches/2.17/query-api/src/main/java/no/sesat/search/query/token/JepTokenEvaluator.java
    2008-06-12 09:44:04 UTC (rev 6686)
@@ -1,4 +1,4 @@
-/* Copyright (2005-2007) Schibsted Søk AS
+/* Copyright (2005-2008) Schibsted Søk AS
  * This file is part of SESAT.
  *
  *   SESAT is free software: you can redistribute it and/or modify
@@ -46,23 +46,27 @@
     // Constructors --------------------------------------------------
 
     /**
-     * Creates a new instance of JepTokenEvaluator
+     * Creates a new instance of JepTokenEvaluator and evaluate the query.
      */
     public JepTokenEvaluator(final String query) {
+        if (query.matches("[0-9.]+")) {
+            result = null; // If the query is just a number don't evaluate it.
+        }
+        else {
+            final JEP parser = new JEP();
 
-        final JEP parser = new JEP();
+            parser.addStandardConstants();
+            parser.addStandardFunctions();
+            parser.addComplex();
+    //        parser.setImplicitMul(true);
 
-        parser.addStandardConstants();
-        parser.addStandardFunctions();
-        parser.addComplex();
-//        parser.setImplicitMul(true);
+            parser.parseExpression(query);
 
+            result = parser.getComplexValue();
+        }
+    }
 
-        parser.parseExpression(query);
 
-        result = parser.getComplexValue();
-    }
-
     // Public --------------------------------------------------------
 
     public Complex getComplex() {

_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits

Reply via email to