mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
*) make snippet fetcher accessible via soap api
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2661 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
97615af406
commit
8f143d516b
|
@ -65,6 +65,7 @@ public class SearchService extends AbstractService
|
|||
* ================================================================ */
|
||||
private static final String TEMPLATE_SEARCH = "yacysearch.soap";
|
||||
private static final String TEMPLATE_URLINFO = "ViewFile.soap";
|
||||
private static final String TEMPLATE_SNIPPET = "xml/snippet.xml";
|
||||
|
||||
|
||||
/**
|
||||
|
@ -163,7 +164,7 @@ public class SearchService extends AbstractService
|
|||
/**
|
||||
*
|
||||
*
|
||||
* @param url the url
|
||||
* @param urlHash the url hash
|
||||
* @param viewMode one of (VIEW_MODE_AS_PLAIN_TEXT = 1,
|
||||
* VIEW_MODE_AS_PARSED_TEXT = 2,
|
||||
* VIEW_MODE_AS_PARSED_SENTENCES = 3) [Source: ViewFile.java]
|
||||
|
@ -204,5 +205,29 @@ public class SearchService extends AbstractService
|
|||
throw new AxisFault(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public Document snippet(String url, String searchString) throws AxisFault {
|
||||
try {
|
||||
if (url == null || url.trim().equals("")) throw new AxisFault("No url provided.");
|
||||
if (searchString == null || searchString.trim().equals("")) throw new AxisFault("No search string provided.");
|
||||
|
||||
// extracting the message context
|
||||
extractMessageContext(false);
|
||||
|
||||
// setting the properties
|
||||
final serverObjects args = new serverObjects();
|
||||
args.put("url",url);
|
||||
args.put("search",searchString);
|
||||
|
||||
// generating the template containing the url info
|
||||
byte[] result = writeTemplate(TEMPLATE_SNIPPET, args);
|
||||
|
||||
// sending back the result to the client
|
||||
return this.convertContentToXML(result);
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new AxisFault(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user