Revision: 16782
          http://sourceforge.net/p/gate/code/16782
Author:   valyt
Date:     2013-08-14 08:40:44 +0000 (Wed, 14 Aug 2013)
Log Message:
-----------
Added a const version of TermsQuery.

Modified Paths:
--------------
    mimir/trunk/mimir-core/src/gate/mimir/search/query/ConstQuery.java

Added Paths:
-----------
    mimir/trunk/mimir-core/src/gate/mimir/search/terms/ConstTermsQuery.java

Modified: mimir/trunk/mimir-core/src/gate/mimir/search/query/ConstQuery.java
===================================================================
--- mimir/trunk/mimir-core/src/gate/mimir/search/query/ConstQuery.java  
2013-08-10 14:05:33 UTC (rev 16781)
+++ mimir/trunk/mimir-core/src/gate/mimir/search/query/ConstQuery.java  
2013-08-14 08:40:44 UTC (rev 16782)
@@ -26,6 +26,8 @@
 /**
  * A query that returns a pre-defined (constant) list of document IDs. This 
  * query type does not support positions, so it returns no hits.
+ * One example usage for this type of query is as an operand to an AND 
operator 
+ * in order to restrict the results to a given set of documents.
  */
 public class ConstQuery implements QueryNode {
   

Added: mimir/trunk/mimir-core/src/gate/mimir/search/terms/ConstTermsQuery.java
===================================================================
--- mimir/trunk/mimir-core/src/gate/mimir/search/terms/ConstTermsQuery.java     
                        (rev 0)
+++ mimir/trunk/mimir-core/src/gate/mimir/search/terms/ConstTermsQuery.java     
2013-08-14 08:40:44 UTC (rev 16782)
@@ -0,0 +1,56 @@
+/*
+ *  TermQuery.java
+ *
+ *  Copyright (c) 2007-2011, The University of Sheffield.
+ *
+ *  This file is part of GATE Mímir (see http://gate.ac.uk/family/mimir.html), 
+ *  and is free software, licenced under the GNU Lesser General Public License,
+ *  Version 3, June 2007 (also included with this distribution as file
+ *  LICENCE-LGPL3.html).
+ *
+ *  Valentin Tablan, 13 Aug 2013
+ *
+ *  $Id$
+ */
+package gate.mimir.search.terms;
+
+import gate.mimir.search.QueryEngine;
+
+import java.io.IOException;
+
+/**
+ * A terms query that returns a pre-defined (constant) terms result set.
+ * 
+ * One example usage for this is inserting externally computed terms result 
+ * sets as operands into {@link CompoundTermsQuery}s. 
+ */
+public class ConstTermsQuery implements TermsQuery {
+  
+  private static final long serialVersionUID = -1993516325057279128L;
+  
+  /**
+   * The {@link TermsResultSet} to be returned upon "execution". 
+   */
+  protected TermsResultSet trs;
+  
+  
+  
+  /**
+   * Constructs a new instance of {@link ConstTermsQuery}.
+   * @param trs the terms result set to be returned by the constant terms 
query.
+   */
+  public ConstTermsQuery(TermsResultSet trs) {
+    this.trs = trs;
+  }
+
+
+
+  @Override
+  /**
+   * Returns the terms result set provided at construction time. This method
+   * performs no calculation.
+   */
+  public TermsResultSet execute(QueryEngine engine) throws IOException {
+    return trs;
+  }
+}


Property changes on: 
mimir/trunk/mimir-core/src/gate/mimir/search/terms/ConstTermsQuery.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to