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 Shyamsunder Reddy <sj...@yahoo.com> on 2009/03/06 16:54:57 UTC
Search for a field whose value contains instead of begins with
I am indexing a document with field 'name'. The values of the field 'name' are like: Apple Corp, Apple iPod, Apple Games, Indian Apple, West Apple Corporation and The Applemint Gimlet.
Now my question is how to configure the field 'name' in my Solr configuration and schema, so that when I search for name:Apple.
The query should return results all entities that contain word the 'Apple'. And not just words that start with 'Apple'.
In this the expected result for the search query name:Apple are
Apple Corp,
Apple iPod,
Apple Games
Indian Apple,
West Apple Corporation
The Applemint Gimlet.
Also another requirement is to sort the results that start with Apple as:
Apple Corp,
Apple Games
Apple iPod,
Indian Apple,
West Apple Corporation
The Applemint Gimlet.
Thanks
Re: Search for a field whose value contains instead of begins with
Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Sat, Mar 7, 2009 at 12:40 AM, SJ <sj...@yahoo.com> wrote:
>
> The nam' field defined as string. What is the best analyzer to analyze the
> name field text (ie Apple Corporation or The Applemint Gimlet) into
> individual tokens.
> Also shall I use stored or not stored property.
>
> <field name="NAME" type="string" indexed="true" stored="true"/>
Use the text data type (as given in the example schema). If you want the
field's original value to be returned in the results, use stored="true"
otherwise false.
--
Regards,
Shalin Shekhar Mangar.
Re: Search for a field whose value contains instead of begins with
Posted by SJ <sj...@yahoo.com>.
The nam' field defined as string. What is the best analyzer to analyze the
name field text (ie Apple Corporation or The Applemint Gimlet) into
individual tokens.
Also shall I use stored or not stored property.
<field name="NAME" type="string" indexed="true" stored="true"/>
Shalin Shekhar Mangar wrote:
>
> On Fri, Mar 6, 2009 at 9:24 PM, Shyamsunder Reddy <sj...@yahoo.com>
> wrote:
>
>> I am indexing a document with field 'name'. The values of the field
>> 'name'
>> are like: Apple Corp, Apple iPod, Apple Games, Indian Apple, West Apple
>> Corporation and The Applemint Gimlet.
>>
>>
>> Now my question is how to configure the field 'name' in my Solr
>> configuration and schema, so that when I search for name:Apple.
>> The query should return results all entities that contain word the
>> 'Apple'.
>> And not just words that start with 'Apple'.
>> In this the expected result for the search query name:Apple are
>> Apple Corp,
>> Apple iPod,
>> Apple Games
>> Indian Apple,
>> West Apple Corporation
>> The Applemint Gimlet.
>>
>
> How is the 'name' field defined in the schema? What is the query you are
> using?
>
> I guess you'd need to index the names as text type.
>
>
>> Also another requirement is to sort the results that start with Apple as:
>> Apple Corp,
>> Apple Games
>> Apple iPod,
>> Indian Apple,
>> West Apple Corporation
>> The Applemint Gimlet.
>>
>
> Use the sort parameter to your request e.g. sort=name asc
>
> Also see http://wiki.apache.org/solr/CommonQueryParameters
> --
> Regards,
> Shalin Shekhar Mangar.
>
>
--
View this message in context: http://www.nabble.com/Search-for-a-field-whose-value-contains-instead-of-begins-with-tp22375189p22378688.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Search for a field whose value contains instead of begins with
Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Fri, Mar 6, 2009 at 9:24 PM, Shyamsunder Reddy <sj...@yahoo.com> wrote:
> I am indexing a document with field 'name'. The values of the field 'name'
> are like: Apple Corp, Apple iPod, Apple Games, Indian Apple, West Apple
> Corporation and The Applemint Gimlet.
>
>
> Now my question is how to configure the field 'name' in my Solr
> configuration and schema, so that when I search for name:Apple.
> The query should return results all entities that contain word the 'Apple'.
> And not just words that start with 'Apple'.
> In this the expected result for the search query name:Apple are
> Apple Corp,
> Apple iPod,
> Apple Games
> Indian Apple,
> West Apple Corporation
> The Applemint Gimlet.
>
How is the 'name' field defined in the schema? What is the query you are
using?
I guess you'd need to index the names as text type.
> Also another requirement is to sort the results that start with Apple as:
> Apple Corp,
> Apple Games
> Apple iPod,
> Indian Apple,
> West Apple Corporation
> The Applemint Gimlet.
>
Use the sort parameter to your request e.g. sort=name asc
Also see http://wiki.apache.org/solr/CommonQueryParameters
--
Regards,
Shalin Shekhar Mangar.