Revision: 14674
          http://gate.svn.sourceforge.net/gate/?rev=14674&view=rev
Author:   valyt
Date:     2011-12-05 17:55:36 +0000 (Mon, 05 Dec 2011)
Log Message:
-----------
- document-centric results presentation.
- basic snippetting.

Modified Paths:
--------------
    mimir/trunk/mimir-web/grails-app/views/search/index.gsp
    mimir/trunk/mimir-web/src/gwt/gate/mimir/web/client/UI.java
    mimir/trunk/mimir-web/src/java/gate/mimir/web/client/GwtRpcException.java
    mimir/trunk/mimir-web/src/java/gate/mimir/web/client/GwtRpcService.java
    mimir/trunk/mimir-web/src/java/gate/mimir/web/client/GwtRpcServiceAsync.java
    mimir/trunk/mimir-web/web-app/css/mimir.css

Added Paths:
-----------
    mimir/trunk/mimir-web/grails-app/services/gate/mimir/web/server/
    
mimir/trunk/mimir-web/grails-app/services/gate/mimir/web/server/GwtRpcService.groovy
    mimir/trunk/mimir-web/src/java/gate/mimir/web/client/DocumentData.java
    mimir/trunk/mimir-web/src/java/gate/mimir/web/client/ResultsData.java

Removed Paths:
-------------
    
mimir/trunk/mimir-web/grails-app/services/gate/mimir/web/GwtRpcService.groovy

Deleted: 
mimir/trunk/mimir-web/grails-app/services/gate/mimir/web/GwtRpcService.groovy
===================================================================
--- 
mimir/trunk/mimir-web/grails-app/services/gate/mimir/web/GwtRpcService.groovy   
    2011-12-05 13:17:45 UTC (rev 14673)
+++ 
mimir/trunk/mimir-web/grails-app/services/gate/mimir/web/GwtRpcService.groovy   
    2011-12-05 17:55:36 UTC (rev 14674)
@@ -1,99 +0,0 @@
-package gate.mimir.web
-
-import gate.mimir.gus.client.SearchException;
-import grails.converters.JSON;
-
-import java.util.Set;
-
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.InitializingBean;
-
-import gate.mimir.web.client.GwtRpcException
-
-class GwtRpcService implements InitializingBean, DisposableBean {
-
-  static transactional = false
-
-  /**
-   * The SearchService that does the actual work (autowired by Grails)
-   */
-  def searchService
-
-  // scope the service to the web session, so one instance per user
-  static scope = "session"
-
-  // expose for GWT RPC
-  static expose = ["gwt:gate.mimir.web.client"]
-
-  /**
-   * Set of in-progress queries for this session. The values are qeury IDs
-   * obtained from the search service
-   */
-  def Set<String> runningQueries = new HashSet<String>()
-
-  public void afterPropertiesSet() {
-  }
-
-  /**
-   * Close the executors and free any running queries
-   */
-  public void destroy() {
-    runningQueries.each(this.&releaseQuery)
-  }
-
-  /**
-   * Post a query
-   */
-  String search(String indexId, String query) {
-    Index.withTransaction {
-      try {
-        def index = Index.findByIndexId(indexId)
-        if(!index) {
-          throw new GwtRpcException("Invalid index ID ${indexId}")
-        }
-        else if(index.state != Index.SEARCHING) {
-          throw new GwtRpcException("Index ${indexId} is not open for 
searching")
-        }
-        else {
-          String queryId = searchService.postQuery(index, query)
-          runningQueries.add(queryId)
-          return [id:queryId] as JSON
-        }
-      } catch(GwtRpcException e) {
-        log.warn("Exception starting search", e)
-        throw e
-      } catch(Exception e) {
-        log.warn("Exception starting search", e)
-        throw new GwtRpcException("Could not start search. Error 
was:\n${e.message}");
-      }
-    }
-  }
-
-  /**
-   * Release the resources associated with a given query.  Does nothing
-   * if the given ID does not correspond to a running query.
-   */
-  void releaseQuery(String id) {
-    //check if it's one of our queries
-    if(runningQueries.remove(id)){
-      searchService.closeQueryRunner(id)
-    }
-  }
-
-  /**
-  * Obtains the types of annotation known to the index, and their features.
-   * This method supports auto-completion in the GWT UI.
-  */
-  String[][] getAnnotationsConfig(String indexId){
-    Index.withTransaction {
-      Index index = Index.findByIndexId(indexId)
-      if(index) {
-        return index.annotationsConfig()
-      }
-      else {
-        return ([] as String[][])
-      }
-    }
-  }
-
-}

Copied: 
mimir/trunk/mimir-web/grails-app/services/gate/mimir/web/server/GwtRpcService.groovy
 (from rev 14643, 
mimir/trunk/mimir-web/grails-app/services/gate/mimir/web/GwtRpcService.groovy)
===================================================================
--- 
mimir/trunk/mimir-web/grails-app/services/gate/mimir/web/server/GwtRpcService.groovy
                                (rev 0)
+++ 
mimir/trunk/mimir-web/grails-app/services/gate/mimir/web/server/GwtRpcService.groovy
        2011-12-05 17:55:36 UTC (rev 14674)
@@ -0,0 +1,184 @@
+/**
+*  GwtRpcService.java
+*
+*  Copyright (c) 1995-2010, The University of Sheffield. See the file
+*  COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
+*
+*  This file is part of GATE (see http://gate.ac.uk/), and is free
+*  software, licenced under the GNU Library General Public License,
+*  Version 2, June 1991 (in the distribution as file licence.html,
+*  and also available at http://gate.ac.uk/gate/licence.html).
+*
+*  Valentin Tablan, 01 Dec 2011
+*/
+package gate.mimir.web.server
+
+import gate.mimir.gus.client.SearchException;
+import grails.converters.JSON;
+
+import java.util.Set;
+
+import org.springframework.beans.factory.DisposableBean;
+import org.springframework.beans.factory.InitializingBean;
+
+
+import gate.mimir.search.QueryRunner;
+import gate.mimir.search.query.Binding;
+import gate.mimir.web.Index;
+import gate.mimir.web.client.DocumentData;
+import gate.mimir.web.client.GwtRpcException
+import gate.mimir.web.client.ResultsData;
+import gate.mimir.web.client.DocumentData;
+
+class GwtRpcService implements InitializingBean, DisposableBean, 
gate.mimir.web.client.GwtRpcService {
+
+  static transactional = false
+
+  /**
+   * The SearchService that does the actual work (autowired by Grails)
+   */
+  def searchService
+
+  // scope the service to the web session, so one instance per user
+  static scope = "session"
+
+  // expose for GWT RPC
+  static expose = ["gwt:gate.mimir.web.client"]
+
+  /**
+   * Set of in-progress queries for this session. The values are query IDs
+   * obtained from the search service
+   */
+  def Set<String> runningQueries = new HashSet<String>()
+
+  public void afterPropertiesSet() {
+  }
+
+  /**
+   * Close the executors and free any running queries
+   */
+  public void destroy() {
+    runningQueries.each(this.&releaseQuery)
+  }
+
+  /**
+   * Post a query
+   */
+  String search(String indexId, String query) {
+    Index.withTransaction {
+      try {
+        def index = Index.findByIndexId(indexId)
+        if(!index) {
+          throw new GwtRpcException("Invalid index ID ${indexId}")
+        }
+        else if(index.state != Index.SEARCHING) {
+          throw new GwtRpcException("Index ${indexId} is not open for 
searching")
+        }
+        else {
+          String queryId = searchService.postQuery(index, query)
+          runningQueries.add(queryId)
+          return queryId
+        }
+      } catch(GwtRpcException e) {
+        log.warn("Exception starting search", e)
+        throw e
+      } catch(Exception e) {
+        log.warn("Exception starting search", e)
+        throw new GwtRpcException("Could not start search. Error 
was:\n${e.message}");
+      }
+    }
+  }
+
+  /**
+   * Release the resources associated with a given query.  Does nothing
+   * if the given ID does not correspond to a running query.
+   */
+  void releaseQuery(String id) {
+    //check if it's one of our queries
+    if(runningQueries.remove(id)){
+      searchService.closeQueryRunner(id)
+    }
+  }
+
+  /**
+  * Obtains the types of annotation known to the index, and their features.
+   * This method supports auto-completion in the GWT UI.
+  */
+  String[][] getAnnotationsConfig(String indexId){
+    Index.withTransaction {
+      Index index = Index.findByIndexId(indexId)
+      if(index) {
+        return index.annotationsConfig()
+      }
+      else {
+        return ([] as String[][])
+      }
+    }
+  }
+
+  @Override
+  public ResultsData getResultsData(String queryId, 
+        int firstDocumentRank, int documentsCount) throws GwtRpcException {
+    QueryRunner qRunner = searchService.getQueryRunner(queryId);
+    if(qRunner) {
+      ResultsData rData = new ResultsData(
+        resultsTotal:qRunner.getDocumentsCount(),
+        resultsPartial: qRunner.getCurrentDocumentsCount())
+      if(firstDocumentRank >= 0) {
+        // also obtain some documents data
+        List<DocumentData> documents = []
+        for(int docRank = firstDocumentRank; 
+            docRank < firstDocumentRank + documentsCount; 
+            docRank++) {
+          DocumentData docData = new DocumentData(
+            documentRank:docRank,
+            documentTitle:qRunner.getDocumentTitle(docRank),
+            documentUri:qRunner.getDocumentURI(docRank))
+          // create the snippets
+          List<String[]> snippets = new ArrayList<String[]>();
+          List<Binding> hits = qRunner.getDocumentHits(docRank).collect{it};
+          StringBuilder str = new StringBuilder()
+          3.times {
+            if(hits) {
+              String[] snippet = new String[3];
+              Binding aHit = hits.remove(0)
+              int termPos = Math.max(0, aHit.termPosition - 3)
+              if(termPos < aHit.termPosition) {
+                String[][] left =  qRunner.getDocumentText(docRank, termPos,
+                  aHit.termPosition - termPos)
+                left[0].each { str << (it + ' ') }
+                snippet[0] = str.toString()
+              } else {
+                snippet[0] = "";
+              }
+              str = new StringBuilder()
+              qRunner.getDocumentText(docRank, aHit.termPosition, 
+                aHit.length)[0].each{ str << (it + ' ')}
+              snippet[1] = str.toString()
+              str = new StringBuilder()
+              qRunner.getDocumentText(docRank, 
+                aHit.termPosition + aHit.length, 3)[0].each{str << (it?:'' + ' 
')}
+              snippet[2] = str.toString()
+              snippets << snippet  
+            }
+          }
+          if(hits) {
+            // more than 3 hits: show ellipsis
+            snippets.add(["   ", "...", "   "] as String[])
+          }
+          docData.snippets = snippets
+          documents.add(docData)
+        }
+        rData.setDocuments(documents)
+      }
+      return rData
+    } else {
+      throw new GwtRpcException("Could not find your query. " + 
+          "Your search session may have expired, in which case you will need " 
+
+          "to start your search again.")
+    }
+  }
+
+  
+  
+}

Modified: mimir/trunk/mimir-web/grails-app/views/search/index.gsp
===================================================================
--- mimir/trunk/mimir-web/grails-app/views/search/index.gsp     2011-12-05 
13:17:45 UTC (rev 14673)
+++ mimir/trunk/mimir-web/grails-app/views/search/index.gsp     2011-12-05 
17:55:36 UTC (rev 14674)
@@ -33,7 +33,7 @@
   
   <h1>Searching Index ${index?.name}</h1>
   <div class="searchbox" id="searchBox"> </div>
-  <div class="bluebar" >Results</div>
+  <div class="bluebar" id="resultsBar"></div>
   <div id="searchResults">
   </div>
 </body>

Modified: mimir/trunk/mimir-web/src/gwt/gate/mimir/web/client/UI.java
===================================================================
--- mimir/trunk/mimir-web/src/gwt/gate/mimir/web/client/UI.java 2011-12-05 
13:17:45 UTC (rev 14673)
+++ mimir/trunk/mimir-web/src/gwt/gate/mimir/web/client/UI.java 2011-12-05 
17:55:36 UTC (rev 14674)
@@ -14,6 +14,9 @@
 
 package gate.mimir.web.client;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import gate.mimir.gus.client.GusService;
 import gate.mimir.gus.client.GusServiceAsync;
 
@@ -23,11 +26,14 @@
 import com.google.gwt.dom.client.Element;
 import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.Timer;
 import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 import com.google.gwt.user.client.rpc.ServiceDefTarget;
 import com.google.gwt.user.client.ui.Button;
 import com.google.gwt.user.client.ui.HTMLPanel;
+import com.google.gwt.user.client.ui.InlineLabel;
+import com.google.gwt.user.client.ui.Label;
 import com.google.gwt.user.client.ui.Panel;
 import com.google.gwt.user.client.ui.TextArea;
 
@@ -35,8 +41,43 @@
  * Entry point classes define <code>onModuleLoad()</code>.
  */
 public class UI implements EntryPoint {
+ 
+  /**
+   * A Timer implementation that fetches the latest results information from 
the 
+   * server and updates the results display accordingly.
+   */
+  protected class StatsUpdater extends Timer {
+
+    @Override
+    public void run() {
+      // calculate which documents we need now
+      int firstDoc = firstDocumentOnPage + documentsData.size();
+      int docCount = maxDocumentsOnPage - documentsData.size(); 
+      if(docCount <= 0) {
+        firstDoc = -1;
+      }
+      gwtRpcService.getResultsData(queryId, firstDoc, docCount, 
+        new AsyncCallback<ResultsData>() {
+        @Override
+        public void onSuccess(ResultsData result) {
+          updatePage(result);
+          if(result.getResultsTotal() < 0) {
+            // more to come
+            schedule(500);
+          }
+        }
+        
+        @Override
+        public void onFailure(Throwable caught) {
+          // ignore and try again later
+          schedule(500);
+          // throw the exception so it's seen
+          throw new RuntimeException(caught);
+        }
+      });
+    }
+  }
   
-  
   private GwtRpcServiceAsync gwtRpcService;
   
   protected TextArea searchBox;
@@ -45,7 +86,22 @@
   
   protected String queryId;
   
+  protected Label resultStatsLabel;
+  
+  protected HTMLPanel searchResultsPanel;
+  
   /**
+   * The rank of the first document on page.
+   */
+  protected int firstDocumentOnPage;
+  
+  protected int maxDocumentsOnPage = 20;
+  
+  protected int maxSnippetLength = 100;
+  
+  private List<DocumentData> documentsData;
+  
+  /**
    * This is the entry point method.
    */
   public void onModuleLoad() {
@@ -72,6 +128,13 @@
     searchButton = new Button();
     searchButton.setText("Search");
     searchDiv.add(searchButton);
+    
+    HTMLPanel resultsBar = 
HTMLPanel.wrap(Document.get().getElementById("resultsBar"));
+    resultStatsLabel = new Label("Ready");
+    resultsBar.add(resultStatsLabel);
+
+    searchResultsPanel = 
HTMLPanel.wrap(Document.get().getElementById("searchResults"));
+    
   }
   
   protected void initListeners() {
@@ -94,11 +157,94 @@
       @Override
       public void onSuccess(String result) {
         queryId = result;
-        Window.alert("Search started");    
+        firstDocumentOnPage = 0;
+        documentsData = new ArrayList<DocumentData>(maxDocumentsOnPage);
+        searchResultsPanel.clear();
+        new StatsUpdater().schedule(50);
       }
     });
   }
   
+  protected void updatePage(ResultsData resultsData) {
+    int resTotal = resultsData.getResultsTotal();
+    int resPartial = resultsData.getResultsPartial();
+    StringBuilder textBuilder = new StringBuilder("Documents ");
+    textBuilder.append(firstDocumentOnPage);
+    textBuilder.append(" to ");
+    if(firstDocumentOnPage + maxDocumentsOnPage < resPartial) {
+      textBuilder.append(firstDocumentOnPage + maxDocumentsOnPage);
+    } else {
+      textBuilder.append(resPartial - firstDocumentOnPage);
+    }
+    textBuilder.append(" of ");
+    
+    if(resTotal > 0) {
+      // all results obtained
+      textBuilder.append(resultsData.getResultsTotal());
+    } else {
+      // more to come
+      textBuilder.append("at least ");
+      textBuilder.append(resPartial);
+    }
+    textBuilder.append(":");
+    resultStatsLabel.setText(textBuilder.toString());
+
+    if(resultsData.getDocuments() != null){
+      // now update the documents display
+      int docPosition = 0;      
+      for(DocumentData docData : resultsData.getDocuments()) {
+        // skip already populated positions
+        while(docPosition < documentsData.size() && 
+            documentsData.get(docPosition).documentRank < 
docData.documentRank){
+          docPosition ++;
+        }
+        if(docPosition == documentsData.size()) {
+          documentsData.add(docData);
+          HTMLPanel documentDisplay = buildDocumentDisplay(docData);
+          if(docPosition % 2 == 0) documentDisplay.addStyleName("even");
+          searchResultsPanel.add(documentDisplay);
+        } else {
+          if(documentsData.get(docPosition).documentRank == 
docData.documentRank) {
+            // we got the same document: skip it
+          } else {
+            // malfunction?
+            // TODO
+          }
+        }
+      }      
+    }
+  }
+  
+  private HTMLPanel buildDocumentDisplay(DocumentData docData) {
+    HTMLPanel documentDisplay = new HTMLPanel("");
+    documentDisplay.setStyleName("hit");
+    HTMLPanel docTitle = new HTMLPanel(docData.documentTitle);
+    docTitle.setStyleName("document-title");
+    documentDisplay.add(docTitle);
+    if(docData.snippets != null) {
+      // each row is left context, snippet, right context
+      for(String[] snippet : docData.snippets) {
+        HTMLPanel snippetPanel = new HTMLPanel("");
+        snippetPanel.setStyleName("snippet");
+        snippetPanel.add(new InlineLabel(snippet[0]));
+        String snipText = snippet[1];
+        int snipLen = snipText.length();
+        if(snipLen > maxSnippetLength) {
+          int toRemove = snipLen - maxSnippetLength;
+          snipText = snipText.substring(0, (snipLen - toRemove) / 2) + 
+              " ... " + 
+              snipText.substring((snipLen + toRemove) / 2);
+        }
+        InlineLabel snippetLabel = new InlineLabel(snipText);
+        snippetLabel.setStyleName("snippet-text");
+        snippetPanel.add(snippetLabel);
+        snippetPanel.add(new InlineLabel(snippet[2]));
+        documentDisplay.add(snippetPanel);
+      }
+    }
+    return documentDisplay;
+  }
+  
   private native String getIndexId() /*-{
     return $wnd.indexId;
   }-*/;

Added: mimir/trunk/mimir-web/src/java/gate/mimir/web/client/DocumentData.java
===================================================================
--- mimir/trunk/mimir-web/src/java/gate/mimir/web/client/DocumentData.java      
                        (rev 0)
+++ mimir/trunk/mimir-web/src/java/gate/mimir/web/client/DocumentData.java      
2011-12-05 17:55:36 UTC (rev 14674)
@@ -0,0 +1,32 @@
+/**
+ *  DocumentData.java
+ * 
+ *  Copyright (c) 1995-2010, The University of Sheffield. See the file
+ *  COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
+ *
+ *  This file is part of GATE (see http://gate.ac.uk/), and is free
+ *  software, licenced under the GNU Library General Public License,
+ *  Version 2, June 1991 (in the distribution as file licence.html,
+ *  and also available at http://gate.ac.uk/gate/licence.html).
+ *
+ *  Valentin Tablan, 05 Dec 2011 
+ */
+package gate.mimir.web.client;
+
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+/**
+ * Data about a result document
+ */
+public class DocumentData implements IsSerializable {
+  
+  int documentRank;
+  
+  String documentTitle;
+  
+  String documentUri;
+  
+  List<String[]> snippets;
+}


Property changes on: 
mimir/trunk/mimir-web/src/java/gate/mimir/web/client/DocumentData.java
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

Modified: 
mimir/trunk/mimir-web/src/java/gate/mimir/web/client/GwtRpcException.java
===================================================================
--- mimir/trunk/mimir-web/src/java/gate/mimir/web/client/GwtRpcException.java   
2011-12-05 13:17:45 UTC (rev 14673)
+++ mimir/trunk/mimir-web/src/java/gate/mimir/web/client/GwtRpcException.java   
2011-12-05 17:55:36 UTC (rev 14674)
@@ -1,3 +1,16 @@
+/**
+ *  GwtRpcException.java
+ * 
+ *  Copyright (c) 1995-2010, The University of Sheffield. See the file
+ *  COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
+ *
+ *  This file is part of GATE (see http://gate.ac.uk/), and is free
+ *  software, licenced under the GNU Library General Public License,
+ *  Version 2, June 1991 (in the distribution as file licence.html,
+ *  and also available at http://gate.ac.uk/gate/licence.html).
+ *
+ *  Valentin Tablan, 01 Dec 2011 
+ */
 package gate.mimir.web.client;
 
 import com.google.gwt.user.client.rpc.IsSerializable;

Modified: 
mimir/trunk/mimir-web/src/java/gate/mimir/web/client/GwtRpcService.java
===================================================================
--- mimir/trunk/mimir-web/src/java/gate/mimir/web/client/GwtRpcService.java     
2011-12-05 13:17:45 UTC (rev 14673)
+++ mimir/trunk/mimir-web/src/java/gate/mimir/web/client/GwtRpcService.java     
2011-12-05 17:55:36 UTC (rev 14674)
@@ -1,9 +1,26 @@
+/**
+ *  GwtRpcService.java
+ * 
+ *  Copyright (c) 1995-2010, The University of Sheffield. See the file
+ *  COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
+ *
+ *  This file is part of GATE (see http://gate.ac.uk/), and is free
+ *  software, licenced under the GNU Library General Public License,
+ *  Version 2, June 1991 (in the distribution as file licence.html,
+ *  and also available at http://gate.ac.uk/gate/licence.html).
+ *
+ *  Valentin Tablan, 01 Dec 2011 
+ */
 package gate.mimir.web.client;
 
-
 import com.google.gwt.user.client.rpc.RemoteService;
 
 public interface GwtRpcService extends RemoteService {
-    String search(java.lang.String indexId, java.lang.String query) throws 
GwtRpcException;
-    void releaseQuery(java.lang.String queryId);
+  public String search(java.lang.String indexId, java.lang.String query)
+    throws GwtRpcException;
+
+  public ResultsData getResultsData(String queryId, int firstDocumentRank, 
+      int documentsCount) throws GwtRpcException;
+
+  public void releaseQuery(java.lang.String queryId);
 }

Modified: 
mimir/trunk/mimir-web/src/java/gate/mimir/web/client/GwtRpcServiceAsync.java
===================================================================
--- 
mimir/trunk/mimir-web/src/java/gate/mimir/web/client/GwtRpcServiceAsync.java    
    2011-12-05 13:17:45 UTC (rev 14673)
+++ 
mimir/trunk/mimir-web/src/java/gate/mimir/web/client/GwtRpcServiceAsync.java    
    2011-12-05 17:55:36 UTC (rev 14674)
@@ -1,3 +1,16 @@
+/**
+ *  GwtRpcServiceAsync.java
+ * 
+ *  Copyright (c) 1995-2010, The University of Sheffield. See the file
+ *  COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
+ *
+ *  This file is part of GATE (see http://gate.ac.uk/), and is free
+ *  software, licenced under the GNU Library General Public License,
+ *  Version 2, June 1991 (in the distribution as file licence.html,
+ *  and also available at http://gate.ac.uk/gate/licence.html).
+ *
+ *  Valentin Tablan, 01 Dec 2011 
+ */
 package gate.mimir.web.client;
 
 import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -3,5 +16,10 @@
 
 public interface GwtRpcServiceAsync {
-    void search(java.lang.String indexId, java.lang.String query, 
AsyncCallback<String> callback);
-    void releaseQuery(java.lang.String queryId, AsyncCallback callback);
+  public void search(java.lang.String indexId, java.lang.String query,
+              AsyncCallback<String> callback);
+
+  void getResultsData(String queryId, int firstDocumentRank,
+                      int documentsCount, AsyncCallback<ResultsData> callback);
+  
+  public void releaseQuery(java.lang.String queryId, AsyncCallback callback);
 }

Added: mimir/trunk/mimir-web/src/java/gate/mimir/web/client/ResultsData.java
===================================================================
--- mimir/trunk/mimir-web/src/java/gate/mimir/web/client/ResultsData.java       
                        (rev 0)
+++ mimir/trunk/mimir-web/src/java/gate/mimir/web/client/ResultsData.java       
2011-12-05 17:55:36 UTC (rev 14674)
@@ -0,0 +1,55 @@
+/**
+ *  ResultsData.java
+ * 
+ *  Copyright (c) 1995-2010, The University of Sheffield. See the file
+ *  COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
+ *
+ *  This file is part of GATE (see http://gate.ac.uk/), and is free
+ *  software, licenced under the GNU Library General Public License,
+ *  Version 2, June 1991 (in the distribution as file licence.html,
+ *  and also available at http://gate.ac.uk/gate/licence.html).
+ *
+ *  Valentin Tablan, 05 Dec 2011 
+ */
+package gate.mimir.web.client;
+
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+/**
+ * Class representing data about a running query.  
+ */
+public class ResultsData implements IsSerializable {
+  
+  private int resultsPartial;
+  
+  private int resultsTotal;
+
+  private List<DocumentData> documents;
+
+  public int getResultsPartial() {
+    return resultsPartial;
+  }
+
+  public void setResultsPartial(int resultsPartial) {
+    this.resultsPartial = resultsPartial;
+  }
+
+  public int getResultsTotal() {
+    return resultsTotal;
+  }
+
+  public void setResultsTotal(int resultsTotal) {
+    this.resultsTotal = resultsTotal;
+  }
+
+  public List<DocumentData> getDocuments() {
+    return documents;
+  }
+
+  public void setDocuments(List<DocumentData> documents) {
+    this.documents = documents;
+  }
+  
+}


Property changes on: 
mimir/trunk/mimir-web/src/java/gate/mimir/web/client/ResultsData.java
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

Modified: mimir/trunk/mimir-web/web-app/css/mimir.css
===================================================================
--- mimir/trunk/mimir-web/web-app/css/mimir.css 2011-12-05 13:17:45 UTC (rev 
14673)
+++ mimir/trunk/mimir-web/web-app/css/mimir.css 2011-12-05 17:55:36 UTC (rev 
14674)
@@ -183,13 +183,24 @@
 
 .hit {
   font-size: medium;
+  margin: 5px;
 }
 
+.document-title {
+  font-weight: bold;
+  color: #006193;
+}
+
 .snippet {
        margin-left: 20px;
        font-size: small;
 }
 
+.snippet-text {
+       font-weight: bold;
+}
+
+
 .snippet .mimir-hit {
     font-weight: bold;
     color: black;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to