简体   繁体   English

Apache SOLR和字符串范围搜索

[英]Apache SOLR and string range search

Is possible to search by range on field type 'string'? 可以按字段类型“字符串”的范围进行搜索吗?

fieldString:[A TO B]

or 要么

fieldString:[U-00* TO U-009]

mean that give result with fields where all characters sequences are between A to B or all U-000 between U-009 表示使用所有字符序列在A到B之间或U-009之间的所有U-000的字段给出结果

Now I got some few field with values from U-001, U-002... to U-009 现在我得到一些值从U-001,U-002 ...到U-009的字段

I try: fieldString:[U-00* TO U-009] but this dont work
fieldString:/U-00[0-9]/ and also the same non results

Yes, it is possible. 对的,这是可能的。 But the results may depend on how you analyzed the string in the index. 但是结果可能取决于您如何分析索引中的字符串。 If the string is just A or B, there is no problem; 如果字符串只是A或B,则没有问题; but on some tokenizing you may get all results containing A or B. 但是在进行某些标记时,您可能会得到所有包含A或B的结果。

schema.xml:
<types>
    <fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true" />
    ...
</types>

<fields>
    ...
    <field name="isbn" type="string" indexed="true" stored="true" multiValued="false" />
    ...
</fields>

solrconfig.xml:
<requestHandler class="solr.SearchHandler" name="standard">
</requestHandler>

As you see, there is nothing special. 如您所见,没有什么特别的。 String type is not treated by any filters, but just stored as is. 字符串类型不被任何过滤器处理,而是按原样存储。 And I use the standard query parser. 我使用标准查询解析器。 In this configuration your example works 在此配置中,您的示例有效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM