开发者

Solr : what is the syntax for "LIKE" on filters (fq)

开发者 https://www.devze.com 2023-02-17 05:52 出处:网络
In my SOLR, i have indexed the开发者_开发知识库 keys (converted to string because the array wasn\'t saving) of the group which have the permission to display the object.

In my SOLR, i have indexed the开发者_开发知识库 keys (converted to string because the array wasn't saving) of the group which have the permission to display the object.

<visibility>
6-15-8
</visibility>

'fq' => "current_status_i:".Ressource::STATUS_PUBLISHED ." + lang_t:".$culture. "+ visibility_s".$visibility

The problem is that if the input for visibility is 15 it'll output 0 result because it does not match 6-15-8.

So , *what is the syntax to mimic the "LIKE" * in order to have result if the input is 15, or 8....

Thanks


You need to use multi-valued fields in Solr - they allow you to store multiple values for the same field. Check this and this for more details. Alternately, you can change the field type to ensure that the field is tokenized on - so that each value gets indexed separately.

Let me know how exactly you create the index and post your schema.xml. I will then be able to give you some more details about adding multi-valued fields to your index.


There are two options

  1. Range query: fq=visibility:[1 To 15]
  2. OR conditions: fq=visibility:6 OR 15 OR 8, (If you know these are the only 3 valid values in your system)
0

精彩评论

暂无评论...
验证码 换一张
取 消