2012-06-07 100 views
0

在我的情況下,索引已經完成,但沒有通過文本搜索給出任何結果。它以*:*作爲搜索詞顯示了一般索引數據。碼頭容器上的碼錶配置

solrconfig.xml中:

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

schema.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>` 

數據-config.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> 

`

任何幫助將不勝感激。

回答

1

q=*:*搜索所有文檔上的所有內容,因此您可以找回結果。

q=something將搜索默認搜索字段上的內容,如果您尚未修改schema.xml,通常爲文本。

<defaultSearchField>text</defaultSearchField> 

您可以將默認字段更改爲您要搜索的字段。 或使用特定字段在特定字段上搜索例如su_url q = su_url:url

如果要搜索多個字段,可以使用複製字段將這些字段組合到一個字段中,或使用dismax request handler

+0

感謝您的幫助。我想在su_path字段上搜索。它的一個列值是' - >傢俱 - >傢俱 - >特色類別 - >牀和浴室'。我嘗試了q =以上的值,並嘗試用該值的單獨單詞,但響應爲零。 –

+0

確實q = su_path:在家工作? – Jayendra

+0

它不工作。 –