limiting the rows returned for a query

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

limiting the rows returned for a query

mike topper
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
Reply | Threaded
Open this post in threaded view
|

Re: limiting the rows returned for a query

Chris Hostetter-3

: 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