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 Markus Jelsma <ma...@openindex.io> on 2017/12/12 11:54:13 UTC

Pass field value through function for filtering

Hello,

I have a function and a lot of documents, i want to select all documents that give a certain value when i pass a document's field through the function, i just want to filter by function, how?

I am thinking of implementing Collector. Get the docId, make a field look-up and discard if it doesn't pass my function. But i remember from quite some time ago, that doing field look-ups there would be expensive.

Although i don't mind it taking some time (it is for batched work behind our scenes), do you have suggestions?

Also, the last time i had to use a custom collector, i had to hack it into SolrIndexSearcher to use it. Is there any proper way to use a custom collector these days?

Many thanks,
Markus

RE: Pass field value through function for filtering

Posted by Chris Hostetter <ho...@fucit.org>.
https://lucene.apache.org/solr/guide/7_2/other-parsers.html

fq={!frange l=0}your(complex(func(fieldA,fieldB),fieldC))

As of 7.2, frange filters will default to being PostFilters as long as 
you use cache=false ...

https://lucidworks.com/2017/11/27/caching-and-filters-and-post-filters/
https://issues.apache.org/jira/browse/SOLR-11641


: Date: Tue, 12 Dec 2017 12:15:55 +0000
: From: Markus Jelsma <ma...@openindex.io>
: Reply-To: solr-user@lucene.apache.org
: To: "solr-user@lucene.apache.org" <so...@lucene.apache.org>
: Subject: RE: Pass field value through function for filtering
: 
: Forget about it, i just remember PostFilters!
: 
: Thanks!
: Markus
:  
: -----Original message-----
: > From:Markus Jelsma <ma...@openindex.io>
: > Sent: Tuesday 12th December 2017 12:54
: > To: Solr-user <so...@lucene.apache.org>
: > Subject: Pass field value through function for filtering
: > 
: > Hello,
: > 
: > I have a function and a lot of documents, i want to select all documents that give a certain value when i pass a document's field through the function, i just want to filter by function, how?
: > 
: > I am thinking of implementing Collector. Get the docId, make a field look-up and discard if it doesn't pass my function. But i remember from quite some time ago, that doing field look-ups there would be expensive.
: > 
: > Although i don't mind it taking some time (it is for batched work behind our scenes), do you have suggestions?
: > 
: > Also, the last time i had to use a custom collector, i had to hack it into SolrIndexSearcher to use it. Is there any proper way to use a custom collector these days?
: > 
: > Many thanks,
: > Markus
: > 
: 

-Hoss
http://www.lucidworks.com/

RE: Pass field value through function for filtering

Posted by Markus Jelsma <ma...@openindex.io>.
Forget about it, i just remember PostFilters!

Thanks!
Markus
 
-----Original message-----
> From:Markus Jelsma <ma...@openindex.io>
> Sent: Tuesday 12th December 2017 12:54
> To: Solr-user <so...@lucene.apache.org>
> Subject: Pass field value through function for filtering
> 
> Hello,
> 
> I have a function and a lot of documents, i want to select all documents that give a certain value when i pass a document's field through the function, i just want to filter by function, how?
> 
> I am thinking of implementing Collector. Get the docId, make a field look-up and discard if it doesn't pass my function. But i remember from quite some time ago, that doing field look-ups there would be expensive.
> 
> Although i don't mind it taking some time (it is for batched work behind our scenes), do you have suggestions?
> 
> Also, the last time i had to use a custom collector, i had to hack it into SolrIndexSearcher to use it. Is there any proper way to use a custom collector these days?
> 
> Many thanks,
> Markus
>