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 Lakshmi Bhargavi <la...@gmail.com> on 2012/07/20 21:18:37 UTC

Search results not returned for a str field

Hi ,

I have the following configuration 
<?xml version="1.0" ?>


<schema name="example core zero" version="1.1">
  <types>
   <fieldtype name="string"  class="solr.StrField" sortMissingLast="true"
omitNorms="true"/>
  </types>

 <fields>   
  
  <field name="id"      type="string"   indexed="true"  stored="true" 
multiValued="false" required="true"/>
  <field name="type"    type="string"   indexed="true"  stored="true" 
multiValued="false" /> 
  <field name="name"    type="string"   indexed="true"  stored="true" 
multiValued="false" /> 
  <field name="core0"   type="string"   indexed="true"  stored="true" 
multiValued="false" /> 
 </fields>

 
 <uniqueKey>id</uniqueKey>

 
 <defaultSearchField>name</defaultSearchField>

 
 <solrQueryParser defaultOperator="OR"/>
</schema>

I am also attaching the solr config file
http://lucene.472066.n3.nabble.com/file/n3996313/solrconfig.xml
solrconfig.xml 

I indexed a document

<add><doc>
  <field name="id">MA147LL/A</field>
  <field name="name">Apple 60 GB iPod with Video Playback Black</field>

</doc></add>

When I do a wildcard search , the results are returned
http://localhost:8983/solr/select?q=*:*

  <?xml version="1.0" encoding="UTF-8" ?> 
- <response>
- <lst name="responseHeader">
  <int name="status">0</int> 
  <int name="QTime">1</int> 
  </lst>
- <result name="response" numFound="1" start="0">
- <doc>
  <str name="id">MA147LL/A</str> 
  <str name="name">Apple 60 GB iPod with Video Playback Black</str> 
  </doc>
  </result>
  </response>


but the results are not returned for specific query
http://localhost:8983/solr/core0/select?q=iPod 

<?xml version="1.0" encoding="UTF-8" ?> 
- <response>
- <lst name="responseHeader">
  <int name="status">0</int> 
  <int name="QTime">5</int> 
  </lst>
  <result name="response" numFound="0" start="0" /> 
  </response>

Could some one please let me know what is wrong? Also would be very helpful
if some one can explain the significance of the defaultsearch field.

Thanks,
lakshmi




--
View this message in context: http://lucene.472066.n3.nabble.com/Search-results-not-returned-for-a-str-field-tp3996313.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Search results not returned for a str field

Posted by Dikchant Sahi <co...@gmail.com>.
DefaultSearchField is the field which is queried if you don't explicitly
specify the fields to query on.

Please refer to the below link:
http://wiki.apache.org/solr/SchemaXml

On Sat, Jul 21, 2012 at 12:56 AM, Michael Della Bitta <
michael.della.bitta@appinions.com> wrote:

> Hello, Lakshmi,
>
> The issue is the fieldType you've assigned to the fields in your
> schema does not perform any analysis on the string before indexing it.
> So it will only do exact matches. If you want to do matches against
> portions of the field value, use one of the "text" types that come in
> the default schema.
>
> Michael Della Bitta
>
> ------------------------------------------------
> Appinions, Inc. -- Where Influence Isn’t a Game.
> http://www.appinions.com
>
>
> On Fri, Jul 20, 2012 at 3:18 PM, Lakshmi Bhargavi
> <la...@gmail.com> wrote:
> > Hi ,
> >
> > I have the following configuration
> > <?xml version="1.0" ?>
> >
> >
> > <schema name="example core zero" version="1.1">
> >   <types>
> >    <fieldtype name="string"  class="solr.StrField" sortMissingLast="true"
> > omitNorms="true"/>
> >   </types>
> >
> >  <fields>
> >
> >   <field name="id"      type="string"   indexed="true"  stored="true"
> > multiValued="false" required="true"/>
> >   <field name="type"    type="string"   indexed="true"  stored="true"
> > multiValued="false" />
> >   <field name="name"    type="string"   indexed="true"  stored="true"
> > multiValued="false" />
> >   <field name="core0"   type="string"   indexed="true"  stored="true"
> > multiValued="false" />
> >  </fields>
> >
> >
> >  <uniqueKey>id</uniqueKey>
> >
> >
> >  <defaultSearchField>name</defaultSearchField>
> >
> >
> >  <solrQueryParser defaultOperator="OR"/>
> > </schema>
> >
> > I am also attaching the solr config file
> > http://lucene.472066.n3.nabble.com/file/n3996313/solrconfig.xml
> > solrconfig.xml
> >
> > I indexed a document
> >
> > <add><doc>
> >   <field name="id">MA147LL/A</field>
> >   <field name="name">Apple 60 GB iPod with Video Playback Black</field>
> >
> > </doc></add>
> >
> > When I do a wildcard search , the results are returned
> > http://localhost:8983/solr/select?q=*:*
> >
> >   <?xml version="1.0" encoding="UTF-8" ?>
> > - <response>
> > - <lst name="responseHeader">
> >   <int name="status">0</int>
> >   <int name="QTime">1</int>
> >   </lst>
> > - <result name="response" numFound="1" start="0">
> > - <doc>
> >   <str name="id">MA147LL/A</str>
> >   <str name="name">Apple 60 GB iPod with Video Playback Black</str>
> >   </doc>
> >   </result>
> >   </response>
> >
> >
> > but the results are not returned for specific query
> > http://localhost:8983/solr/core0/select?q=iPod
> >
> > <?xml version="1.0" encoding="UTF-8" ?>
> > - <response>
> > - <lst name="responseHeader">
> >   <int name="status">0</int>
> >   <int name="QTime">5</int>
> >   </lst>
> >   <result name="response" numFound="0" start="0" />
> >   </response>
> >
> > Could some one please let me know what is wrong? Also would be very
> helpful
> > if some one can explain the significance of the defaultsearch field.
> >
> > Thanks,
> > lakshmi
> >
> >
> >
> >
> > --
> > View this message in context:
> http://lucene.472066.n3.nabble.com/Search-results-not-returned-for-a-str-field-tp3996313.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Search results not returned for a str field

Posted by Michael Della Bitta <mi...@appinions.com>.
Hello, Lakshmi,

The issue is the fieldType you've assigned to the fields in your
schema does not perform any analysis on the string before indexing it.
So it will only do exact matches. If you want to do matches against
portions of the field value, use one of the "text" types that come in
the default schema.

Michael Della Bitta

------------------------------------------------
Appinions, Inc. -- Where Influence Isn’t a Game.
http://www.appinions.com


On Fri, Jul 20, 2012 at 3:18 PM, Lakshmi Bhargavi
<la...@gmail.com> wrote:
> Hi ,
>
> I have the following configuration
> <?xml version="1.0" ?>
>
>
> <schema name="example core zero" version="1.1">
>   <types>
>    <fieldtype name="string"  class="solr.StrField" sortMissingLast="true"
> omitNorms="true"/>
>   </types>
>
>  <fields>
>
>   <field name="id"      type="string"   indexed="true"  stored="true"
> multiValued="false" required="true"/>
>   <field name="type"    type="string"   indexed="true"  stored="true"
> multiValued="false" />
>   <field name="name"    type="string"   indexed="true"  stored="true"
> multiValued="false" />
>   <field name="core0"   type="string"   indexed="true"  stored="true"
> multiValued="false" />
>  </fields>
>
>
>  <uniqueKey>id</uniqueKey>
>
>
>  <defaultSearchField>name</defaultSearchField>
>
>
>  <solrQueryParser defaultOperator="OR"/>
> </schema>
>
> I am also attaching the solr config file
> http://lucene.472066.n3.nabble.com/file/n3996313/solrconfig.xml
> solrconfig.xml
>
> I indexed a document
>
> <add><doc>
>   <field name="id">MA147LL/A</field>
>   <field name="name">Apple 60 GB iPod with Video Playback Black</field>
>
> </doc></add>
>
> When I do a wildcard search , the results are returned
> http://localhost:8983/solr/select?q=*:*
>
>   <?xml version="1.0" encoding="UTF-8" ?>
> - <response>
> - <lst name="responseHeader">
>   <int name="status">0</int>
>   <int name="QTime">1</int>
>   </lst>
> - <result name="response" numFound="1" start="0">
> - <doc>
>   <str name="id">MA147LL/A</str>
>   <str name="name">Apple 60 GB iPod with Video Playback Black</str>
>   </doc>
>   </result>
>   </response>
>
>
> but the results are not returned for specific query
> http://localhost:8983/solr/core0/select?q=iPod
>
> <?xml version="1.0" encoding="UTF-8" ?>
> - <response>
> - <lst name="responseHeader">
>   <int name="status">0</int>
>   <int name="QTime">5</int>
>   </lst>
>   <result name="response" numFound="0" start="0" />
>   </response>
>
> Could some one please let me know what is wrong? Also would be very helpful
> if some one can explain the significance of the defaultsearch field.
>
> Thanks,
> lakshmi
>
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Search-results-not-returned-for-a-str-field-tp3996313.html
> Sent from the Solr - User mailing list archive at Nabble.com.