Yoann Rodière (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HSEARCH-3888 (
https://hibernate.atlassian.net/browse/HSEARCH-3888?atlOrigin=eyJpIjoiMzU...
)
Re: How to query in "Hibernate Search" fuzzy mode with
FuzzyContext.withEditDistanceUpTo() with more than 2 "changes"? (
https://hibernate.atlassian.net/browse/HSEARCH-3888?atlOrigin=eyJpIjoiMzU...
)
I don't think we will add this to the DSL, as I doubt we can rely on the stability and
overall quality of "sandbox" code. We actually explicitly exclude this artifact
from our transitive dependencies.
That being said, if you want to rely on that code, you can still roll out your own
"slow fuzzy query parser":
public final class SlowFuzzyQueryBuilder extends QueryBuilder {
private final int minimumSimilarity;
public FuzzyQueryBuilder(Analyzer analyzer, int minimumSimilarity) {
super ( analyzer );
this.minimumSimilarity = minimumSimilarity;
}
@Override
protected Query newTermQuery(Term term) {
return new SlowFuzzyQuery( term, minimumSimilarity );
}
}
And get the custom analyzer from Hibernate Search:
Analyzer analyzer = fullTextSession.getSearchFactory().getAnalyzer( MyEntity.class );
(Or re-build the analyzer manually using
org.apache.lucene.analysis.custom.CustomAnalyzer#builder() )
Then just do this to create the Lucene query:
SlowFuzzyQueryBuilder builder = new SlowFuzzyQueryBuilder( analyzer, 4 );
Query luceneQuery = builder.createBooleanQuery( "field_name" , "search
terms" );
(
https://hibernate.atlassian.net/browse/HSEARCH-3888#add-comment?atlOrigin...
) Add Comment (
https://hibernate.atlassian.net/browse/HSEARCH-3888#add-comment?atlOrigin...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100125- sha1:63ccdc5 )