lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From karl wettin <ka...@snigel.net>
Subject Re: Per-Field Similarity
Date Tue, 23 May 2006 21:58:12 GMT
On Tue, 2006-05-23 at 14:29 -0700, Marvin Humphrey wrote:
> Greets,
> 
> Is it possible to have an IndexWriter apply different Similarity  
> models to different Fields?

You only want to apply this to the norms? Are up for an ad-hoc solution?

Refactor :

class DocumentWriter {
  private final void writeNorms(String segment) throws IOException { 
    for(int n = 0; n < fieldInfos.size(); n++){
      FieldInfo fi = fieldInfos.fieldInfo(n);
      if(fi.isIndexed && !fi.omitNorms){
        float norm = fieldBoosts[n] * similarity.lengthNorm(fi.name,

to this:
        float norm = fieldBoosts[n] * fi.similarity.lengthNorm(fi.name,

You'll have to hack the similarity in FieldInfos.add(Document) and Field
or Document. If I was to add more than one Field with the same name in a
Document I'd probably hack it in the Document.


 


---------------------------------------------------------------------
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