lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From José Tomás Atria <>
Subject Single string automaton causes NPE on Terms.intersect( CompiledAutomaton, BytesRef term )
Date Fri, 25 Mar 2016 20:33:26 GMT
Hello again!

I'm playing around some more with Lucene's automata, and I've bumped into
something unexpected but can't figure out if its a bug or an error on my

briefly: Is it possible to use a single string automaton (i.e. the result
of Automata.makeString( String ) )  to intersect a Terms instance? I keep
getting NPE's on every attempt at doing this... e.g. this code:

// where "term" is a term known to exist in someField
CompiledAutomaton ca = new CompiledAutomaton( Automata.makeString( "term" )
Terms terms = leafReader.terms( someField );
TermsEnum tEnum = terms.intersect( ca, null );

results in:
Exception in thread "main" java.lang.NullPointerException

I assume I'm doing something wrong (I am aware that using an automaton for
a single term may be a bad idea, but bear with me), but the fact that it's
throwing an NPE prompted me to come and ask...

Maybe there's a problem with encodings?

Any help greatly appreciated.

entia non sunt multiplicanda praeter necessitatem

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message