%@ page
language="java"
contentType="text/html;charset=utf-8"
%>
<%@ page import="org.crosswire.sword.orb.*" %>
<%
SWMgr mgr = SwordOrb.getSWMgrInstance(request);
SWModule book = mgr.getModuleByName("ASV");
%>
SWORDWeb Search Example
<%
String searchTerm = "God love world";
SearchType searchType = SearchType.MULTIWORD;
int searchOptions = 2; // 2=ignore case. cheezy, should be a define
String searchRange = ""; // use anything intelligible, eg. "mat-joh5;acts"
SearchHit[] results = book.search(searchTerm, searchType, searchOptions, searchRange);
%>
There are <%= results.length %> results searching for "<%= searchTerm %>" in the <%= book.getDescription() %> (<%= book.getName() %>)
Reference | Text |
<%
for (int i = 0; i < results.length && i < 100; i++) {
book.setKeyText(results[i].key);
%>
<%= book.getKeyText() %> | <%= book.getRenderText() %> |
<%
}
%>