码头集装箱上的 Solr 配置



在我的情况下,索引已经完成,但它没有通过文本搜索给出任何结果。它通过将*:*作为搜索词来显示常规索引数据。

solrconfig.xml :

`<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
  <str name="config">data-config.xml</str>
</lst>
</requestHandler>`

架构.xml :

`<field name="su_id"  type="string" indexed="true" stored="true" required="true"/> 
  <field name="su_url" type="string" indexed="true" stored="true"/>
   <field name="su_path" type="string" indexed="true" stored="true"/>
   <field name="su_actual_url" type="string" indexed="true" stored="true"/>
   <uniqueKey>id</uniqueKey>
   <defaultSearchField>su_path</defaultSearchField>`

数据配置.xml :

`<dataConfig>
  <dataSource type="JdbcDataSource" 
          driver="com.mysql.jdbc.Driver"
          url="jdbc:mysql://localhost:3306/prod_astra" 
          user="root" 
          password="xyz"/>    
  <document name="content">
    <entity name="products" 
        query="select * from search_links">
        <field column="su_id" name="su_id" />
        <field column="su_path" name="id"/>
        <field column="su_url" name="su_url"/>
    <field column="su_actual_url" name="su_actual_url" />
    </entity>
</document>

'

任何帮助将不胜感激。

q=*:*搜索所有文档上的所有内容,因此您可以返回结果。

q=something将在默认搜索字段中搜索某些内容,如果您尚未修改架构.xml,则通常是文本。

<defaultSearchField>text</defaultSearchField>

您可以将默认字段更改为要搜索的字段。或者使用特定字段搜索特定字段,例如 su_url q=su_url:url

如果要搜索多个字段,可以使用 copyfields 或使用 dismax 请求处理程序将这些字段合并为一个字段。

最新更新