Faceting returns indexed terms.  So adding 
&facet=on&facet.field=firstname_phonetic will get you back the phonetic codes 
across an entire result set.

If you have a single string and want the phonetic codes back, you can use the 
analysis request handler (document or field).

For a bit more detail, check out the files I added to this JIRA: 
https://issues.apache.org/jira/browse/SOLR-3551 
<https://issues.apache.org/jira/browse/SOLR-3551>

        Erik


> On Jan 22, 2015, at 6:25 AM, Amit Jha <shanuu....@gmail.com> wrote:
> 
> Thanks for response, I can see generated MetaPhone codes using Luke. I am
> using solr only because it creates the phonetic code at time of indexing.
> Otherwise for each record I need to call Metaphone algorithm in realtime to
> get the codes and compare them. I think when luke can read and display it,
> why can't solr
> 
> On Thu, Jan 22, 2015 at 7:54 PM, Amit Jha <shanuu....@gmail.com> wrote:
> 
>> Hi,
>> 
>> I need to know how can I retrieve phonetic codes. Does solr provide it as
>> part of result? I need codes for record matching.
>> 
>> *following is schema fragment:*
>> 
>> <fieldtype name="phonetic" stored="true" indexed="true"
>> class="solr.TextField" >
>>      <analyzer type="index">
>>        <tokenizer class="solr.StandardTokenizerFactory"/>
>>        <filter class="solr.DoubleMetaphoneFilterFactory" inject="true"
>> maxCodeLength="4"/>
>>      </analyzer>
>>    </fieldtype>
>> 
>> <field name="firstname" type="text_general" indexed="true" stored="true"/>
>>  <field name="firstname_phonetic" type="phonetic" />
>>  <field name="lastname_phonetic" type="phonetic" />
>>  <field name="lastname" type="text_general" indexed="true" stored="true"/>
>> 
>> <copyField source="lastname" dest="lastname_phonetic"/>
>> <copyField source="firstname" dest="firstname_phonetic"/>
>> 
>> Hi,
>> 
>> Thanks for response, I can see generated MetaPhone codes using Luke. I am
>> using solr only because it creates the phonetic code at time of indexing.
>> Otherwise for each record I need to call Metaphone algorithm in realtime to
>> get the codes and compare them. I think when luke can read and display it,
>> why can't solr?
>> 
>> 

Reply via email to