Virtual DBSight Site

From DBSight Full-Text Search Engine/Platform Wiki

What's Virtual DBSight Site?

Some companies may have several indexes. Each index could be relatively small.

But each department would only be interested in a few indexes. Displaying all of the indexes and providing instructions for them to choose from would be cumbersome.

So the big company could provide a virtual departmental site. Like this:

http://<host-name>:<port-name>/v/<site-name>/frontpage.do

How it works?

A filter will recognize the pattern and set a variable "site" in the request context. This variable could be referenced by one of the method:

$site    //in Velocity macro
${site}  //in freemarker
request.getAttribute("site")    //in JSP

This way, you can configure which indexes to show for the current site.

Code Sample

For example, if you have 2 sites.

http://host-name:8080/dbsight/v/site1/frontpage.do
http://host-name:8080/dbsight/v/site2/frontpage.do

You can modify the frontpage.vm file as this:

#set($sites = {})
#set($sites.site1 = ["index1","index2"])
#set($sites.site2 = ["index2","index3"])

#foreach( $dc in $dcs )
  #if($vmTool.contains($sites.get($site),$dc.name))
     ## display the current index
  ....

Note: The above is a simpler version. The actual default frontpage.vm has more logic and could be used for both virtual site and default non-virtual setup. Usually you just need to adjust the following lines:

#set($sites.site1 = ["index1","index2"])
#set($sites.site2 = ["index2","index3"])