lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Cassiano <danielcassi...@gmail.com>
Subject Problem with ResponseBuilder
Date Wed, 26 Aug 2009 01:28:58 GMT
Hi folks,

I'm writing some search component to Solr and I'm having some troubles with
the ResponseBuilder.
I'd like to add to response, eg: only 5 documents of a search.
My problem is when I try to add these docs to the ResponseBuilder.

A snipet of the code:
[...]
QParser parser = QParser.getParser(rb.getQueryString(), defType, req);
rb.setQuery( parser.getQuery() );
rb.setSortSpec( parser.getSort(true) );
rb.setQparser(parser);

DocListAndSet results = new DocListAndSet();
Hits h = searcher.search(rb.getQuery());

for (int i=0;i<5;i++) {
    results.docList.add(h.id(i));
}

rb.setResults(results);
[...]

The expected result is a response with only 5 documents.

Is this the correct way to obtain the docs?
I'm receiving a null java.lang.NullPointerException with this code.

Sorry but I didn' t found the solution anywhere and I'm a noob with Solr.


Thanks in advance.

-- 
Daniel Cassiano
_____________________________

http://www.apontador.com.br/
http://www.maplink.com.br/

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