
528
DEVELOPING
COLDFUSION 9 APPLICATIONS
Accessing and Using Data
Las
t
upda
te
d 8/5/2010
To search a document whose modification date is between a given range:
<cfsearch name="qsearch"
collection="solr_srch"
criteia="modified:20080101 TO 20500101">
These ranges are inclusive of start and end terms. To exclude them, use curly brackets{} instead.
•
Field search: To search any document whose title contains "fuzzy1.txt"
<cfsearch name="qsearch"
collection="solr_srch"
criteria="title:fuzzy1.txt">
Searching for document that contains title as 'fuzzy1.txt' OR 'fuzzy2.txt':
<cfsearch name="qsearch"
collection="solr_srch"
criteria="title:fuzzy?.txt">
The following syntax can be used to perform the same search:
<cfsearch name="qsearch"
collection="solr_srch"
criteria=' ""title:fuzzy1.txt"" OR ""title:fuzzy2.txt"" '>
Alternatively, you can search using the following syntax:
<cfsearch name="qsearch"
collection="solr_srch"
criteria="title:(test* +fuzzy1*)">
•
String search:
<cfsearch name="qsearch1"
collection="solr_complex"
criteria='"Cold Fusiongava" OR "Internet Tools"'>
•
Searching synonyms: There are two ways to search documents that have synonymous words like 'MB', 'megabyte',
'gig', and so on:
1
If collection is not yet created, go to:
<cf_home>/solr/multicore/template/conf/synonyms.txt
This file contains some default mappings such as
'GB, gig, gigabyte, gigabytes'
. Define your synonym
mappings in the next row.
2
If you want to add a synonym mapping for a collection that is already created, go to
<collection_location>/conf/synonyms.txt
and define your mapping.
Restart the Solr server after defining mapping.
Term highlighting
By default, Solr highlights searched terms in the summary content as described in the following snippet: