: Basically, I need to find item X in the result set and return say N items
: before and N items after.
: 
: < ----- N items -- Item X --- N items ---->
        ...
: So I might be wrong, but it looks like the only way would be to create a
: custom SolrIndexSearcher which will find the offset and create the related
: docslice. That slicing part doesn't seem to be well factored that I can
: see, so it seems to imply copy/pasting a significant chunk off the code. Am
: I looking at the wrong place ?

trying to do this as a hook into the SolrIndexSearcher would definitley be 
complicated ... laregley because of how matches are collected.

the most straight forward way i can think of to get the data you want is 
to consider what you are sorting on, and use that as a range filter, ie...

1) do your search, and filter on id:X
2) look at the values X has in the fields you are sorting on
3) search again, this time filter on those fields, asking for the first N 
docs with values greater then whatever id:X has
4) search again, this time reverse your sort, and reverse your filters 
(docs with values less hten whatever id:X has) and get the first N docs.


...even if your sort is "score" you can use the frange parser to filter 
(not usually recommended for score, but possible)



-Hoss

Reply via email to