lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Evert Wagenaar <evert.wagen...@gmail.com>
Subject How to get the terms matching a WildCardQuery in Lucene 6.2?
Date Mon, 24 Oct 2016 16:40:36 GMT
I already asked this on StackOverflow. Unfortunately without any answer for
over a week now.

Therefore again to the real experts:


I downloaded a list of 350.000 English words in a .txt file and Indexed it
using the latest Lucene (6.2). I want to apply wildcard queries like
aard???? and then retreive a list of matches.

I've done this before in an older version of Lucene. Here it was pretty
simple. I just had to do a Query.rewrite() and this retuned what I needed.
Unfortunately in 6.2 this doesn't work anymore. There is a
Query.rewrite(Indexreader reader) which should return a HashMap of Terms.
In my case there's only one matching Term (aardvark). The Searcher returns
one hit, containing the Document path to the wordlist. The HashMap is
however empty.

When I change the Query to find more then one single match (like aa*) the
HashMap remains empty.

I tried the MatchExtractor too. Unfortunately without result.

The Objective of this is to demonstrate the power of Lucene to easily find
words of a particular length, given one or more characters. I'm pretty sure
I can do this using regular expressions in Java but then it's outside my
objective.

Can anyone tell me why this isn't working? I use the StandardAnalyzer.
Should I use a different Application?

Any help is greatly appreciated.

Thanks.



-- 
Sent from Gmail IPad

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