How can I search all field in SOLR that contain the keywords,.?

后端 未结 3 756
滥情空心
滥情空心 2020-12-06 11:10

For example, I\'ve keyword for search is: \'Basket Ball\'. What is the query that can get all field that contain the \'Basket Ball\',.? I\'ve tried to using *:Basket Ball, b

相关标签:
3条回答
  • 2020-12-06 11:46

    You need to use a query parser which is able to dispatch tokens to several fields, such as (e)dismax. For exemple if you have two fields field1 and field2: http://solr/select?q={!dismax}Basket Ball&qf=field1^1 field2^1

    See http://wiki.apache.org/solr/DisMaxQParserPlugin#qf_.28Query_Fields.29 for more information on dismax configuration.

    0 讨论(0)
  • 2020-12-06 11:55

    The default search field (since 3.6) is now defined in solrconfig.xml

    e.g. In the solrconfig.xml that ships with Solr configsets directory you will see something like

      <initParams path="/update/**,/query,/select,/tvrh,/elevate,/spell">
        <lst name="defaults">
          <str name="df">allText</str>
        </lst>
      </initParams>
    

    You can change allText to yourDefaultSearchFieldName

    0 讨论(0)
  • 2020-12-06 11:58

    schema.xml defines the default search field -

    <defaultSearchField>text</defaultSearchField>
    

    You can copy all the fields to this default search field.

    <copyField source="field1" dest="text"/>
    <copyField source="field2" dest="text"/>
    <copyField source="field3" dest="text"/>
    

    And query q=basket ball should work.

    0 讨论(0)
提交回复
热议问题