Is it possible to apply the value of the int solr document field as the boost value if the corresponding field matches?

Ex. 

"docs": [
{
"id": "f37914",
"index_id": "some_index",
"field_1": [
   {
      "Some value",
      "boost": 20.
   }
 ]
},
]

If the field 'field_1' is matched, then activate the corresponding boost field.

0
source share
2 answers

What? document? specific area? You can do any of them. In any case, the way to do this for custom function requests is: https://lucene.apache.org/solr/guide/6_6/function-queries.html#FunctionQueries-AvailableFunctions

For example, if you want to enlarge a document (and if the value does not match, then the score is 0), you can do something like this:

q:_val_:"if(query($q1), field(boost), 0)"&q1=field_1:"Some Value"

_val_ - Solr, query true, q1 , field - , self if .

+1

, , lucence payloads solr 6.6 new " PayloadTokenFilter" .

:

{
 "add-field-type": {
   "name": "terms",
   "stored": "true",
   "class": "solr.TextField",
   "positionIncrementGap": "100",
   "indexAnalyzer": {
     "tokenizer": {
       "class": "solr.KeywordTokenizerFactory"
     },
     "filters": [
       {
         "class": "solr.LowerCaseFilterFactory"
       },
       {
         "class": "solr.DelimitedPayloadTokenFilterFactory",
         "encoder": "float",
         "delimiter": "|"
       }
     ]
   },
   "queryAnalyzer": {
     "tokenizer": {
       "class": "solr.KeywordTokenizerFactory"
     },
     "filters": [
       {
         "class": "solr.LowerCaseFilterFactory"
       },
       {
         "class": "solr.SynonymGraphFilterFactory",
         "ignoreCase": "true",
         "expand": "false",
         "tokenizerFactory": "solr.KeywordTokenizerFactory",
         "synonyms": "synonyms.txt"
       }
     ]
   }
 },

 "add-field" : {
   "name":"terms",
   "type":"terms",
   "stored": "true",
   "multiValued": "true"
 }
}

:

[
  {
    "id" : "1",
    "terms" : [
      "some term|10.0",
      "another term|60.0"
    ]
  }
,
   {
    "id" : "2",
    "terms" : [
      "some term|11.0",
      "another term|21.0"
    ]
  }
]

solr boost :

/solr/payloads/select?indent=on&wt=json&q={!payload_score%20f=ai_terms_wtih_synm_3%20v=$payload_term%20func=max}&fl=id,score&payload_term=some+term
0

All Articles