Hi Björn,
yes, the error you point out will happen indeed... A possible
workaround would be:
public Hits search(String queryString, int numHits,
String dedupField, String sortField, boolean reverse)
throws IOException {
org.apache.lucene.queryParser.QueryParser parser = new
org.apache.lucene.queryParser.QueryParser("content", new
org.apache.lucene.analysis.standard.StandardAnalyzer());
org.apache.lucene.search.Query luceneQuery = null;
try {
luceneQuery = parser.parse(queryString);
} catch(Exception ex) {
}
org.apache.lucene.search.BooleanQuery boolQuery = new
org.apache.lucene.search.BooleanQuery();
boolQuery.add(luceneQuery,
org.apache.lucene.search.BooleanClause.Occur.MUST);
return translateHits
(optimizer.optimize(boolQuery, luceneSearcher, numHits,
sortField, reverse),
dedupField, sortField);
}
Please notice that I'm not sure this will work as it should: right
now, it just compiles... I still need to modify the NutchBean class so
it can pass on the raw query, as Ravi says.
Regards,
Cristina
On 10/5/06, Björn Wilmsmann <[EMAIL PROTECTED]> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi everybody,
On 05/10/2006 05:44 Ravi Chintakunta wrote:
> public Hits search(String queryString, int numHits,
> String dedupField, String sortField, boolean
> reverse) throws IOException {
>
> org.apache.lucene.queryParser.QueryParser parser = new
> org.apache.lucene.queryParser.QueryParser("content", new
> org.apache.lucene.analysis.standard.StandardAnalyzer());
>
> org.apache.lucene.search.Query luceneQuery = parser.parse
> (queryString);
>
> return translateHits
> (optimizer.optimize(luceneQuery, luceneSearcher, numHits,
> sortField, reverse),
> dedupField, sortField);
> }
This seems to be a good approach. I have not yet tried it out in
detail, however, the method optimize() in LuceneQueryOptimizer does
only take BooleanQuery as an argument, so the line 'return
translateHits...' would cause a compile error, wouldn't it?
- --
Best regards,
Björn Wilmsmann
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
iD8DBQFFJV9Fgz0R1bg11MERAt3sAJ4pKJ8voEhWSo+94SI6bam4iVPYgACbBQmm
sFAZIcCv3CoIBJC5g8FbOyo=
=vzdw
-----END PGP SIGNATURE-----