Revision: 14792
http://gate.svn.sourceforge.net/gate/?rev=14792&view=rev
Author: valyt
Date: 2011-12-16 15:04:38 +0000 (Fri, 16 Dec 2011)
Log Message:
-----------
Aligned the XML-over-HTTP API with the new Query Runner API.
Modified Paths:
--------------
mimir/trunk/mimir-web/grails-app/controllers/gate/mimir/web/SearchController.groovy
mimir/trunk/mimir-web/grails-app/views/search/help.gsp
Modified:
mimir/trunk/mimir-web/grails-app/controllers/gate/mimir/web/SearchController.groovy
===================================================================
---
mimir/trunk/mimir-web/grails-app/controllers/gate/mimir/web/SearchController.groovy
2011-12-16 15:03:06 UTC (rev 14791)
+++
mimir/trunk/mimir-web/grails-app/controllers/gate/mimir/web/SearchController.groovy
2011-12-16 15:04:38 UTC (rev 14792)
@@ -30,6 +30,7 @@
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionBindingListener;
+import gate.mimir.search.QueryEngine;
import gate.mimir.search.QueryRunner;
@@ -152,7 +153,6 @@
def postQuery = {
def p = params["request"] ?: params
-
//get the query string
String queryString = p["queryString"]
try{
@@ -168,121 +168,156 @@
}
}
- def isActive = {
- def p = params["request"] ?: params
-
- //get the query ID
- String queryId = p["queryId"]
- QueryRunner runner = searchService.getQueryRunner(queryId);
- if(runner){
- render(buildMessage(SUCCESS, null){
- value(runner.isActive())
- }, contentType:"text/xml")
- } else{
- render(buildMessage(ERROR, "Query ID ${queryId} not known!", null),
- contentType:"text/xml")
- }
+ /**
+ * Gets the number of result documents.
+ * @return <code>-1</code> if the search has not yet completed, the total
+ * number of result document otherwise.
+ */
+ def documentsCount = {
+ def p = params["request"] ?: params
+ //a closure representing the return message
+ def message;
+ //get the query ID
+ String queryId = p["queryId"]
+ QueryRunner runner = searchService.getQueryRunner(queryId);
+ if(runner){
+ try{
+ //we have all required parameters
+ int docCount = runner.getDocumentsCount()
+ message = buildMessage(SUCCESS, null){
+ value(docCount)
+ }
+ }catch(Exception e){
+ message = buildMessage(ERROR,
+ "Error while obtaining the documents count: \"" +
+ e.getMessage() + "\"!", null)
+ }
+ } else{
+ message = buildMessage(ERROR, "Query ID ${queryId} not known!", null)
+ }
+ //return the results
+ render(contentType:"text/xml", builder: new StreamingMarkupBuilder(),
+ message)
}
-
- def isComplete = {
+
+ /**
+ * Gets the number of result documents found so far. After the search
+ * completes, the result returned by this call is identical to that of
+ * {@link #documentsCount}.
+ * @return the number of result documents known so far. */
+ def documentsCurrentCount = {
def p = params["request"] ?: params
-
+ //a closure representing the return message
+ def message;
//get the query ID
String queryId = p["queryId"]
QueryRunner runner = searchService.getQueryRunner(queryId);
if(runner){
- render(buildMessage(SUCCESS, null){
- value(runner.isComplete())
- }, contentType:"text/xml")
+ try{
+ //we have all required parameters
+ int docCount = runner.getDocumentsCurrentCount()
+ message = buildMessage(SUCCESS, null){
+ value(docCount)
+ }
+ }catch(Exception e){
+ message = buildMessage(ERROR,
+ "Error while obtaining the documents count: \"" +
+ e.getMessage() + "\"!", null)
+ }
} else{
- render(buildMessage(ERROR, "Query ID ${queryId} not known!", null),
- contentType:"text/xml")
+ message = buildMessage(ERROR, "Query ID ${queryId} not known!", null)
}
+ //return the results
+ render(contentType:"text/xml", builder: new StreamingMarkupBuilder(),
+ message)
}
-
- def hitCount = {
+
+ /**
+ * Gets the ID of a result document.
+ * @param rank the index of the desired document in the list of documents.
+ * This should be a value between 0 and {@link #documentsCount} -1.
+ *
+ * If the requested document position has not yet been ranked (i.e. we know
+ * there is a document at that position, but we don't yet know which one)
then
+ * the necessary ranking is performed before this method returns.
+ *
+ * @return an int value, representing the ID of the requested document. */
+ def documentID = {
def p = params["request"] ?: params
-
+ def message
//get the query ID
String queryId = p["queryId"]
QueryRunner runner = searchService.getQueryRunner(queryId);
if(runner){
- render(buildMessage(SUCCESS, null){
- value(runner.getHitsCount())
- }, contentType:"text/xml")
+ //get the other params
+ String rankStr = p["rank"]
+ if(rankStr){
+ try {
+ int rank = Integer.parseInt(rankStr)
+ int docId = runner.getDocumentID(rank)
+ message = buildMessage(SUCCESS, null){
+ value(docId)
+ }
+ } catch(NumberFormatException e) {
+ message = buildMessage(ERROR,
+ "Non-integer value provided for parameter rank", null);
+ }
+ }else{
+ message = buildMessage(ERROR, "No value provided for parameter rank",
+ null)
+ }
} else{
- render(buildMessage(ERROR, "Query ID ${queryId} not known!", null),
- contentType:"text/xml")
+ message = buildMessage(ERROR, "Query ID ${queryId} not known!", null)
}
+ render(contentType:"text/xml", message)
}
-
-
+
/**
- * Gets the document statistics for a set of documents. The returned value is
- * the XML representation of a two-rows int array where:
- * <ul>
- * <li>result[0][i] is the ID for the i<sup>th</sup> document</li>
- * <li>result[1][i] is the hits count for the i<sup>th</sup> document</li>
- * </ul>
+ * Get the score for a given result document. The value for the score
depends
+ * on the scorer used by the {@link QueryEngine} (see
+ * {@link QueryEngine#setScorerSource(java.util.concurrent.Callable)}).
+ * @param rank the index of the desired document in the list of documents.
+ * This should be a value between 0 and {@link #documentsCount} -1.
*/
- def docStats = {
+ def documentScore = {
def p = params["request"] ?: params
- //a closure representing the return message
- def message;
+ def message
//get the query ID
String queryId = p["queryId"]
QueryRunner runner = searchService.getQueryRunner(queryId);
if(runner){
- //get the parameters
- def startIndexParam = p["startIndex"]
- if(startIndexParam){
- def docCountParam = p["count"]
- if(docCountParam){
- try{
- //we have all required parameters
- int startIndex = startIndexParam.toInteger()
- int docCount = docCountParam.toInteger()
- int[][] docStats = new int[docCount][2];
- for(int i = 0; i < docCount; i++){
- docStats[i][0] = runner.getDocumentID(i + startIndex)
- docStats[i][1] = runner.getDocumentHitsCount(i + startIndex)
- }
-
- message = buildMessage(SUCCESS, null){
- for(int i = 0; i < docCount; i++){
- delegate.document(id:docStats[i][0], hitCount:docStats[i][1])
- }
- }
- }catch(Exception e){
- message = buildMessage(ERROR, "Error while obtaining the document
statistics: \"" +
- e.getMessage() + "\"!", null)
+ //get the other params
+ String rankStr = p["rank"]
+ if(rankStr){
+ try {
+ int rank = Integer.parseInt(rankStr)
+ double score = runner.getDocumentScore(rank)
+ message = buildMessage(SUCCESS, null){
+ value(score)
}
- }else{
- message = buildMessage(ERROR, "No value provided for parameter
count!",
- null)
+ } catch(NumberFormatException e) {
+ message = buildMessage(ERROR,
+ "Non-integer value provided for parameter rank", null);
}
- }else{
- message= buildMessage(ERROR,
- "No value provided for parameter startIndex!", null)
+ } else {
+ message = buildMessage(ERROR, "No value provided for parameter rank",
+ null)
}
} else{
message = buildMessage(ERROR, "Query ID ${queryId} not known!", null)
}
- //return the results
- render(contentType:"text/xml", builder: new StreamingMarkupBuilder(),
- message)
+ render(contentType:"text/xml", message)
}
-
-
+
/**
- * Action for obtaining the document metadata.
- * Parameters:
- * - documentId: the ID of the desired document
- * Returns:
- * - the document URI
- * - the document title
+ * Retrieves the hits within a given result document.
+ * @param rank the index of the desired document in the list of documents.
+ * This should be a value between 0 and {@link #documentsCount} -1.
+ *
+ * This method call waits until the requested data is available before
+ * returning (document hits are being collected by a background thread).
*/
- def documentMetadata = {
+ def documentHits = {
def p = params["request"] ?: params
//a closure representing the return message
def message;
@@ -290,62 +325,54 @@
String queryId = p["queryId"]
QueryRunner runner = searchService.getQueryRunner(queryId);
if(runner){
- //get the parameters
- String docIdStr = p["documentId"]
- if(docIdStr){
- int docId = docIdStr as int
- // see if any fields were requested
- Map<String, Serializable> metadata = null;
- def fieldNamesStr = p["fieldNames"]
- if(fieldNamesStr) {
- Set<String> fieldNames = new HashSet<String>()
- // split on each comma (not preceded by a backslash)
- fieldNamesStr.split(/\s*(?<!\\),\s*/).collect{
- // un-escape commas
- it.replace('\\,', ',')
- }.each{fieldNames.add(it)}
- metadata = runner.getDocumentMetadataFields(docId, fieldNames)
- }
- try{
+ //get the other params
+ String rankStr = p["rank"]
+ if(rankStr){
+ try {
+ int rank = Integer.parseInt(rankStr)
//we have all required parameters
- String documentURI = runner.getDocumentURI(docId)
- String documentTitle = runner.getDocumentTitle(docId)
+ List<Binding> hits = runner.getDocumentHits(rank)
message = buildMessage(SUCCESS, null){
- delegate.documentTitle(documentTitle)
- delegate.documentURI(documentURI)
- metadata?.each{String key, Serializable value ->
- delegate.metadataField(name:key, value:value.toString())
+ if(hits) {
+ delegate.hits {
+ for(Binding hit : hits){
+ delegate.hit (documentId: hit.getDocumentId(),
+ termPosition: hit.getTermPosition(),
+ length: hit.getLength())
+ }
+ }
}
}
- }catch(Exception e){
- message = buildMessage(ERROR, "Error while obtaining the document
statistics: \"" +
- e.getMessage() + "\"!", null)
+ } catch(NumberFormatException e) {
+ message = buildMessage(ERROR,
+ "Non-integer value provided for parameter rank", null);
}
- }else{
- message= buildMessage(ERROR,
- "No value provided for parameter documentId!", null)
+ } else {
+ message = buildMessage(ERROR, "No value provided for parameter rank",
+ null)
}
} else{
message = buildMessage(ERROR, "Query ID ${queryId} not known!", null)
}
//return the results
- render(contentType:"text/xml", builder: new StreamingMarkupBuilder(),
- message)
+ render(contentType:"text/xml",
+ builder: new StreamingMarkupBuilder(),
+ message)
}
-
-
+
+
/**
- * Action for obtaining [a segment of] the text of a document.
- * Parameters:
- * - documentId: the ID of the requested document
- * - position: (optional) the index of the first token to be returned,
- * defaults to 0 if omitted.
- * - length: (optional) the number of tokens (and spaces) to be returned.
- * If omitted, all tokens from position to the end of the document will
- * be returned.
+ * Gets a segment of the document text for a given document.
+ * @param rank the rank of the requested document. This should be a value
+ * between 0 and {@link #getDocumentsCount()} -1.
+ * @param termPosition the first term requested.
+ * @param length the number of terms requested.
+ * @return two parallel String arrays, one containing term text, the other
+ * containing the spaces in between. The first term is results[0][0], the
+ * space following it is results[1][0], etc.
*
- * The effect of the default values for position and length is that if both
- * are omitted the text for the whole of the given document is returned.
+ * The effect of the default values for termPosition and length is that if
+ * both are omitted the text for the whole of the given document is returned.
*/
def documentText = {
def p = params["request"] ?: params
@@ -356,19 +383,19 @@
QueryRunner runner = searchService.getQueryRunner(queryId);
if(runner){
//get the other params
- String docIdStr = p["documentId"]
- String positionStr = p["position"] ?: "0"
+ String rankStr = p["rank"]
+ String positionStr = p["termPosition"] ?: "0"
String lengthStr = p["length"] ?: "-1"
- if(docIdStr){
+ if(rankStr){
try {
- paramName = "docId"
- int docId = Integer.parseInt(docIdStr)
- paramName = "position"
+ paramName = "rank"
+ int rank = Integer.parseInt(rankStr)
+ paramName = "termPosition"
int position = Integer.parseInt(positionStr)
paramName = "length"
int length = Integer.parseInt(lengthStr)
message = buildMessage(SUCCESS, null){
- String[][] docText = runner.getDocumentText(docId, position,
length)
+ String[][] docText = runner.getDocumentText(rank, position, length)
for(int i = 0; i < docText[0].length; i++){
String token = docText[0][i]
String space = docText[1][i]
@@ -380,18 +407,27 @@
message = buildMessage(ERROR, "Non-integer value provided for
parameter ${paramName}", null);
}
}else{
- message = buildMessage(ERROR, "No value provided for parameter
documentId", null)
- }
+ message = buildMessage(ERROR, "No value provided for parameter rank",
+ null)
+ }
} else{
message = buildMessage(ERROR, "Query ID ${queryId} not known!", null)
}
render(contentType:"text/xml", message)
- }
+ }
/**
- * Gets the number of distinct documents in the current hit list.
+ * Action for obtaining the document metadata.
+ * Parameters:
+ * - rank: the rank of the desired document
+ * - fieldNames (optional): a comma-separated list of other field names to
+ * be returned.
+ * Returns:
+ * - the document URI
+ * - the document title
+ * - the values for the other field names, if requested and present.
*/
- def docCount = {
+ def documentMetadata = {
def p = params["request"] ?: params
//a closure representing the return message
def message;
@@ -399,86 +435,51 @@
String queryId = p["queryId"]
QueryRunner runner = searchService.getQueryRunner(queryId);
if(runner){
- try{
- //we have all required parameters
- int docCount = runner.getDocumentsCount()
- message = buildMessage(SUCCESS, null){
- value(docCount)
+ //get the parameters
+ String rankStr = p["rank"]
+ if(rankStr){
+ int rank = rankStr as int
+ // see if any fields were requested
+ Map<String, Serializable> metadata = null;
+ def fieldNamesStr = p["fieldNames"]
+ if(fieldNamesStr) {
+ Set<String> fieldNames = new HashSet<String>()
+ // split on each comma (not preceded by a backslash)
+ fieldNamesStr.split(/\s*(?<!\\),\s*/).collect{
+ // un-escape commas
+ it.replace('\\,', ',')
+ }.each{fieldNames.add(it)}
+ metadata = runner.getDocumentMetadataFields(rank, fieldNames)
}
- }catch(Exception e){
- message = buildMessage(ERROR,
- "Error while obtaining the documents count: \"" +
- e.getMessage() + "\"!", null)
- }
- } else{
- message = buildMessage(ERROR, "Query ID ${queryId} not known!", null)
- }
- //return the results
- render(contentType:"text/xml", builder: new StreamingMarkupBuilder(),
- message)
- }
-
- def getMoreHits = {
- def p = params["request"] ?: params
-
- //get the query ID
- String queryId = p["queryId"]
- QueryRunner runner = searchService.getQueryRunner(queryId);
- if(runner){
- runner.getMoreHits()
- render(buildMessage(SUCCESS, null, null), contentType:"text/xml")
- } else{
- render(buildMessage(ERROR, "Query ID ${queryId} not known!", null),
- contentType:"text/xml")
- }
- }
-
-
-
- def hits = {
- def p = params["request"] ?: params
- //a closure representing the return message
- def message;
- //get the query ID
- String queryId = p["queryId"]
- QueryRunner runner = searchService.getQueryRunner(queryId);
- if(runner){
- //get the parameters
- def startIndex = p["startIndex"]
- if(startIndex){
- def hitCount = p["count"]
- if(hitCount){
+ try{
//we have all required parameters
- List<Binding> hits = runner.getHits(startIndex as int, hitCount as
int)
+ String documentURI = runner.getDocumentURI(rank)
+ String documentTitle = runner.getDocumentTitle(rank)
message = buildMessage(SUCCESS, null){
- if(hits) {
- delegate.hits {
- for(Binding hit : hits){
- delegate.hit (documentId: hit.getDocumentId(),
- position: hit.getTermPosition(),
- length: hit.getLength())
- }
- }
+ delegate.documentTitle(documentTitle)
+ delegate.documentURI(documentURI)
+ metadata?.each{String key, Serializable value ->
+ delegate.metadataField(name:key, value:value.toString())
}
}
- }else{
- message = buildMessage(ERROR,
- "No value provided for parameter count!",
- null)
+ }catch(Exception e){
+ message = buildMessage(ERROR,
+ 'Error while obtaining the document metadata: "' +
+ e.getMessage() + "\"!", null)
}
}else{
- message = buildMessage(ERROR,
- "No value provided for parameter startIndex!", null)
+ message= buildMessage(ERROR,
+ "No value provided for parameter rank!", null)
}
} else{
message = buildMessage(ERROR, "Query ID ${queryId} not known!", null)
}
//return the results
- render(contentType:"text/xml",
- builder: new StreamingMarkupBuilder(),
- message)
+ render(contentType:"text/xml", builder: new StreamingMarkupBuilder(),
+ message)
}
-
+
+
def close = {
def p = params["request"] ?: params
@@ -832,7 +833,7 @@
QueryRunner runner = searchService.getQueryRunner(queryId);
if(runner){
//get the parameters
- def documentRankParam = p["documentRank"]
+ def documentRankParam = p["rank"]
if(documentRankParam){
try{
//we have all the required parameters
Modified: mimir/trunk/mimir-web/grails-app/views/search/help.gsp
===================================================================
--- mimir/trunk/mimir-web/grails-app/views/search/help.gsp 2011-12-16
15:03:06 UTC (rev 14791)
+++ mimir/trunk/mimir-web/grails-app/views/search/help.gsp 2011-12-16
15:04:38 UTC (rev 14792)
@@ -59,8 +59,8 @@
</div>
<div class="action-box">
- <span class="action-name">hitCount</span>
- <span class="action-desc">Action for obtaining the number of available
hits for a given query.</span>
+ <span class="action-name">documentsCount</span>
+ <span class="action-desc">Gets the number of result documents.</span>
<div class="list"><b>Parameters:</b>
<table>
<tr>
@@ -69,12 +69,13 @@
</tr>
</table>
</div>
- <b>Returns:</b> the number of hits retrieved so far for the given query.
+ <b>Returns:</b> <code>-1</code> if the search has not yet completed, or
the
+ total number of result documents otherwise.
</div>
<div class="action-box">
- <span class="action-name">docCount</span>
- <span class="action-desc">Action for obtaining the number of distinct
documents that have hits for a given query.</span>
+ <span class="action-name">documentsCurrentCount</span>
+ <span class="action-desc">Gets the number of result documents found so
far.</span>
<div class="list"><b>Parameters:</b>
<table>
<tr>
@@ -83,13 +84,15 @@
</tr>
</table>
</div>
- <b>Returns:</b> the number of distinct documents that have been found so
far
- to include hits for the given query.
+ <b>Returns:</b> the number of result documents found so far. After the
search
+ completes, the result returned by this call is identical to that of
+ <code>documentsCount</code>.
</div>
<div class="action-box">
- <span class="action-name">docStats</span>
- <span class="action-desc">Action for obtaining the number of available
hits for a given query, for each of the documents.</span>
+ <span class="action-name">documentID</span>
+ <span class="action-desc">Obtains the document ID for the document at a
+ given rank (position in the results list).</span>
<div class="list"><b>Parameters:</b>
<table>
<tr>
@@ -97,24 +100,18 @@
<td>the ID of the requested query.</td>
</tr>
<tr>
- <td>startIndex</td>
- <td>the index of the first desired document. This value should greater
- or equal to zero, and smaller than the value returned by the last call
- to <b>docCount</b>!</td>
- </tr>
- <tr>
- <td>count</td>
- <td>the number of desired documents. This value should be greater than
- zero, and smaller than <b>docCount - startIndex</b>!</td>
+ <td>rank</td>
+ <td>the rank (position in the results list) for the requested
document.</td>
</tr>
</table>
</div>
- <b>Returns:</b> for each requested document, its ID and the number of
hits.
+ <b>Returns:</b> ID of the requested document (an integer value).
</div>
-
+
<div class="action-box">
- <span class="action-name">hits</span>
- <span class="action-desc">Action for obtaining a set of hits.</span>
+ <span class="action-name">documentScore</span>
+ <span class="action-desc">Obtains the score for the document at a
+ given rank (position in the results list).</span>
<div class="list"><b>Parameters:</b>
<table>
<tr>
@@ -122,99 +119,64 @@
<td>the ID of the requested query.</td>
</tr>
<tr>
- <td>startIndex</td>
- <td>the index of the first desired hit.</td>
+ <td>rank</td>
+ <td>the rank (position in the results list) for the requested
document.</td>
</tr>
- <tr>
- <td>count</td>
- <td>the number of desired hits.</td>
- </tr>
</table>
</div>
- <p><b>Returns:</b> a list of hits, which may be:
- <ul>
- <li><b>null</b>, if no more hits exist,</li>
- <li><b>empty</b>, if no more hits have been found so far. In this
case,
- you should call <b>getMoreHits</b> to trigger a new search stage, in
- order to obtain more hits. A future call to this action may return
- more hits (if more were obtained in the mean time).</li>
- <li><b>shorter than the value of maxHits</b>, if not enough hits have
- been retrieved so far.</li>
- </ul>
- </p>
+ <b>Returns:</b> the score for the requested document, a floating point
+ (double precision) value.
</div>
-
<div class="action-box">
- <span class="action-name">getMoreHits</span>
- <span class="action-desc">Asks the query executor to restart the search
- process and try to get more hits.</span>
+ <span class="action-name">documentHits</span>
+ <span class="action-desc">Action for obtaining the hits for a given
+ document.</span>
<div class="list"><b>Parameters:</b>
<table>
<tr>
<td>queryId</td>
<td>the ID of the requested query.</td>
</tr>
+ <tr>
+ <td>rank</td>
+ <td>the rank (position in the results list) for the requested
document.</td>
+ </tr>
</table>
</div>
- <p><b>Returns:</b> the exit state (success or error).
- </p>
+ <p><b>Returns:</b> a list of hits, each defined by a document ID, a
+ termPosition, and a length.</p>
</div>
<div class="action-box">
- <span class="action-name">isActive</span>
- <span class="action-desc">Finds out whether a specified query is currently
- active. If the query is not currently active (which means that the latest
- search stage has completed, due to either heaving found enough hits, or the
- specified timeout having lapsed), it can be re-started by calling
- <b>getMoreHits</b>.</span>
+ <span class="action-name">documentText</span>
+ <span class="action-desc">Action for obtaining [a segment of] the text of
a document.</span>
<div class="list"><b>Parameters:</b>
<table>
<tr>
<td>queryId</td>
- <td>the ID of the requested query.</td>
+ <td>the ID of an active query, to be used as a context for this
call.</td>
</tr>
- </table>
- </div>
- <b>Returns:</b> a boolean value representing the state of the query.
- </div>
-
- <div class="action-box">
- <span class="action-name">isComplete</span>
- <span class="action-desc">Finds out whether a specified query has completed
- its execution (it has found all the possible hits in the index). A query
- that completed cannot be restarted (as it has already found everything) but
- can still be queried to obtain the document statistics, the hits, etc.
- Remember to <b>close</b> the query when it is not needed any more!</span>
- <div class="list"><b>Parameters:</b>
- <table>
<tr>
- <td>queryId</td>
- <td>the ID of the requested query.</td>
+ <td>rank</td>
+ <td>the rank (position in the results list) for the requested
document.</td>
</tr>
- </table>
- </div>
- <b>Returns:</b> a boolean value representing the state of the query.
- </div>
-
- <div class="action-box">
- <span class="action-name">renderDocument</span>
- <span class="action-desc">Renders the document text and hits, in the
context
- of a given query. The html of the document is rendered directly to the
- response stream of this connection.</span>
- <div class="list"><b>Parameters:</b>
- <table>
<tr>
- <td>queryId</td>
- <td>the ID of the requested query.</td>
+ <td>termPosition</td>
+ <td>(optional) the index of the first token to be returned,
+ defaults to 0 if omitted, i.e. start from the beginning of the
+ document.</td>
</tr>
<tr>
- <td>documentId</td>
- <td>the ID of the requested document (as obtained from the
<tt>documentMetadata</tt> call).</td>
- </tr>
+ <td>length</td>
+ <td>(optional) the number of tokens (and spaces) to be returned.
+ If omitted, all tokens from position to the end of the document will
+ be returned.</td>
+ </tr>
</table>
+ <p><b>Returns:</b> the text of the document [segment] requested, as a
+ list of tokens and space pairs.</p>
</div>
- <b>Returns:</b> the HTML source of the rendered document.
</div>
<div class="action-box">
@@ -227,50 +189,41 @@
<td>the ID of an active query, to be used as a context for this
call.</td>
</tr>
<tr>
- <td>documentId</td>
- <td>the ID of the desired document</td>
+ <td>rank</td>
+ <td>the rank (position in the results list) for the requested
document.</td>
</tr>
+ <tr>
+ <td>fieldNames</td>
+ <td>(optional) a comma-separated list of other field names to be
returned.</td>
+ </tr>
</table>
- <p><b>Returns:</b>
+ <p><b>Returns:</b></p>
<ul>
<li>the document URI</li>
<li>the document title</li>
- </ul></p>
+ <li>the values for the other field names, if requested and present</li>
+ </ul>
</div>
- </div>
-
+ </div>
+
<div class="action-box">
- <span class="action-name">documentText</span>
- <span class="action-desc">Action for obtaining [a segment of] the text of
a document.</span>
+ <span class="action-name">renderDocument</span>
+ <span class="action-desc">Renders the document text and hits, in the
context
+ of a given query. The html of the document is rendered directly to the
+ response stream of this connection.</span>
<div class="list"><b>Parameters:</b>
<table>
<tr>
<td>queryId</td>
- <td>the ID of an active query, to be used as a context for this
call.</td>
+ <td>the ID of the requested query.</td>
</tr>
<tr>
- <td>documentId</td>
- <td>the ID of the desired document</td>
+ <td>rank</td>
+ <td>the rank (position in the results list) for the requested
document.</td>
</tr>
- <tr>
- <td>position</td>
- <td>(optional) the index of the first token to be returned,
- defaults to 0 if omitted, i.e. start from the beginning of the
- document.</td>
- </tr>
- <tr>
- <td>length</td>
- <td>(optional) the number of tokens (and spaces) to be returned.
- If omitted, all tokens from position to the end of the document will
- be returned.</td>
- </tr>
</table>
- <p><b>Returns:</b>
- <ul>
- <li>the document URI</li>
- <li>the document title</li>
- </ul></p>
</div>
+ <b>Returns:</b> the HTML source of the rendered document.
</div>
<div class="action-box">
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for
developers. It will provide a great way to learn Windows Azure and what it
provides. You can attend the event by watching it streamed LIVE online.
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs