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 <shalinman...@gmail.com> wrote: From: Shalin Shekhar Mangar <shalinman...@gmail.com> 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 <sjh...@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.