本司用的是solr 5.3
今天有個(gè)需求是搜一個(gè)字段里有沒有匹配到這個(gè)內(nèi)容,然后有的話給他一個(gè)值.
solr本身不支持多值(multValued)的字段放在排序(比如cityId_is, is是integer list的意思)
看了文檔發(fā)現(xiàn)有termfreq的方法
termfreq:Returns the number of times the term appears in the field for that document.
這樣 sort就可以寫成 if(termfreq(venueCityId_is,1),200,0) desc