You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by mike topper <mt...@riseup.net> on 2007/04/18 17:46:32 UTC

limiting the rows returned for a query

Hello,

I have a question that I couldn't really find the answer to and dont 
really know if its possible currently within solr.

I want to do a simple query to the solr index.  something like 
q=stateid:1 countryid:1

but i'm really only concerned with getting the record above and below a 
certain (dynamic) recordid in the search results.

Is there a way to do this through a query or is my only option to return 
all the search results and parse them to find the record id I want, and 
then get the one above and below that.  I'd also have to take into 
account pagination and whatnot which makes it also a little bit harder 
to do this way.

anyways hope that makes sense,

let me know!


-Mike

Re: limiting the rows returned for a query

Posted by Chris Hostetter <ho...@fucit.org>.
: I want to do a simple query to the solr index.  something like
: q=stateid:1 countryid:1
:
: but i'm really only concerned with getting the record above and below a
: certain (dynamic) recordid in the search results.

you have to define what "above and below" means in your context ... do you
mean assuming a sorting on some field?  if so then you could
write a custom FunctionQuery that looks at the value for a given doc and
scores things based on how close their value is.

alternately you could have a custom RequestHandler that does the search,
and walks the DocList on the server side ... either way you need some
custom java code.

but i could be missing some easy solution ... it all depends on the
specifics of your problem (can you give a concrete example?)



-Hoss