Solr的查询搜索为单一关键字多个实例 [英] Solr query search for multiple instances for single keyword

查看:1259
本文介绍了Solr的查询搜索为单一关键字多个实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我卡在这一个问题。我想要做的是一个多值查询,看看如果一个值出现至少尝试。例如,字段必须是免费,免费,而不仅仅是FREE或自由,IN_USE。

I'm stuck on this one issue. What i want to do is to query on a Multivalued and see if a value comes up at least try. For example the field must be "FREE","FREE" and not just "FREE" or "FREE","IN_USE".

Field 
<field name="point_statusses" type="string" indexed="true" stored="true" multiValued="true" />

Type
<fieldType name="string" class="solr.StrField" sortMissingLast="true" />

SQL
GROUP_CONCAT(cp.status) as point_statusses

澄清:

我有一个具有多个插头的对象,这些都免费,IN_USE或错误状态。我想要做的是对那些有两个插头,状态无过滤器,我不能改变schema.xml中的结构。我该怎么办查询到这个?

I have an object that has multiple plugs and those all have a status of FREE, IN_USE or ERROR. What i want to do is filter on ones that have two plugs with status FREE and I can't change the structure of the schema.xml. How do i query to for this?

推荐答案

不幸的是,它不能被不施加到架构进行任何更改完成,因为solr.StrField不preserve术语频率信息。

Unfortunately, it cannot be done without applying any changes to schema, because solr.StrField does not preserve term frequency information.

从报价 schema.xml中

  ...
  1.2: omitTermFreqAndPositions attribute introduced, true by default 
        except for text fields.
  ...


不过,如果你可以申请一些变化,那么下面的工作(在Solr的4.5.1测试)

1)进行以下修改模式之一:

1) Make one of the following changes to schema:


  • 更改领域text_general(或任何solr.TextField场);

<field name="point_statusses" type="text_general" indexed="true" stored="true" multiValued="true" />


  • 或添加 omitTermFreqAndPositions =FALSE来point_statusses定义:

    • OR add omitTermFreqAndPositions="false" to point_statusses definition:
    • <field name="point_statusses" type="string" indexed="true" stored="true" multiValued="true" omitTermFreqAndPositions="false"/>
      

      2)长期频率滤波器。
      例如:

      2) Filter by term frequency. Examples:

      搜索文件:

      {!frange l=2 u=2}termfreq(point_statusses,'FREE')
      

      或2至3'的免费'point_statusses:

      Or from 2 to 3 'FREE' point_statusses:

      {!frange l=2 u=3}termfreq(point_statusses,'FREE')
      

      最后Solr的查询可能是这样的:

      The final solr query may look like this:

      http://localhost:8983/solr/stack20746538/select?q=*:*&fq={!frange l=2 u=3}termfreq(point_statusses,'FREE')
      

      这篇关于Solr的查询搜索为单一关键字多个实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆