Behzad Pirvali
Behzad Pirvali

Reputation: 784

Solr not returning results

I am very new to Apache Solr and currently trying to understand the concepts. I am using version 6.3. I have created a schema and uploaded a file with a bunch of documents. I do see that 1388 documents are available.

When I put in the q field in the Admin UI "coursetitle:biztalk", I do get the relevant results back but not when I put "biztalk". I thought that I do not need to provide the field name?

Here is the schema:

<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"/>

Upvotes: 0

Views: 1182

Answers (3)

Behzad Pirvali
Behzad Pirvali

Reputation: 784

After doing a little research, it looks like that by using edismax, we can indeed pass a list (space separated) of default fields in df e.g.:

df=courseid coursetitle course-author

This way, we do not need to use the copyField!

Upvotes: 0

Vinod
Vinod

Reputation: 1953

Usually some important fields are copied to field which is used to search default by Solr. So I suggest you use same copyfield

Example:

<defaultSearchField>SEARCHINDEX</defaultSearchField>

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

Now You cane use SEARCHINDEX field to search all other fields content. Since using defaultSearchField is depreciated, your request handler in solrconfig.xml defines "df", which takes precedence.

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

Upvotes: 1

root
root

Reputation: 3957

You need to specify the field unless that you want to search it the default field.

when you do not specify any field solr search in the default Field which you can configure using the following in schema.

<defaultSearchField> coursetitle </defaultSearchField>

So if you put the above in schema.xml and then search for something like biztalk in the query param, solr will search it as coursetitle:biztalk

if you want all your fields to be searched without having to specify a field name , look through Copy Fields

I recommend you to go through this https://wiki.apache.org/solr/SchemaXml to see various fields.

Upvotes: 2

Related Questions