lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Christensen <>
Subject Re: Newbie Q: searching multiple fields
Date Mon, 02 Jun 2008 18:40:29 GMT

As a nearly ex-newbie you are experiencing some similar things I did.  
If you are using the default set-up of Solr, make sure in your  
schema.xml you are indexing the fields you want to search, at least  
for now, as text fields. One way you can scale this easily for  
example if your schema defines a field as a string - and this is one  
of the ones not searchable, do this:

So perhaps your schema looks like this now:

<field name="id" type="string" indexed="true" stored="true"/>
<field name="name" type="string" indexed="true" stored="true"/>
<field name="description" type="text" indexed="true" stored="true"/>

Make sure at least your indexed=true on fields you want to search.  
However if you want name to be searched, you can either:

  <field name="default_search_field" type="text" indexed="true"  
stored="false" multiValued="true"/>

<copyField source="name" dest="default_search_field"/>
<copyField source="description" dest="default_search_field"/>

Make your search just on the default_search_field using dismax for  

OR what I did (sort of):

<field name="id" type="string" indexed="true" stored="true"/>
<field name="name" type="string" indexed="false" stored="true"/>  
(Note the false on indexed)
<field name="name_text" type="text" indexed="true" stored="false"/>  
(Note the true on indexed)
<field name="description" type="string" indexed="false" stored="true"/>
<field name="description_text" type="text" indexed="true"  

(The text versions are for boosting purposes only - not for display)

<field name="default_search_field" type="text" indexed="true"  
stored="false" multiValued="true"/>

(Note the false on stored - you do not need this stored)

<copyField source="name" dest="default_search_field"/>
<copyField source="description" dest="default_search_field"/>

(I still copy the fields into a main search block of text)

<requestHandler name="dismax" class="solr.DisMaxRequestHandler" >
     <lst name="defaults">
      <str name="echoParams">explicit</str>
      <str name="qf">
         default_search_field^0.5 name_text^2.0 description_text^1.5
      </str> ......

Ultimately, I would recommend you use the dynamic fields perspective  
- it makes for a much cleaner schema and config and is easier to scale.


On Jun 2, 2008, at 11:53 AM, Jon Drukman wrote:

> I am brand new to Solr.  I am trying to get a very simple setup  
> running.  I've got just a few fields: name, description, tags.  I  
> am only able to search on the default field (name) however.  I  
> tried to set up the dismax config to search all the fields, but I  
> never get any results on the other fields.  Example doc:
> <doc>
>   <field name="id">318</field>
>   <field name="name">Testing the new system</field>
>   <field name="description">Here is the very descriptive  
> description</field>
>   <field name="user">jsd</field>
>   <field name="tags"></field>
>   <field name="date">2008-05-16T05:05:10Z</field>
> </doc>
> q=system finds this doc.
> q=descriptive does not.
> q=descriptive&qt=dismax does not
> q=descriptive&qt=dismax&qf=description does not
> my solrconfig contains:
>  <requestHandler name="dismax" class="solr.DisMaxRequestHandler" >
>     <lst name="defaults">
>      <str name="echoParams">explicit</str>
>      <float name="tie">0.01</float>
>      <str name="qf">
>         name^2 description^1.5 tags^0.8
>      </str>
>      <str name="pf">
>         name^2 description^2 tags^1
>      </str>
>      <int name="ps">100</int>
>      <str name="q.alt">*:*</str>
>     </lst>
>   </requestHandler>
> What am I missing?
> -jsd-

Tim Christensen
Director Media & Technology
Vann's Inc.

View raw message