Post processing results as in #1 has big disadvantages as you can’t easily “fill back in” as those docs that were removed and may have been accounted for in facet counts for example.
#2 would be my recommendation as well.
There is an open issue to create an IP(v6) field type in Solr, with a patch there for IPv4 already.
> On Jan 7, 2015, at 11:41 AM, Chad Mills <[log in to unmask]> wrote:
> Basically I have a solr index where, at times, some of the results from a query will only be limited to a set of users based on their clients IP address. I have been thinking about accomplishing this in either two ways.
> 1) Post-processing the results for IP validity against an external data source and dropping out those results which are not valid. That could leave me with a portioned result list that would need another query to fill back in. Say I want 10 results, I end up dropping 2 of them, I need to fill back in those 2 by performing another query.
> 2) Making the IP permission check part of the query. Basically appending an AND in the query on a field that stores the permissible IP addresses. The index field would be set to allow all IPs to access the result by default, but at times can contain the allowable IP addresses or maybe even ranges somehow.
> Are there some other ways to accomplish this I haven't considered? Right now #2 sounds seems more desirable to me.
> Thanks in advance for your thoughts!
> Chad Mills
> Digital Library Architect
> Ph: 848.932.5924
> Fax: 848.932.1386
> Cell: 732.309.8538
> Rutgers University Libraries
> Scholarly Communication Center
> Room 409D, Alexander Library
> 169 College Avenue, New Brunswick, NJ 08901