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 Johannes Ruscheinski <jo...@uni-tuebingen.de> on 2015/04/29 14:11:49 UTC

Custom Scoring Question

Hi,

I am entirely new to the world of SOLR programming and I have the following questions:

In addition to our regular searches we need to implement a specialised form of range search and ranking. We have implemented a CustomScoreQuery and a CustomScoreProvider.  I now have a few questions:

1) Where and how do we let SOLR know that it should use this? (I presume that will be some XML config file.)
2) How do we "tag" our special queries to switch to the custom implementation.

Furthermore, only a small subset of our data will have the database field relevant to this type of query set.  A problem that I can see is that we want SOLR to prefilter, or suppress, any records that have no data in this field and, if the field is non-empty, to call a function provided by us to let it know whether to include said record in the result set or not.

Also, any tips on how to develop and debug this?  I am using the Linux command-line and Emacs.  I am linking against SOLR by using "javac -cp solr-core-4.2.1.jar:. my_code.java".  It is probably not relevant but, I might mention it anyway: We are using SOLR as a part of VuFind.

I'd be greatful for any suggestions.

--Johannes

-- 
Dr. Johannes Ruscheinski
Universitätsbibliothek Tübingen - IT-Abteilung -
Wilhelmstr. 32, 72074 Tübingen

Tel: +49 7071 29-72820
FAX: +49 7071 29-5069
Email: johannes.ruscheinski@uni-tuebingen.de



Re: Antwort: Custom Scoring Question

Posted by Johannes Ruscheinski <jo...@uni-tuebingen.de>.
Hi Stephan,

On 29/04/15 14:37, Stephan Schubert wrote:
> Hi Johannes,
>
> did you have a look on Solr edismax and function queries? 
> https://cwiki.apache.org/confluence/display/solr/Function+Queries
Just read it.
>
> If I got you right, for the case you just want to ignore fields which have 
> not a value set on a specific field you can filter them out with a filter
^^^^^^^^^^^^^^^^^^^^
Yes, that is a part of our problem.
>  
> query.
>
> Example: 
>
> fieldname: mycustomfield
>
> filterquery to ignore docs with mycustomfield not set: +mycustomfield:*

That seems really useful to us and solves one part of our problem,
thanks.  We still need to figure out how to invoke the custom scorer
that we wrote in Java.  Also, we would like the search to invoke another
custom function that filters out results that are not relevant to a
given query.

--Johannes
>
> Regards
>
> Stephan
>
>
>
> Von:    Johannes Ruscheinski <jo...@uni-tuebingen.de>
> An:     solr-user@lucene.apache.org, 
> Kopie:  Oliver Obenland <ol...@uni-tuebingen.de>
> Datum:  29.04.2015 14:10
> Betreff:        Custom Scoring Question
>
>
>
> Hi,
>
> I am entirely new to the world of SOLR programming and I have the 
> following questions:
>
> In addition to our regular searches we need to implement a specialised 
> form of range search and ranking. We have implemented a CustomScoreQuery 
> and a CustomScoreProvider.  I now have a few questions:
>
> 1) Where and how do we let SOLR know that it should use this? (I presume 
> that will be some XML config file.)
> 2) How do we "tag" our special queries to switch to the custom 
> implementation.
>
> Furthermore, only a small subset of our data will have the database field 
> relevant to this type of query set.  A problem that I can see is that we 
> want SOLR to prefilter, or suppress, any records that have no data in this 
> field and, if the field is non-empty, to call a function provided by us to 
> let it know whether to include said record in the result set or not.
>
> Also, any tips on how to develop and debug this?  I am using the Linux 
> command-line and Emacs.  I am linking against SOLR by using "javac -cp 
> solr-core-4.2.1.jar:. my_code.java".  It is probably not relevant but, I 
> might mention it anyway: We are using SOLR as a part of VuFind.
>
> I'd be greatful for any suggestions.
>
> --Johannes
>

-- 
Dr. Johannes Ruscheinski
Universitätsbibliothek Tübingen - IT-Abteilung -
Wilhelmstr. 32, 72074 Tübingen

Tel: +49 7071 29-72820
FAX: +49 7071 29-5069
Email: johannes.ruscheinski@uni-tuebingen.de



Antwort: Custom Scoring Question

Posted by Stephan Schubert <St...@sick.de>.
Hi Johannes,

did you have a look on Solr edismax and function queries? 
https://cwiki.apache.org/confluence/display/solr/Function+Queries

If I got you right, for the case you just want to ignore fields which have 
not a value set on a specific field you can filter them out with a filter 
query.

Example: 

fieldname: mycustomfield

filterquery to ignore docs with mycustomfield not set: +mycustomfield:*

Regards

Stephan



Von:    Johannes Ruscheinski <jo...@uni-tuebingen.de>
An:     solr-user@lucene.apache.org, 
Kopie:  Oliver Obenland <ol...@uni-tuebingen.de>
Datum:  29.04.2015 14:10
Betreff:        Custom Scoring Question



Hi,

I am entirely new to the world of SOLR programming and I have the 
following questions:

In addition to our regular searches we need to implement a specialised 
form of range search and ranking. We have implemented a CustomScoreQuery 
and a CustomScoreProvider.  I now have a few questions:

1) Where and how do we let SOLR know that it should use this? (I presume 
that will be some XML config file.)
2) How do we "tag" our special queries to switch to the custom 
implementation.

Furthermore, only a small subset of our data will have the database field 
relevant to this type of query set.  A problem that I can see is that we 
want SOLR to prefilter, or suppress, any records that have no data in this 
field and, if the field is non-empty, to call a function provided by us to 
let it know whether to include said record in the result set or not.

Also, any tips on how to develop and debug this?  I am using the Linux 
command-line and Emacs.  I am linking against SOLR by using "javac -cp 
solr-core-4.2.1.jar:. my_code.java".  It is probably not relevant but, I 
might mention it anyway: We are using SOLR as a part of VuFind.

I'd be greatful for any suggestions.

--Johannes

-- 
Dr. Johannes Ruscheinski
Universitätsbibliothek Tübingen - IT-Abteilung -
Wilhelmstr. 32, 72074 Tübingen

Tel: +49 7071 29-72820
FAX: +49 7071 29-5069
Email: johannes.ruscheinski@uni-tuebingen.de



 
 
SICK AG - Sitz: Waldkirch i. Br. - Handelsregister: Freiburg i. Br. HRB 
280355 
Vorstand: Dr. Robert Bauer (Vorsitzender)  -  Reinhard Bösl  -  Dr. Mats 
Gökstorp  -  Dr. Martin Krämer  -  Markus Vatter 
Aufsichtsrat: Gisela Sick (Ehrenvorsitzende) - Klaus M. Bukenberger 
(Vorsitzender)