java - Lucene QueryParser needed that works with Custom Analyzer having stopfilter and porterstemfilter -


After text "itemprop =" text ">

With QueryParser, stemfilter does not seem to work and with AnalyzingQueryParser, the stop filter is not effective.

Is my observation correct? How to solve the problem?

Update is fine, then do some experiments with code. Analyzing the jQueryParser stopfilter is not allowed and Porterstemmerfilter is not allowed with QueryParser fuzzysearches.

Then I need a QueryParser that allows fuzzy searches with support for Porterstemfilter and stopfilter.

You can override the query parser by sub-closing if it is needed, without problems Analyzing with jQueryParser was able to use the StopAnalyzer:

  analyzer analyzer1 = new StopAnalyzer (Version.LUCENE_30, ImmutableSet.of ("foo" "bar" , "Blob")); QueryParser qp = New analytics system parser (version LUCENE_30, "field", analyzer 1); Query q = qp.parse ("foobar foo bar blop hello"); System.out.println ("query" + q); Q = qp.parse ("foobar ~ foo ~ bar ~ hell"); System.out.println ("query" + q);  

Generate Query: Field: Forbes Field: Hello and Field: Fobar ~ 0.5 Hell ~ 0.5. This is Lucine 3.0.3, so I'm not sure it applies again to your question. Anyway, I stumbled on it and hoped that this might help you with problems with stemmers if they add wildcard queries, in which case you might want to override the methods:

< Pre class = "lang-java prettyprint-override"> @Override protected query getFuzzyQuery throws ParseException (string field STR, float minimilarity) {return super.getFuzzyQuery (field, term STR, minimilier ); } @Override Protected query throws the getWildcardQuery (string field, string termStr) ParseException {return super.getWildcardQuery (area, termStr); }

Comments