
527
DEVELOPING
COLDFUSION 9 APPLICATIONS
Accessing and Using Data
Las
t
upda
te
d 8/5/2010
•
Multiple word search: The following example shows how to search a document or query having words
"ColdFusion" and "Green" in it:
<cfsearch name="qsearch1"
collection="solr_complex"
criteria="+Green +Coldfusion">
•
Search with at least one word: The following example shows how search for at least "Coldfusion" OR (Green OR
Blue):
<cfsearch name="qsearch1"
collection="solr_complex"
criteria=" +Coldfusion Green Blue">
•
Search for one word, but not the other: The following example shows how to search for "Green" but NOT
"Coldfusion":
<cfsearch name="qsearch1"
collection="solr_complex"
criteria=" -ColdGreen">
•
Fuzzy search: The following example shows how to search words like roam, roams, foam, foams:
<cfsearch name="qsearch1"
collection="solr_complex"
criteria=" roam~">
Alternate way to perform a fuzzy search for "roam":
<cfsearch name="qsearch1"
collection="solr_complex"
criteria="roam~">
Searching for higher similarity with ‘roam’:
<cfsearch name="qsearch1"
collection="solr_complex"
criteria=" roam~0.8" >
•
Wildcard search: The following syntax searches for 'test', 'text', 'teat', and so on:
<cfsearch name="qsearch1"
collection="solr_complex"
criteria=" te?t">
This example searches for 'test', 'text', 'teeeeeext', and 'texyzt':
<cfsearch name="qsearch1"
collection="solr_complex"
criteria=" te*t">
Note:
You cannot use a * or question mark (?) symbol as the first character of a search.
•
Proximity search: To search for "apache" and "jakarta" within five words of each other in a document, use the
following search:
<cfsearch name="qsearch1"
collection="solr_complex"
criteria='"jakarta apache" ~10'>
•
Range Search: Following searches all documents with title between 'fuzzy1.txt' to 'text1.txt':
<cfsearch name="qsearch"
collection="solr_srch"
criteria="title:fuzzy1.txt TO text1.txt">