Package org.apache.solr.ltr.feature
Class SolrFeature
- java.lang.Object
-
- org.apache.lucene.search.Query
-
- org.apache.solr.ltr.feature.Feature
-
- org.apache.solr.ltr.feature.SolrFeature
-
- All Implemented Interfaces:
org.apache.lucene.util.Accountable
public class SolrFeature extends Feature
This feature allows you to reuse any Solr query as a feature. The value of the feature will be the score of the given query for the current document. See Solr documentation of other parsers you can use as a feature. Example configurations:[ { "name": "isBook", "class": "org.apache.solr.ltr.feature.SolrFeature", "params":{ "fq": ["{!terms f=category}book"] } }, { "name": "documentRecency", "class": "org.apache.solr.ltr.feature.SolrFeature", "params": { "q": "{!func}recip( ms(NOW,publish_date), 3.16e-11, 1, 1)" } } ]
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
SolrFeature.SolrFeatureWeight
Weight for a SolrFeature-
Nested classes/interfaces inherited from class org.apache.solr.ltr.feature.Feature
Feature.FeatureWeight
-
-
Constructor Summary
Constructors Constructor Description SolrFeature(String name, Map<String,Object> params)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Feature.FeatureWeight
createWeight(org.apache.lucene.search.IndexSearcher searcher, boolean needsScores, SolrQueryRequest request, org.apache.lucene.search.Query originalQuery, Map<String,String[]> efi)
String
getDf()
List<String>
getFq()
String
getQ()
LinkedHashMap<String,Object>
paramsToMap()
void
setDf(String df)
void
setFq(List<String> fq)
void
setQ(String q)
protected void
validate()
As part of creation of a feature instance, this function confirms that the feature parameters are valid.-
Methods inherited from class org.apache.solr.ltr.feature.Feature
defaultParamsToMap, equals, getDefaultValue, getIndex, getInstance, getName, hashCode, ramBytesUsed, setDefaultValue, setIndex, toString, visit
-
Methods inherited from class org.apache.lucene.search.Query
classHash, createWeight, rewrite, sameClassAs, toString
-
-
-
-
Method Detail
-
getDf
public String getDf()
-
setDf
public void setDf(String df)
-
getQ
public String getQ()
-
setQ
public void setQ(String q)
-
paramsToMap
public LinkedHashMap<String,Object> paramsToMap()
- Specified by:
paramsToMap
in classFeature
-
createWeight
public Feature.FeatureWeight createWeight(org.apache.lucene.search.IndexSearcher searcher, boolean needsScores, SolrQueryRequest request, org.apache.lucene.search.Query originalQuery, Map<String,String[]> efi) throws IOException
- Specified by:
createWeight
in classFeature
- Throws:
IOException
-
validate
protected void validate() throws FeatureException
Description copied from class:Feature
As part of creation of a feature instance, this function confirms that the feature parameters are valid.- Specified by:
validate
in classFeature
- Throws:
FeatureException
- Feature Exception
-
-