lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: Phonetic search with Lucene 3.2
Date Wed, 09 Nov 2011 13:57:43 GMT
Hi,

You can still add the solr.jar file to your classplath and simply use that
filter. Lot's of people are doing this for e.g. WordDelimiterFilter.

But yes, with Lucene trunk this was factored out of solr core and moved to a
new analyzer module.

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: Felipe Carvalho [mailto:felipe.carvalho@gmail.com]
> Sent: Wednesday, November 09, 2011 2:12 PM
> To: java-user@lucene.apache.org
> Subject: Re: Phonetic search with Lucene 3.2
> 
> Can I use Solr as a lib, like Lucene? My company is not willing to install
a Solr
> server... =/
> 
> On Wed, Nov 9, 2011 at 9:35 AM, Erik Hatcher <erik.hatcher@gmail.com>
> wrote:
> 
> > Solr has, for a long while, included a PhoneticFilter that can
> > leverage several different algorithms.  This was pulled down to
> > Lucene, but only for trunk/4.0.
> >
> > Maybe use Solr instead?!  ;)
> >
> >        Erik
> >
> > On Nov 9, 2011, at 02:29 , Felipe Carvalho wrote:
> >
> > > Using PerFieldAnalyzerWrapper seems to be working for what I need!
> > >
> > > On indexing:
> > >
> > >        PerFieldAnalyzerWrapper wrapper = new
> > > PerFieldAnalyzerWrapper(new StandardAnalyzer(Version.LUCENE_33));
> > >        wrapper.addAnalyzer("nome", new
> MetaphoneReplacementAnalyzer());
> > >        IndexWriterConfig indexWriterConfig = new
> > > IndexWriterConfig(Version.LUCENE_33, wrapper);
> > >        Directory directory = FSDirectory.open(new File(indexPath));
> > >        IndexWriter indexWriter = new IndexWriter(directory,
> > > indexWriterConfig);
> > >
> > > On search:
> > >
> > >        Directory directory = FSDirectory.open(new
> > > File(lastIndexDir(Calendar.getInstance())));
> > >        IndexSearcher is = new IndexSearcher(directory);
> > >        PerFieldAnalyzerWrapper wrapper = new
> > > PerFieldAnalyzerWrapper(new StandardAnalyzer(Version.LUCENE_33));
> > >        wrapper.addAnalyzer("name", new
> MetaphoneReplacementAnalyzer());
> > >        QueryParser parser = new QueryParser(Version.LUCENE_33,
> > > "name", wrapper);
> > >        Query query = parser.parse(expression);
> > >        ScoreDoc[] hits = is.search(query, 1000).scoreDocs;
> > >
> > > Does anyone know any other phonetic analyzer implementation? I'm
> > > using MetaphoneReplacementAnalyzer from LIA examples.
> > >
> > > I'm looking at lucene-contrib stuff at
> > > http://lucene.apache.org/java/3_4_0/lucene-contrib/index.html but I
> > can't
> > > seem to find other phonetic analyzers.
> > >
> > > Thanks!
> > >
> > >
> > > On Tue, Nov 8, 2011 at 12:19 PM, Erik Hatcher
> > ><erik.hatcher@gmail.com
> > >wrote:
> > >
> > >>
> > >> On Nov 8, 2011, at 05:42 , Felipe Carvalho wrote:
> > >>>> Yes, quite possible, including boosting on exact matches if you
want.
> > >> Use
> > >>>> a BooleanQuery to wrap clauses parsed once with phonetic
> > >>>> analysis, and
> > >> once
> > >>>> without, including fields at indexing time for both too of course.
> > >>>>
> > >>>
> > >>> Would it be possible to point to an example where this is done.
> > >>> The
> > best
> > >>> example of a BooleanQuery I've found so far is this one:
> > >>>
> > >>
> > http://www.avajava.com/tutorials/lessons/how-do-i-combine-queries-with
> > -a-boolean-query.html
> > >>>
> > >>> But I couldn't find a boolean query using different analyzers for
> > >> different
> > >>> fields of the attribute.
> > >>
> > >> You could use two different QueryParser instances with different
> > >> analyzers.  Or use the PerFieldAnalyzerWrapper, though you'll still
> > need to
> > >> instances in order to have a different default field for each
> > expression.
> > >> But then use the techniques you saw in that article (or in Lucene
> > >> in Action, since you mentioned having that) to combine Query
> > >> objects into a BooleanQuery.
> > >>
> > >>       Erik
> > >>
> > >>
> > >> -------------------------------------------------------------------
> > >> -- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > >> For additional commands, e-mail: java-user-help@lucene.apache.org
> > >>
> > >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message