lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Muir (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LUCENE-950) IllegalArgumentException parsing "foo~1"
Date Wed, 20 Oct 2010 13:17:24 GMT

    [ https://issues.apache.org/jira/browse/LUCENE-950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12922950#action_12922950
] 

Robert Muir commented on LUCENE-950:
------------------------------------

I'd like to resolve this issue.

In LUCENE-2667 we changed the syntax for 4.0 such that foo~1 and foo~2 specify a fuzzyquery
with edit distance of 1 or 2, respectively.
The old syntax of ~0.5 is still accepted, but the default is now ~2 so that we never scan
the entire term dictionary by default.
The new syntax is no problem, since you only got IllegalArgumentException for these things
before :)

Its also pretty handy to be able to do a search and ask for '1 or 2 characters off' without
playing games with floats.
see http://stackoverflow.com/questions/2073839/search-lucene-with-precise-edit-distances
For example, we now have a spellchecker (LUCENE-2507) that uses this functionality in just
this way.

So I think we can resolve this issue as fixed since its obselete.


> IllegalArgumentException parsing "foo~1"
> ----------------------------------------
>
>                 Key: LUCENE-950
>                 URL: https://issues.apache.org/jira/browse/LUCENE-950
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: QueryParser
>    Affects Versions: 2.1, 2.2
>         Environment: Java 1.5
>            Reporter: Eleanor Joslin
>            Priority: Minor
>         Attachments: lucene_950_08_26_2009.patch
>
>
> If I run this:
>     QueryParser parser = new QueryParser("myField", new SimpleAnalyzer());
>     try {
>       parser.parse("foo~1");
>     }
>     catch (ParseException e) {
>       // OK
>     }
> I get this:
> Exception in thread "main" java.lang.IllegalArgumentException: minimumSimilarity >=
1
> 	at org.apache.lucene.search.FuzzyQuery.<init>(FuzzyQuery.java:58)
> 	at org.apache.lucene.queryParser.QueryParser.getFuzzyQuery(QueryParser.java:711)
> 	at org.apache.lucene.queryParser.QueryParser.Term(QueryParser.java:1090)
> 	at org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:979)
> 	at org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:907)
> 	at org.apache.lucene.queryParser.QueryParser.TopLevelQuery(QueryParser.java:896)
> 	at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:146)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message