%@ page
language="java"
contentType="text/html;charset=utf-8"
%>
<%@ page import="org.crosswire.sword.orb.*" %>
<%
SWMgr mgr = SwordOrb.getSWMgrInstance(session);
SWModule book = mgr.getModuleByName("NASB");
%>
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 <%= book.getName() %>
Reference | Text |
<%
for (int i = 0; i < results.length && i < 100; i++) {
book.setKeyText(results[i].key);
%>
<%= book.getKeyText() %> | <%= new String(book.getRenderText().getBytes("iso8859-1"), "UTF-8") %> |
<%
}
%>