lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Rowe <sar...@gmail.com>
Subject Re: Lucene synonym for multi-words and query parsers
Date Wed, 12 Apr 2017 20:31:13 GMT
Hi Nicolas,

Classic QueryParser and SimpleQueryParser should work for you (see below).  Some work has
been done on StandardQueryParser (see <https://issues.apache.org/jira/browse/LUCENE-7315>),
but that work is not ready yet.  AFAIK nobody has worked on enabling multi-term analysis in
ComplexPhraseQueryParser’s.

For Classic QueryParser, use setSplitOnWhitespace(false).  See <http://lucene.apache.org/core/6_5_0/queryparser/org/apache/lucene/queryparser/classic/QueryParser.html#setSplitOnWhitespace-boolean->.

For SimpleQueryParser, you can enable multi-term analysis by disabling only the whitespace
“operator” via the constructor taking the flags option <http://lucene.apache.org/core/6_5_0/queryparser/org/apache/lucene/queryparser/simple/SimpleQueryParser.html#SimpleQueryParser-org.apache.lucene.analysis.Analyzer-java.util.Map-int->,
e.g. 

new SimpleQueryParser(analyzer, Collections.singletonMap("field", 1f), ~SimpleQueryParser.WHITESPACE_OPERATOR);

--
Steve
www.lucidworks.com

> On Apr 12, 2017, at 11:49 AM, Nicolás Lichtmaier <nicolasl@wolfram.com> wrote:
> 
> As far as I can see Lucene new support for multi word synonyms doesn't work with non-phrase
inputs. The analyzer can correctly create the graph, but it doesn't have the chance because
query parsers process word by word.
> 
> Am I missing something?
> Here are some tests I've done... (synonyms are just "go to => open").<Captura de
pantalla de 2017-04-12 12-41-09.png>
> 
> 
> Thanks!
> 
> Nicolás.-
> 
> 


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


Mime
View raw message