Performing wild card phrase searches can be tricky. Spend some time figuring 
this one out.


1. To perform a wildcard search on a phrase, it is very important to escape the 
SPACE, so that SOLR treats it as a single phrase.
Ex: Citibank NA => Citibank\ NA


You can use org.apache.solr.client.solrj.util.ClientUtils (part of solrj 
library) to perform the escapes


--------------
Example 
--------------
So that a search for: CITIBANK\ N*  

Should produce results: 
CITIBANK NA
CITIBANK NATIONAL
CITIBANK N


2. Also make sure your field (I named it "client_name_starts") is of fieldType 
that is maintained as a single Token during indexing. 

--------------
Example
--------------


<!-- lowercases the entire field value, keeping it as a single token.  -->
   <fieldType name="lowercase" class="solr.TextField" 
positionIncrementGap="100">
     <analyzer>
       <tokenizer class="solr.KeywordTokenizerFactory"/>
       <filter class="solr.LowerCaseFilterFactory" />
    </analyzer>
 </fieldType>


<field name="client_name_starts" type="lowercase" indexed="true" stored="true"  
/>



3. Make sure to Lower Case/Upper Case (depending on your setup) the search user 
input string, before sending it to SOLR - since wildcards are NOT analyzed - 
and send "AS IS"


Good Luck


Kind regards,

Vladimir Sutskever
Investment Bank - Technology
JPMorgan Chase, Inc.
Tel: (212) 552.5097






This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.

Reply via email to