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 bhaskar chandrasekar <ba...@yahoo.co.in> on 2009/09/18 10:12:36 UTC

Exact word search in Solr

Hi,
 I am doing exact word search in Solr 1.3 and I am not getting the expected results.
I am giving you the sample XML file along with the mail from where search results are fetched.
The following steps were followed to achieve exact word search result in Solr.
 
1)      Schema.xml is configured for title, url and description
<field name="url" type="string" indexed="true" stored="true" required="true"/>
<field name="title" type="text" indexed="true" stored="true" required="true" /> 
<field name="description" type="text" indexed="true" stored="true" required="true"/>
 
Commented below lines
      <!--<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>-->
<!--<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>-->
2)     Started Solr server
3)  Indexed sample data with title, url & description 
5)      Assume I am giving (say channelone) as my input search string for exact word search in Solr admin page.
 
I am getting the following output.It sould show output pertaining to channelone only.It should not display combination of words with “channelone”.I am not looking for case sensitive search here.
<  <doc>
  <field name="url">http://c2search1/contactus3.html</field> 
  <field name="title">c2Search1: Contactus3</field> 
  <field name="description">channelOne</field> 
  </doc>
- <doc>
  <field name="url">http://c2search1/contactus4.html</field> 
  <field name="title">c2Search1: Contactus4</field> 
  <field name="description">Channelone</field> 
  </doc>
- <doc>
  <field name="url">http://c2search1/contactus5.html</field> 
  <field name="title">c2Search1: Contactus5</field> 
  <field name="description">channelOne@$</field> 
  </doc>
- <doc>
  <field name="url">http://c2search1/contactus6.html</field> 
  <field name="title">c2Search1: Contactus6</field> 
  <field name="description">channelOne12@$</field> 
  </doc>
- <doc>
  <field name="url">http://c2search1/contactus7.html</field> 
  <field name="title">c2Search1: Contactus7</field> 
  <field name="description">channelOne12@$ab</field> 
 </doc>
 
 
Expected Result
<  <doc>
  <field name="url">http://c2search1/contactus3.html</field> 
  <field name="title">c2Search1: Contactus3</field> 
  <field name="description">channelOne</field> 
  </doc>
- <doc>
  <field name="url">http://c2search1/contactus4.html</field> 
  <field name="title">c2Search1: Contactus4</field> 
  <field name="description">Channelone</field> 
  </doc>
 
 
Please help me with the above scenario to achieve the desired output.
 
Regards
Bhaskar


      

Re: Exact word search in Solr

Posted by Chris Hostetter <ho...@fucit.org>.
: I followed with the below metioned steps and i am not getting the desired results.
: Let me know if anything else to be done.

Ahmet's point was to declare the text_ws fieldtype and then use it on the 
field you want to have an "exact" match.

FWIW: describing your goal as an "exact word search" is missleading, since 
your examples are case-insensitive.


-Hoss


Re: Exact word search in Solr

Posted by bhaskar chandrasekar <ba...@yahoo.co.in>.
 
Hi,
 
I followed with the below metioned steps and i am not getting the desired results.
Let me know if anything else to be done.
 
Regards
Bhaskar

--- On Fri, 9/18/09, AHMET ARSLAN <io...@yahoo.com> wrote:


From: AHMET ARSLAN <io...@yahoo.com>
Subject: Re: Exact word search in Solr
To: solr-user@lucene.apache.org
Date: Friday, September 18, 2009, 2:59 AM


> Hi,
>  I am doing exact word search in Solr 1.3 and I am not
> getting the expected results.
> I am giving you the sample XML file along with the mail
> from where search results are fetched.
> The following steps were followed to achieve exact word
> search result in Solr.

You can simply use the fieldType below to achieve this:

<fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
<analyzer>
   <tokenizer class="solr.WhitespaceTokenizerFactory"/>
   <filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>

Note that there is no WordDelimiterFilterFactory in this type. But probably yours has it.

Hope this helps.






      

Re: Exact word search in Solr

Posted by AHMET ARSLAN <io...@yahoo.com>.
> Hi,
>  I am doing exact word search in Solr 1.3 and I am not
> getting the expected results.
> I am giving you the sample XML file along with the mail
> from where search results are fetched.
> The following steps were followed to achieve exact word
> search result in Solr.

You can simply use the fieldType below to achieve this:

<fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
 <analyzer>
   <tokenizer class="solr.WhitespaceTokenizerFactory"/>
   <filter class="solr.LowerCaseFilterFactory"/>
 </analyzer>
</fieldType>

Note that there is no WordDelimiterFilterFactory in this type. But probably yours has it.

Hope this helps.