-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
currently I migrate to Lucene 4. In the past, I did a trick to get the index
specific terms for an
according (wildcard) query (see below). But it don't works anymore:
String queryString = "n*"; // gives no result
// String queryString = "nöä"; // results, but only the given String - not the
real index terms
Query query = new QueryParser(Version.LUCENE_CURRENT, "body", new
StandardAnalyzer(Version.LUCENE_CURRENT)).parse(queryString);
Query rewritten = searcher.rewrite(query);
HashSet<Term> hsTerms = new HashSet<>();
rewritten.extractTerms(hsTerms);
in the past, searcher.rewrite on a wildcard query results into a new
BooleanQuery with simple
TermQueries in it, representing the matching primitive terms from the index.
The javaDoc of the current release sounds to me that this could still work:
Searcher.rewrite:
/**Expert: called to re-write queries into primitive queries.**/
Query.extractTerms:
/**Expert: adds all terms occurring in this query to the terms set. Only works
if this query is in
its {@link #rewrite rewritten} form.**/
Thanks in advance!
Christian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
iEYEARECAAYFAlQyvfoACgkQ6EqMXq+WZg9eHgCfT3dhsdJEcOxr90T3omZCJBhc
qMwAn3HiT7mgExA7ok/xVMvoSTVGz//o
=V9im
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]