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 Craig de Stigter <cr...@koordinates.com> on 2009/04/22 01:16:34 UTC

filtering a query by a set of pk values

Hi

We have a need to filter and rank a queryset outside of solr (its a
specialised spatial search) and then restrict the solr search based on
that filter.

Previously we were doing our filter, then passing a set of primary
keys to solr like so:
q = '(aerial photos) AND (pk:123^1.8 OR pk:163^1.2 OR pk:920^0.73)'

I know it's quite ugly but we are lacking a better alternative. Anyway
that worked when we were using the standard query handler, but we've
now switched to the dismax handler (so we can boost individual fields)
and it no longer works.

The fq parameter looked promising for doing something similar until I
realised that it doesn't seem to do OR queries and it doesn't allow
you to influence the ranking of results.

Can anyone suggest a cleaner way of doing this, or a just-as-ugly way
that works with the dismax handler?

Thanks
Craig de Stigter