2017-01-02 137 views
0

我對Apache Solr非常陌生,目前正試圖理解這些概念。我正在使用6.3版本。我創建了一個模式,並用一堆文件上傳了一個文件。我確實看到有1388份文件可用。Solr不返回結果

當我把在Q場管理UI「coursetitle:的BizTalk」,我得到的相關結果反饋而不是當我把「的BizTalk」。我認爲我不需要提供字段名稱?

這裏是架構:

<field name="courseid" type="string" indexed="true" stored="true" required="true" multiValued="false" /> 
<field name="coursetitle" type="text_general" indexed="true" stored="true" multiValued="false"/> 
<field name="coursetitlesearch" type="text_general" indexed="true" stored="true" multiValued="false"/> 
<field name="durationinseconds" type="int" indexed="true" stored="true" /> 
<field name="releasedate" type="date" indexed="true" stored="true"/> 

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

<field name="assessmentstatus" type="text_general" indexed="true" stored="true"/> 
<field name="iscourseretired" type="text_general" indexed="true" stored="true"/> 
<field name="tag" type="string" multiValued="true" indexed="true" stored="true"/> 
<field name="course-author" type="string" multiValued="true" indexed="true" stored="true"/> 
+0

是整個架構? – root545

+0

在我的領域,是的 –

回答

2

您需要指定,除非您要搜索成爲默認域的域。

,當你不指定在其中您可以配置使用的模式下默認的字段的任何字段Solr的搜索。如果你把上面的schema.xml中,然後搜索類似 biztalk在查詢參數

<defaultSearchField> coursetitle </defaultSearchField> 

所以,Solr的將搜索作爲coursetitle:biztalk

,如果你希望搜索所有的字段,而不得不指定一個字段名稱,看看通過Copy Fields

我建議你通過這個https://wiki.apache.org/solr/SchemaXml去看到各個領域。

+0

非常感謝你和遺憾轉達的答覆。你是對的。儘管如此,defaultSearchField已被取消。所以,我最終將df添加到資源管理器中,然後我必須使用copyField在所有字段中進行solr搜索。這就是說,在我看來,這種解決方案並不理想,因爲它會複製數據。理想情況下,每個字段都應該有一個屬性,如'default-search = true',或者resourcehandler應該有一個默認設置,如 field-1,field-2,...,你不同意嗎? –

1

通常一些重要領域被複制到其使用Solr的搜索默認字段。所以,我建議你使用相同的copyfield

例子:

<defaultSearchField>SEARCHINDEX</defaultSearchField> 

<copyField source="AUTHOR" dest="SEARCHINDEX"/> 
<copyField source="coursetitle" dest="SEARCHINDEX"/> 
<copyField source="coursetitlesearch" dest="SEARCHINDEX"/> 
<copyField source="SUBTITLE" dest="SEARCHINDEX"/> 

現在您甘蔗使用SEARCHINDEX欄來搜索所有其他字段的內容。 由於使用defaultSearchField已折舊,因此您的solrconfig.xml中的請求處理程序定義了"df",這優先。

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

非常感謝您的回覆,感謝您的回覆。你是對的。 defaultSearchField已被取消。所以,我最終將df添加到資源管理器中,然後我必須使用copyField在所有字段中進行solr搜索。這就是說,在我看來,解決方案並不理想,因爲它會複製數據。理想情況下,每個字段都應該有一個屬性,如'default-search = true',或者resourcehandler應該有一個默認設置,如 field-1,field-2,...,你不同意嗎? –

0

做了一些研究之後,它看起來就像是用edismax,我們確實可以通過默認的字段列表(用空格隔開)的DF如:

df=courseid coursetitle course-author 

通過這種方式,我們做的不需要使用copyField!

+1

你是對的。使用dismax/edismax'qf = courseid coursetitle course-author'的查詢字段qf參數,您還可以用不同的值提升您的字段。例如:'qf = courseid^2.0 coursetitle^10.0 course-author^3.0' – vinod