Use boosts at indexing time, and at query runtime.
You can configure boosts
at indexing time, for example, to boost specific properties, and at query execution to boost a specific word in the query. For more information, see http://docs.day.com/content/en/home/crx/crx141/first_steps_with_crx/searching_in_crx/0.html.
Boosts at query runtime
Set the boosts
at query execution in the query itself, using the ^ operator.
Example:
jcr:contains(., 'jelly sandwich^4')
In this example, the word "sandwich" has weight four times more than the word "jelly."
Boosts at indexing time
Configure boosts
at indexing time in the search indexing configuration file (see IndexingConfig).
Example:
Bsp indexing_config.xml:
<?xml version="1.0"?>
<!DOCTYPE configuration SYSTEM
"http://jackrabbit.apache.org/dtd/indexing-configuration-1.0.dtd">
<configuration
...
<index-rule nodeType="cq:PageContent">
<property boost="4.0">jcr:title</property>
</index-rule>
</configuration>
In this example, the property jcr:title
has weight four times more than normal properties.
Note: The boost in this case is respected only if a jcr:contains()
is done on the corresponding property, for example jcr:contains(@jcr:title, 'find this')
. If there is only a jcr:contains(., 'find this'),
the boosts
at indexing time have no effect.
Find more information about possible configurations in the search indexing configuration file on the jackrabbit wiki, see http://wiki.apache.org/jackrabbit/IndexingConfiguration. (Note: It is jackrabbit-specific and must not be absolutely equivalent in CRX!)
Note: For information on how to modify the indexing_config.xml mentioned in this article, see http://helpx.adobe.com/experience-manager/kb/SearchIndexingConfig.html.