Permalink
Browse files

Add Optimizer. It does almost nothing!

  • Loading branch information...
1 parent 1a4feb7 commit 9f6355b6241f87b71b2ccc7a6c7da031aab67c07 Holden Karau committed May 15, 2012
Showing with 26 additions and 0 deletions.
  1. +26 −0 src/main/scala/com/foursquare/slashem/Optimize.scala
@@ -0,0 +1,26 @@
+/*
+ * Applies some simple optimizations
+ */
+package com.foursquare.slashem
+
+import com.foursquare.slashem.Ast._
+
+object Optimizer {
+
+ def optimizeFilters(filters: List[AbstractClause]): List[AbstractClause] = {
+ filters.filter(f => {
+ f match {
+ //Remove all empty search clauses
+ case x: Query[Empty[_]] => false
+ case _ => true
+ }
+ })
+ }
+ def optimizeQuery(clause: AbstractClause): AbstractClause = {
+ clause
+ }
+ def optimizeBoosts(boostQueries: List[AbstractClause]): List[AbstractClause] = {
+ boostQueries
+ }
+
+}

0 comments on commit 9f6355b

Please sign in to comment.