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 regany <re...@newzealand.co.nz> on 2009/12/08 04:44:29 UTC

why no results?

hi all - newbie solr question - I've indexed some documents and can search /
receive results using the following schema - BUT ONLY when searching on the
"id" field. If I try searching on the title, subtitle, body or text field I
receive NO results. Very confused. :confused: Can anyone see anything
obvious I'm doing wrong???? Regan.



<?xml version="1.0" ?>

<schema name="core0" version="1.1">

<types>
        <fieldtype name="string" class="solr.StrField"
sortMissingLast="true" omitNorms="true" />
</types>

 <fields>
<!-- general -->
        <field  name="id" type="string" indexed="true" stored="true"
multiValued="false" required="true" />
        <field name="title" type="string" indexed="true" stored="true"
multiValued="false" />
        <field name="subtitle" type="string" indexed="true" stored="true"
multiValued="false" />
        <field name="body" type="string" indexed="true" stored="true"
multiValued="false" />
        <field name="text" type="string" indexed="true" stored="false"
multiValued="true" />
 </fields>

 <!-- field to use to determine and enforce document uniqueness. -->
 <uniqueKey>id</uniqueKey>

 <!-- field for the QueryParser to use when an explicit fieldname is absent
-->
 <defaultSearchField>text</defaultSearchField>

 <!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
 <solrQueryParser defaultOperator="OR"/>

 <!-- copyFields group fields into one single searchable indexed field for
speed.  -->
<copyField source="title" dest="text" />
<copyField source="subtitle" dest="text" />
<copyField source="body" dest="text" />

</schema>

-- 
View this message in context: http://old.nabble.com/why-no-results--tp26688249p26688249.html
Sent from the Solr - User mailing list archive at Nabble.com.


RE: why no results?

Posted by Jaco Olivier <ja...@sabinet.co.za>.
Hi Regan,

I am using STRING fields only for values that in most cases will be used
to FACET on..
I suggest using TEXT fields as per the default examples...

ALSO, remember that if you do not specify the "
solr.LowerCaseFilterFactory " that your search has just become case
sensitive.. I struggled with that one before, so make sure what you are
indexing is what you are searching for.
* Stick to the default examples that is provided with the SOLR distro
and you should be fine.

    <fieldType name="text" class="solr.TextField"
positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <!-- in this example, we will only use synonyms at query time
        <filter class="solr.SynonymFilterFactory"
synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
        -->
        <!-- Case insensitive stop word removal.
             enablePositionIncrements=true ensures that a 'gap' is left
to
             allow for accurate phrase queries.
        -->
        <filter class="solr.StopFilterFactory"
                ignoreCase="true"
                words="stopwords.txt"
                enablePositionIncrements="true"
                />
        <filter class="solr.WordDelimiterFilterFactory"
generateWordParts="1" generateNumberParts="1" catenateWords="1"
catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.EnglishPorterFilterFactory"
protected="protwords.txt"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.SynonymFilterFactory"
synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt"/>
        <filter class="solr.WordDelimiterFilterFactory"
generateWordParts="1" generateNumberParts="1" catenateWords="0"
catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.EnglishPorterFilterFactory"
protected="protwords.txt"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
      </analyzer>
    </fieldType>

Jaco Olivier

-----Original Message-----
From: regany [mailto:regan@newzealand.co.nz] 
Sent: 08 December 2009 06:15
To: solr-user@lucene.apache.org
Subject: Re: why no results?



Tom Hill-7 wrote:
> 
> Try solr.TextField instead.
> 


Thanks Tom,

I've replaced the <types> section above with...

<types>
        <fieldtype name="string" class="solr.TextField"
sortMissingLast="true" omitNorms="true" />
</types>


deleted my index, restarted Solr and re-indexed my documents - but the
search still returns nothing.

Do I need to change the type in the <fields> sections as well?

regan
-- 
View this message in context:
http://old.nabble.com/why-no-results--tp26688249p26688469.html
Sent from the Solr - User mailing list archive at Nabble.com.

Please consider the environment before printing this email. This 
transmission is for the intended addressee only and is confidential 
information. If you have received this transmission in error, please 
delete it and notify the sender. The content of this e-mail is the 
opinion of the writer only and is not endorsed by Sabinet Online Limited 
unless expressly stated otherwise.

Re: why no results?

Posted by regany <re...@newzealand.co.nz>.

Tom Hill-7 wrote:
> 
> Try solr.TextField instead.
> 


Thanks Tom,

I've replaced the <types> section above with...

<types>
        <fieldtype name="string" class="solr.TextField"
sortMissingLast="true" omitNorms="true" />
</types>


deleted my index, restarted Solr and re-indexed my documents - but the
search still returns nothing.

Do I need to change the type in the <fields> sections as well?

regan
-- 
View this message in context: http://old.nabble.com/why-no-results--tp26688249p26688469.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: why no results?

Posted by Tom Hill <so...@worldware.com>.
Sorry, just discovered a keyboard shortcut for "send". :-)

That's a common one to get bit by. The fieldtype StrField indexes the entire
field as one item. So you can only find it if your search term is everything
in the field. That is, "fox" will not find "The Quick Brown Fox", because
it's not the whole field.

The ID field probably works because it has one term in it. "1" finds "1"
just fine.

Try solr.TextField instead.

Tom


On Mon, Dec 7, 2009 at 7:47 PM, Tom Hill <so...@worldware.com> wrote:

> Hi -
>
> That's a common one to get bit by. The string
>
>
> On Mon, Dec 7, 2009 at 7:44 PM, regany <re...@newzealand.co.nz> wrote:
>
>>
>> hi all - newbie solr question - I've indexed some documents and can search
>> /
>> receive results using the following schema - BUT ONLY when searching on
>> the
>> "id" field. If I try searching on the title, subtitle, body or text field
>> I
>> receive NO results. Very confused. :confused: Can anyone see anything
>> obvious I'm doing wrong???? Regan.
>>
>>
>>
>> <?xml version="1.0" ?>
>>
>> <schema name="core0" version="1.1">
>>
>> <types>
>>        <fieldtype name="string" class="solr.StrField"
>> sortMissingLast="true" omitNorms="true" />
>> </types>
>>
>>  <fields>
>> <!-- general -->
>>        <field  name="id" type="string" indexed="true" stored="true"
>> multiValued="false" required="true" />
>>        <field name="title" type="string" indexed="true" stored="true"
>> multiValued="false" />
>>        <field name="subtitle" type="string" indexed="true" stored="true"
>> multiValued="false" />
>>        <field name="body" type="string" indexed="true" stored="true"
>> multiValued="false" />
>>        <field name="text" type="string" indexed="true" stored="false"
>> multiValued="true" />
>>  </fields>
>>
>>  <!-- field to use to determine and enforce document uniqueness. -->
>>  <uniqueKey>id</uniqueKey>
>>
>>  <!-- field for the QueryParser to use when an explicit fieldname is
>> absent
>> -->
>>  <defaultSearchField>text</defaultSearchField>
>>
>>  <!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
>>  <solrQueryParser defaultOperator="OR"/>
>>
>>  <!-- copyFields group fields into one single searchable indexed field for
>> speed.  -->
>> <copyField source="title" dest="text" />
>> <copyField source="subtitle" dest="text" />
>> <copyField source="body" dest="text" />
>>
>> </schema>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/why-no-results--tp26688249p26688249.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>>
>

Re: why no results?

Posted by regany <re...@newzealand.co.nz>.

Tom Hill-7 wrote:
> 
> That's a common one to get bit by. The string
> 


You lost me Tom? I Think your message got cut off. I'm guessing something to
do with the "string" type??
-- 
View this message in context: http://old.nabble.com/why-no-results--tp26688249p26688295.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: why no results?

Posted by Tom Hill <so...@worldware.com>.
Hi -

That's a common one to get bit by. The string

On Mon, Dec 7, 2009 at 7:44 PM, regany <re...@newzealand.co.nz> wrote:

>
> hi all - newbie solr question - I've indexed some documents and can search
> /
> receive results using the following schema - BUT ONLY when searching on the
> "id" field. If I try searching on the title, subtitle, body or text field I
> receive NO results. Very confused. :confused: Can anyone see anything
> obvious I'm doing wrong???? Regan.
>
>
>
> <?xml version="1.0" ?>
>
> <schema name="core0" version="1.1">
>
> <types>
>        <fieldtype name="string" class="solr.StrField"
> sortMissingLast="true" omitNorms="true" />
> </types>
>
>  <fields>
> <!-- general -->
>        <field  name="id" type="string" indexed="true" stored="true"
> multiValued="false" required="true" />
>        <field name="title" type="string" indexed="true" stored="true"
> multiValued="false" />
>        <field name="subtitle" type="string" indexed="true" stored="true"
> multiValued="false" />
>        <field name="body" type="string" indexed="true" stored="true"
> multiValued="false" />
>        <field name="text" type="string" indexed="true" stored="false"
> multiValued="true" />
>  </fields>
>
>  <!-- field to use to determine and enforce document uniqueness. -->
>  <uniqueKey>id</uniqueKey>
>
>  <!-- field for the QueryParser to use when an explicit fieldname is absent
> -->
>  <defaultSearchField>text</defaultSearchField>
>
>  <!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
>  <solrQueryParser defaultOperator="OR"/>
>
>  <!-- copyFields group fields into one single searchable indexed field for
> speed.  -->
> <copyField source="title" dest="text" />
> <copyField source="subtitle" dest="text" />
> <copyField source="body" dest="text" />
>
> </schema>
>
> --
> View this message in context:
> http://old.nabble.com/why-no-results--tp26688249p26688249.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>

RE: why no results?

Posted by Jaco Olivier <ja...@sabinet.co.za>.
Hi,

Try changing your TEXT field to type "text"
        <field name="text" type="----text----" indexed="true"
stored="false" multiValued="true" /> (without the ---- of course :))

That is your problem... also use the "text" type as per default examples
with SOLR distro :)

Jaco Olivier


-----Original Message-----
From: regany [mailto:regan@newzealand.co.nz] 
Sent: 08 December 2009 05:44
To: solr-user@lucene.apache.org
Subject: why no results?


hi all - newbie solr question - I've indexed some documents and can
search /
receive results using the following schema - BUT ONLY when searching on
the
"id" field. If I try searching on the title, subtitle, body or text
field I
receive NO results. Very confused. :confused: Can anyone see anything
obvious I'm doing wrong???? Regan.



<?xml version="1.0" ?>

<schema name="core0" version="1.1">

<types>
        <fieldtype name="string" class="solr.StrField"
sortMissingLast="true" omitNorms="true" />
</types>

 <fields>
<!-- general -->
        <field  name="id" type="string" indexed="true" stored="true"
multiValued="false" required="true" />
        <field name="title" type="string" indexed="true" stored="true"
multiValued="false" />
        <field name="subtitle" type="string" indexed="true"
stored="true"
multiValued="false" />
        <field name="body" type="string" indexed="true" stored="true"
multiValued="false" />
        <field name="text" type="string" indexed="true" stored="false"
multiValued="true" />
 </fields>

 <!-- field to use to determine and enforce document uniqueness. -->
 <uniqueKey>id</uniqueKey>

 <!-- field for the QueryParser to use when an explicit fieldname is
absent
-->
 <defaultSearchField>text</defaultSearchField>

 <!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
 <solrQueryParser defaultOperator="OR"/>

 <!-- copyFields group fields into one single searchable indexed field
for
speed.  -->
<copyField source="title" dest="text" />
<copyField source="subtitle" dest="text" />
<copyField source="body" dest="text" />

</schema>

-- 
View this message in context:
http://old.nabble.com/why-no-results--tp26688249p26688249.html
Sent from the Solr - User mailing list archive at Nabble.com.

Please consider the environment before printing this email. This 
transmission is for the intended addressee only and is confidential 
information. If you have received this transmission in error, please 
delete it and notify the sender. The content of this e-mail is the 
opinion of the writer only and is not endorsed by Sabinet Online Limited 
unless expressly stated otherwise.