ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1701300 - /ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/index/SearchUtility.java
Date Fri, 04 Sep 2015 17:44:06 GMT
Author: dligach
Date: Fri Sep  4 17:44:05 2015
New Revision: 1701300

URL: http://svn.apache.org/r1701300
Log:
added constants to configure output

Modified:
    ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/index/SearchUtility.java

Modified: ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/index/SearchUtility.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/index/SearchUtility.java?rev=1701300&r1=1701299&r2=1701300&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/index/SearchUtility.java (original)
+++ ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/index/SearchUtility.java Fri
Sep  4 17:44:05 2015
@@ -17,6 +17,9 @@ import org.apache.lucene.store.FSDirecto
 
 public class SearchUtility {
   
+  public static final boolean printEntireDocument = false;
+  public static final int contextWindowInCharacters = 30;
+  
   public static void main(String[] args) throws IOException {
 
     final int maxHits = 1000;
@@ -41,8 +44,12 @@ public class SearchUtility {
     for(ScoreDoc scoreDoc : scoreDocs) {
       Document document = indexSearcher.doc(scoreDoc.doc);
       String text = document.get(fieldName);
-      String context = getContext(queryText, text, 30);
-      System.out.println(context);
+      if(printEntireDocument) {
+        System.out.println(text);
+      } else {
+        String context = getContext(queryText, text, contextWindowInCharacters);
+        if(!context.equals("")) System.out.println(context); 
+      }
     }
 
     directory.close();



Mime
View raw message