lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felipe Carvalho <felipe.carva...@gmail.com>
Subject Re: Phonetic search with Lucene 3.2
Date Tue, 08 Nov 2011 11:58:20 GMT
One other question: I'm looking at Lucene 3.4 javadocs (
http://lucene.apache.org/java/3_4_0/api/core/index.html) but I can't find
MetaphoneReplacementAnalyzer anywhere. Does any one know if this class has
been removed from lucene-core.

My Lucene In Action edition is from 2004, so I'm guessing things kinda
changed since then.

Thanks!

On Tue, Nov 8, 2011 at 9:50 AM, Felipe Carvalho
<felipe.carvalho@gmail.com>wrote:

> Thanks for the reply, Paul!
>
> I got this example from Lucene In Action:
>
> public void testKoolKat(){
>     RAMDirectory directory = new RAMDirectory();
>     Analyzer analyzer = new MetaphoneReplacementAnalyzer();
>
>     IndexWriter writer = new IndexWriter(directory, analyzer, true);
>     Document doc = new Document();
>     doc.add(Field.Text("contents", "cool cat"));
>     writer.addDocument(doc);
>     writer.close();
>
>     IndexSearcher searcher = new IndexSearcher(directory);
>     Query query = QueryParser.parse("kool kat", "contents", analyzer);
>
>     Hits hits = searcher.search(query);
>
>     assertEquals(1, hits.length);
>     assertEquals("cool cat", hits.doc(0).get("contents"));
>
>     searcher.close();
> }
>
> Now suppose my document had a particular field I don't want to be
> metaphones one the search, for instance, "exactName". For example, suppose
> I want to look for all documents which contents phonetically match "kool
> kat" and exactName match "kat" but not "cat", generating an expression like
> this: "exactName:kat AND contents:kool kat".
>
> Is it possible to do this? If so, how would I do it? Can I use specific
> analyzers for each field?
>
> Thanks,
>   Felipe
>
>
> On Tue, Nov 8, 2011 at 5:06 AM, Paul Libbrecht <paul@hoplahup.net> wrote:
>
>> Felipe,
>>
>> in Lucene in Action there's a little bit on that.
>> Basically it's just about using the right analyzer.
>>
>> paul
>>
>>
>> Le 8 nov. 2011 à 01:45, Felipe Carvalho a écrit :
>>
>> > Hello,
>> >  I'm using Lucene 3.2 on a phone book app and phonetic search is a
>> > requirement. I've googled up "lucene phonetic search" but could not find
>> > many references. I did find this article, but I'm not sure about how
>> > updated it is: http://tech.javayogi.com/hello-world-lucene.html
>> >  I couldn't find anything browsing on Lucene's docs or mail archives
>> > either.
>> >  I did find this improvement on Jira (
>> > https://issues.apache.org/jira/browse/LUCENE-2413) but as far as I
>> could
>> > understand, it seems like phonetic capability is scheduled to be added
>> to
>> > lucene-core on 4.0 version only.
>> >  Can anyone point to an example of phonetic indexing and searching?
>> Should
>> > I use Phonetix (
>> >
>> http://www.companywebstore.de/tangentum/mirror/en/products/phonetix/index.html
>> )
>> > stuff?
>> >
>> > Thanks a lot,
>> >  Felipe
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message