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 Zheng Lin Edwin Yeo <ed...@gmail.com> on 2017/05/25 06:45:33 UTC

Search through all fields in collection

Hi,

I'm using Solr 6.5.1.

Would like to check, is it possible to set a configuration in
solrconfig.xml whereby the search will go through all the fields in the
collections?

Currently, I am defining the fields to be search under the "df" setting,
but unlike "fl", I could not set it to the value "*". The only way which I
can think of currently is to list all the fields under the "df" setting.
However, this doesn't seems like a very good way, so I'm checking if there
are better methods.


    <requestHandler name="/select" startup="lazy"
enable="${solr.clustering.enabled:true}" class="solr.SearchHandler">
    <lst name="defaults">
      <str name="echoParams">none</str>
      <int name="rows">1000</int>
 <str name="wt">json</str>
       <str name="indent">true</str>
  <str name="df">id,content</str>
  <str name="fl">*</str>
    </lst>

Regards,
Edwin

Re: Search through all fields in collection

Posted by Zheng Lin Edwin Yeo <ed...@gmail.com>.
Hi Shawn,

Yes, I couldn't use more than one field for the df parameter.

What I am worried about is the increase of the size of the index, and
affecting overall performance when using copyField, which is why we are not
very keen on using that.

When using dynamic fields for copyField, is it true that we have to copy
all or none of the same type. Meaning if my string is declared as *_s, when
I do a copyField, I have to copy all the fields with source = *_s, and
cannot select which individual fields with _s to copy?

Regards,
Edwin


On 25 May 2017 at 21:00, Shawn Heisey <ap...@elyograg.org> wrote:

> On 5/25/2017 12:45 AM, Zheng Lin Edwin Yeo wrote:
> > Would like to check, is it possible to set a configuration in
> > solrconfig.xml whereby the search will go through all the fields in the
> > collections?
> >
> > Currently, I am defining the fields to be search under the "df" setting,
> > but unlike "fl", I could not set it to the value "*". The only way which
> I can think of currently is to list all the fields under the "df" setting.
> However, this doesn't seems like a very good way, so I'm checking if there
> are better methods.
>
> As far as I'm aware, the df parameter (default field) can only take one
> field.  I have never seen any ability to use more than one field there.
> If that actually works, then it is functionality that I've never seen.
>
> If you switch to the dismax or edismax query parser, then you can list
> multiple fields in the qf, pf, pf2, and pf3 parameters, but even then,
> Solr does not provide a simple way to specify all fields.  You can
> specify them all, but you have to do so one by one.
>
> Searching all fields is usually very expensive anyway.
>
> The method that Rick gave you, of copying all fields into a single field
> that you can specify as the default field, is one way to do it, but be
> aware that if you choose this method, every term will be analyzed in
> exactly the same way.  This may not be what you want.  It also can
> greatly increase the size of the index, affecting overall performance.
>
> Thanks,
> Shawn
>
>

Re: Search through all fields in collection

Posted by Shawn Heisey <ap...@elyograg.org>.
On 5/25/2017 12:45 AM, Zheng Lin Edwin Yeo wrote:
> Would like to check, is it possible to set a configuration in
> solrconfig.xml whereby the search will go through all the fields in the
> collections?
>
> Currently, I am defining the fields to be search under the "df" setting,
> but unlike "fl", I could not set it to the value "*". The only way which I can think of currently is to list all the fields under the "df" setting. However, this doesn't seems like a very good way, so I'm checking if there are better methods.

As far as I'm aware, the df parameter (default field) can only take one
field.  I have never seen any ability to use more than one field there. 
If that actually works, then it is functionality that I've never seen.

If you switch to the dismax or edismax query parser, then you can list
multiple fields in the qf, pf, pf2, and pf3 parameters, but even then,
Solr does not provide a simple way to specify all fields.  You can
specify them all, but you have to do so one by one.

Searching all fields is usually very expensive anyway.

The method that Rick gave you, of copying all fields into a single field
that you can specify as the default field, is one way to do it, but be
aware that if you choose this method, every term will be analyzed in
exactly the same way.  This may not be what you want.  It also can
greatly increase the size of the index, affecting overall performance.

Thanks,
Shawn


Re: Search through all fields in collection

Posted by Zheng Lin Edwin Yeo <ed...@gmail.com>.
Hi Rick,

Thanks for the advice.

Regards,
Edwin


On 25 May 2017 at 15:11, Rick Leir <rl...@leirtech.com> wrote:

> Edwin,
>
> Use copyfield to copy all fields to one field, which could be your default
> field. This is a common pattern in Solr installations.
>
> cheers -- Rick
>
> https://cwiki.apache.org/confluence/display/solr/Copying+Fields
> https://drupal.stackexchange.com/questions/54538/search-api-
> solr-how-to-index-fulltext-fields-with-and-without-stemming
>
>
> On 2017-05-25 02:45 AM, Zheng Lin Edwin Yeo wrote:
>
>> Hi,
>> I'm using Solr 6.5.1.
>>
>> Would like to check, is it possible to set a configuration in
>> solrconfig.xml whereby the search will go through all the fields in the
>> collections?
>>
>> Currently, I am defining the fields to be search under the "df" setting,
>> but unlike "fl", I could not set it to the value "*". The only way which I
>> can think of currently is to list all the fields under the "df" setting.
>> However, this doesn't seems like a very good way, so I'm checking if there
>> are better methods.
>>
>>      <requestHandler name="/select" startup="lazy"
>> enable="${solr.clustering.enabled:true}" class="solr.SearchHandler">
>>      <lst name="defaults">
>>        <str name="echoParams">none</str>
>>        <int name="rows">1000</int>
>>   <str name="wt">json</str>
>>         <str name="indent">true</str>
>>    <str name="df">id,content</str>
>>    <str name="fl">*</str>
>>
>
>

Re: Search through all fields in collection

Posted by Rick Leir <rl...@leirtech.com>.
Edwin,

Use copyfield to copy all fields to one field, which could be your 
default field. This is a common pattern in Solr installations.

cheers -- Rick

https://cwiki.apache.org/confluence/display/solr/Copying+Fields
https://drupal.stackexchange.com/questions/54538/search-api-solr-how-to-index-fulltext-fields-with-and-without-stemming

On 2017-05-25 02:45 AM, Zheng Lin Edwin Yeo wrote:
> Hi,
> I'm using Solr 6.5.1.
>
> Would like to check, is it possible to set a configuration in
> solrconfig.xml whereby the search will go through all the fields in the
> collections?
>
> Currently, I am defining the fields to be search under the "df" setting,
> but unlike "fl", I could not set it to the value "*". The only way which I
> can think of currently is to list all the fields under the "df" setting.
> However, this doesn't seems like a very good way, so I'm checking if there
> are better methods.
>
>      <requestHandler name="/select" startup="lazy"
> enable="${solr.clustering.enabled:true}" class="solr.SearchHandler">
>      <lst name="defaults">
>        <str name="echoParams">none</str>
>        <int name="rows">1000</int>
>   <str name="wt">json</str>
>         <str name="indent">true</str>
>    <str name="df">id,content</str>
>    <str name="fl">*</str>