Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

document Christoph's improvements to FuzzyQuery

Daniel Naber61e338ae8807
diff --git a/CHANGES.txt b/CHANGES.txt
index 312f4684948..2a60f39da0f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -11,7 +11,12 @@ $Id$
2. FuzzyQuery now takes an additional parameter that specifies the
minimum similarity that is required for a term to match the query.
- Note that this isn't supported by QueryParser yet. (Daniel Naber)
+ The QueryParser syntax for this is term~x, where x is a floating
+ point number between 0 and 1 (a bigger number means that a higher
+ similarity is required). Furthermore, a prefix can be specified
+ for FuzzyQuerys so that only those terms are considered similar that
+ start with this prefix. This can speed up FuzzyQuery greatly.
+ (Daniel Naber, Christoph Goller)
3. The Russian and the German analyzers have been moved to Sandbox.
Also, the WordlistLoader class has been moved one level up in the
diff --git a/docs/queryparsersyntax.html b/docs/queryparsersyntax.html
index 41e4cc4e1c2..34cb0827dbb 100644
--- a/docs/queryparsersyntax.html
+++ b/docs/queryparsersyntax.html
@@ -385,7 +385,28 @@ limitations under the License.
</tr>
</table>
</div>
- <p>This search will find terms like foam and roams</p>
+ <p>This search will find terms like foam and roams.</p>
+ <p>Starting with Lucene 1.9 an additional (optional) parameter can specify the required similarity. The value is between 0 and 1, with a value closer to 1 only terms with a higher similarity will be matched. For example:</p>
+ <div align="left">
+ <table cellspacing="4" cellpadding="0" border="0">
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#ffffff"><pre>roam~0.8</pre></td>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ </table>
+ </div>
+ <p>The default that is used if the parameter is not given is 0.5.</p>
</blockquote>
</td></tr>
<tr><td><br/></td></tr>
diff --git a/xdocs/queryparsersyntax.xml b/xdocs/queryparsersyntax.xml
index b5b8b36dfa0..9539c75ef4e 100644
--- a/xdocs/queryparsersyntax.xml
+++ b/xdocs/queryparsersyntax.xml
@@ -88,7 +88,11 @@
<p>Lucene supports fuzzy searches based on the Levenshtein Distance, or Edit Distance algorithm. To do a fuzzy search use the tilde, "~", symbol at the end of a Single word Term. For example to search for a term similar in spelling to "roam" use the fuzzy search: </p>
<source>roam~</source>
- <p>This search will find terms like foam and roams</p>
+ <p>This search will find terms like foam and roams.</p>
+
+ <p>Starting with Lucene 1.9 an additional (optional) parameter can specify the required similarity. The value is between 0 and 1, with a value closer to 1 only terms with a higher similarity will be matched. For example:</p>
+ <source>roam~0.8</source>
+ <p>The default that is used if the parameter is not given is 0.5.</p>
</subsection>