You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Felipe Carvalho <fe...@gmail.com> on 2012/01/30 23:35:53 UTC
Boost term according to phonetic representation
Consider a people index, containing People documents with the following
names:
Doc 1 [name: "Marcus"]
Doc 2 [name: "Markus"]
Doc 3 [name: "Mharcus"]
Suppose I use an analyzer so that all 3 names have the same representation.
Supposing I use the same analyzer when running a search for name=markus, is
there a way to make Markus appear on top of the others?
I was looking at this article (
http://lucene.apache.org/java/3_5_0/queryparsersyntax.html#Boosting%20a%20Term)
but I'm not sure it applies to what I need.
Thanks
Re: Boost term according to phonetic representation
Posted by Ian Lea <ia...@gmail.com>.
If all you have indexed are three identical terms there will be no way
to make Markus come top.
You could index the normalized version and the original (with maybe
StandardAnalyzer to get downcasing etc) and do a search across both
fields, boosting whichever makes sense for you.
normalized:Markus original:Markus^2
You could use PerFieldAnalyzerWrapper to specify different analyzers
for different fields.
Another idea might be to change your normalization analyzer to output
the original as well as the normalized version. Sort of like
synonyms. So, if the normalized version of all three was "marcus"
you'd end up with indexed terms like
marcus marcus
marcus markus
marcus mharcus
and at search time "Markus" would expand to "marcus markus" and the
second doc would come top.
--
Ian.
On Mon, Jan 30, 2012 at 10:35 PM, Felipe Carvalho
<fe...@gmail.com> wrote:
> Consider a people index, containing People documents with the following
> names:
>
> Doc 1 [name: "Marcus"]
> Doc 2 [name: "Markus"]
> Doc 3 [name: "Mharcus"]
>
> Suppose I use an analyzer so that all 3 names have the same representation.
> Supposing I use the same analyzer when running a search for name=markus, is
> there a way to make Markus appear on top of the others?
>
> I was looking at this article (
> http://lucene.apache.org/java/3_5_0/queryparsersyntax.html#Boosting%20a%20Term)
> but I'm not sure it applies to what I need.
>
> Thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org