Configure Search

From DBSight Full-Text Search Engine/Platform Wiki

Table of contents

In Memory Search

Loading the whole index into memory definitely will increase performance. But this feature is only provided as a choice. Since DBSight search is already very fast and already heavily cached, all-in-memory index may not make you feel dramatic change. But if you really want to push it to extreme, you definitely can try it out.

You need to increase memory available to the JVM. To do so, you need to pass parameter like "-mx512m", where you can replace 512 for other reasonable value for your computer's available memory.

If memory is not enough for the whole index, DBSight will gracefully fall back to disk-based indexes.

Facet Search, aka narrowBy Search

How to setup categoried search result count?

For "Narrow By" boxes on the left of search engine style, you can use "Configure Search"-->Filterable Columns.

Let's say you have a "category" and "sub_category". What you need to do are:

  • Make sure Filterable checkbox is selected, and set Parent Column of "sub_category" to be "category"
  • Create a template with "Narrow Search Results" selected

You can create the template before or after you configure the "Filterable Columns".

How to do sum() avg() for narrowBy Search?

The normal narrowBy search is very similar to a SQL like this:

 select category, count(*)
 from results
 group by category

Is it possible to do sum(), avg() then, like this?

 select category, count(*), sum(rating), avg(price)
 from results
 group by category

Sure! You just need to follow the two steps:

1. Configure Sum-On Columns

Now for columns like "category" in the above example, you can specify columns you want to sum on, like "rating", "price". This has to be pre-configured because the calculation has to be done during searching, not during rendering the results.

2. Rendering sum() avg()

In the freemarker template, you can follow the example in the default narrowBy.ftl file, for each count result,

<#if count.hasSum >
 <#foreach sumColumn in count.sumColumnNames>
  ${sumColumn}:Sum ${count.sum(sumColumn)},Avg ${count.avg(sumColumn)?string("0.00")}

Here it's looping through all columns that you configured, which can be summed or averaged. Most likely you don't need to do this. For the above SQL example, just do this:

 Total Rating: ${count.sum("rating")}, Average Price: ${count.sum("price")?string("0.00")}

How does scoring work?

The scoring detailes can be found here Generally, the score is multiply of several 0~1 floating numbers, so it looks very small. For displaying purpose, you can simply multiply it with 100, or 1000.


To adjust it dynamically, you can change field search weight. For each document, you can use "Boost Factor" during indexing.

Default to OR relationship

For some applications, like product catalog, you may not want to have a precise match every time. Here is one of the customer's case.

So for example if a 'Sony 28 inch widescreen television' is being displayed, similar products will be listed below. They may be other brands of television, or have different screen sizes etc.

In this case, you may set default "OR" relationship for all search terms.