Search these areas:
Help
Support Forums
Product Info



Introduction
DataWeb: What's New
Creating an Application
The DataWeb Designer
Application Management
Data Tables
Data Tables
Views
Templates
Components
Data Analysis
Members
Security
Importing
Exporting
FTP
JavaScript
Object Model
Full-Text Search
-Tips for Searching
-Using the Search Module
-Define Search Catalogs
-Generate Search Index
-Return Search Results
Domain and Email Hosting
HotBlock Modules
Account Management
Glossary
New Responsive UI Module





DataWeb Help
Support Forums
Tutorial
Script Library
Knowledge Base

Home > Support

DataWeb User's Guide

Return Search Results
The final step in implementing full-text search in your application is writing script to return the search results.

Once the search index has been build, you can access the results of a particular search by creating a resultset on the ~search table. The ~search table is a special table that contains only search results; it is not visible in the web directory of your application. You can use the data in the resultset to construct a results page.

To create the resultset, use script like the following:

var rs = new Resultset("~search", "*", {query:q});

where q is a string variable containing the search text.

The following table shows the columns returned on the resultset:

Column Description
Catalog The catalog that includes this search result.
Abstract The summary text for the search result. The abstractfield attribute in the search specification file contributes this value.
Rank The position in the search field at which the search text was found.
Relevance A percentage rating for a particular document, in terms of its likely relevance. 
Title The title for the search result, as specified in the search specification.
URL The URL for this search result, constructed from the search specification.

The following function takes a search string, performs a search, and displays the results. You can use this function as a simple test for your search index. Paste the function into a DataWeb script (.ws) file, and click the Test button to test it: 

webcall function testSearchIndex(szQuery)
  {
  var rs = new Resultset("~search", "*", {query:szQuery});
  while(rs.next())
  {
    <ws:tags>
    <b>Title:</b>&nbsp;<%=rs.title%><br>
    <b>Rank:</b>&nbsp;<%=rs.rank%><br>
    <b>Relevance:</b>&nbsp;<%=rs.relevance%><br>
    <b>URL:</b>&nbsp;<%=rs.url%><br>
    <b>Abstract:</b>&nbsp;<%=rs.abstract%><br><br>
    </ws:tags>;
  }
}
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
DataWeb, 720 North 10th Street, A #145, Renton, Washington 98057 *425-583-5970* Fax 484-770-4706* Email Us