Re: Search for a field whose value contains instead of begins with

2009-03-06 Thread Shyamsunder Reddy
Thanks. I have configured the field as text and search is working fine.
But the results are not properly sorted. field "name" value is some
company names in NY.


Here is my search query:

http://localhost:8090/solr/select?fq=TYPE:ORG&q=NAME:new%20york&sort=NAME%20desc&rows=100&fl=NAME

here is my result list (extracted the results from XML).


I want this result to be sorted as:

 1. Show all Names that start with 'New York' first (that is by
search query). And sort all the names that start with 'New York'. eg.

  NEW YORK IMMIGRATION COALITION, INC.

  NEW YORK LEGAL ASSISTANCE GROUP 

  NEW YORK YOUTH AT RISK INC.   


 2. Sort the remaining results that contain the word 'New York'
as per the proximity (distance) of this word from the beginning of the
document.


Please let me know how can I achieve this result?

***

YWCA OF THE CITY OF NEW YORK

NEW YORK YOUTH AT RISK INC.

EAST NEW YORK URBAN YOUTH CORPS, INC.

YOUNG AUDIENCES NEW YORK, INC.

Yoswein New York, Inc.

Real Estate Board of New York,Inc.

CENTRAL PARKING SYSTEM OF NEW YORK, INC.

NEW YORK JUNIOR TENNIS LEAGUE, INC.

NCNW OF GREATER NEW YORK

LOCAL DEVELOPMENT CORP. EAST NEW YORK

EAST NEW YORK LEARNING CENTER, INC.

GIRLS INCORPORATED OF NEW YORK CITY

PLANNED PARENTHOOD OF NEW YORK CITY INC.

GIRL SCOUT COUNCIL OF GREATER NEW YORK

NEW YORK ROAD RUNNERS FOUNDATION

ACHIEVEMENT FIRST EAST NEW YORK SCHOOL

MAKE THE ROAD NEW YORK

LAWYERS ALLIANCE FOR NEW YORK

NEW YORK IMMIGRATION COALITION, INC.

NEW YORK LEGAL ASSISTANCE GROUP

VISITING NURSE SERVICE OF NEW YORK




--- On Fri, 3/6/09, Shalin Shekhar Mangar  wrote:

From: Shalin Shekhar Mangar 
Subject: Re: Search for a field whose value contains instead of begins with
To: solr-user@lucene.apache.org
Date: Friday, March 6, 2009, 2:14 PM

On Sat, Mar 7, 2009 at 12:40 AM, SJ  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.
>
> 


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

2009-03-06 Thread Shalin Shekhar Mangar
On Sat, Mar 7, 2009 at 12:40 AM, SJ  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.
>
> 


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

2009-03-06 Thread SJ

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.



Shalin Shekhar Mangar wrote:
> 
> On Fri, Mar 6, 2009 at 9:24 PM, Shyamsunder Reddy 
> 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

2009-03-06 Thread Shalin Shekhar Mangar
On Fri, Mar 6, 2009 at 9:24 PM, Shyamsunder Reddy  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.


Search for a field whose value contains instead of begins with

2009-03-06 Thread Shyamsunder Reddy
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