You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Tim Hibbs <ti...@verizon.net> on 2012/01/27 15:37:10 UTC

Why are copyFields necessary here?

Hi, all,

I could use a little education here, if you'd be so kind. My queries
without a field-name qualifier (such as "schedule a pickup", no quotes)
don't return any values UNLESS I've defined copyFields as illustrated
below. The queries work sufficiently well when those fields are defined,
so I sort of have a reasonable fallback position... but I'd like to
understand what's really happening. Any insights are much appreciated.

I'm using SolrJ from solr-3.5.0, and have the following field
definitions in schema.xml:

   <field name="urlpath" type="string" indexed="true" stored="true"/>
   <field name="Title" type="text_en_splitting" indexed="true"
stored="true" omitNorms="false"/>
   <field name="UrlContent" type="text_en_splitting" indexed="true"
stored="false" required="false"/>
   <field name="ContentType" type="string" indexed="true" stored="false"
required="false"/>
   <field name="ApplicableCompanies" type="string" indexed="true"
stored="true" required="true" multiValued="true"/>
   <field name="Keywords" type="text_en_splitting" indexed="true"
stored="false" required="false" multiValued="true" omitNorms="false"/>
   <field name="Overview" type="text_en_splitting" indexed="true"
stored="true" required="false" omitNorms="false"/>
   <field name="RepType" type="string" indexed="true" stored="true"
required="true" multiValued="true"/>
   <field name="Status" type="text_en_splitting" indexed="true"
stored="false" required="false"/>
   <field name="TOC" type="text_en_splitting" indexed="true"
stored="true" required="false" multiValued="true" omitNorms="false"/>
   <field name="Topics" type="string" indexed="true" stored="true"
required="false" multiValued="true"/>

NOTES:
- text_en_splitting hasn't been changed from the value defined in the
example schema.xml with the 3.5.0 distribution...
- <defaultSearchField>text</defaultSearchField> exists as such in the
file...
- field "text" is defined as:
	<field name="text" type="text_en_splitting" indexed="true"
stored="false" multiValued="true"/>
- copyFields are:
	<copyField source="Title" dest="text"/>
	<copyField source="Keywords" dest="text"/>
	<copyField source="TOC" dest="text"/>
	<copyField source="Overview" dest="text"/>
- If it's relevant, I'm boosting Keywords^2.5, Title^2.0, TOC^2.0, and
Overview^1.5 when the index is built.

Thanks,
Tim Hibbs

Re: Why are copyFields necessary here?

Posted by Rafał Kuć <r....@solr.pl>.
Hello!

If you don't specify the field, the query will be made against the
default search field defined in the schema.xml file. So, when the
default search field is empty (no copy fields) then there are no
search results.

-- 
Regards,
 Rafał Kuć

> Hi, all,

> I could use a little education here, if you'd be so kind. My queries
> without a field-name qualifier (such as "schedule a pickup", no quotes)
> don't return any values UNLESS I've defined copyFields as illustrated
> below. The queries work sufficiently well when those fields are defined,
> so I sort of have a reasonable fallback position... but I'd like to
> understand what's really happening. Any insights are much appreciated.

> I'm using SolrJ from solr-3.5.0, and have the following field
> definitions in schema.xml:

>    <field name="urlpath" type="string" indexed="true" stored="true"/>
>    <field name="Title" type="text_en_splitting" indexed="true"
> stored="true" omitNorms="false"/>
>    <field name="UrlContent" type="text_en_splitting" indexed="true"
> stored="false" required="false"/>
>    <field name="ContentType" type="string" indexed="true" stored="false"
required="false"/>>
>    <field name="ApplicableCompanies" type="string" indexed="true"
> stored="true" required="true" multiValued="true"/>
>    <field name="Keywords" type="text_en_splitting" indexed="true"
> stored="false" required="false" multiValued="true" omitNorms="false"/>
>    <field name="Overview" type="text_en_splitting" indexed="true"
> stored="true" required="false" omitNorms="false"/>
>    <field name="RepType" type="string" indexed="true" stored="true"
> required="true" multiValued="true"/>
>    <field name="Status" type="text_en_splitting" indexed="true"
> stored="false" required="false"/>
>    <field name="TOC" type="text_en_splitting" indexed="true"
> stored="true" required="false" multiValued="true" omitNorms="false"/>
>    <field name="Topics" type="string" indexed="true" stored="true"
> required="false" multiValued="true"/>

> NOTES:
> - text_en_splitting hasn't been changed from the value defined in the
> example schema.xml with the 3.5.0 distribution...
> - <defaultSearchField>text</defaultSearchField> exists as such in the
> file...
> - field "text" is defined as:
>         <field name="text" type="text_en_splitting" indexed="true"
> stored="false" multiValued="true"/>
> - copyFields are:
>         <copyField source="Title" dest="text"/>
>         <copyField source="Keywords" dest="text"/>
>         <copyField source="TOC" dest="text"/>
>         <copyField source="Overview" dest="text"/>
> - If it's relevant, I'm boosting Keywords^2.5, Title^2.0, TOC^2.0, and
> Overview^1.5 when the index is built.

> Thanks,
> Tim Hibbs