[ 
https://issues.apache.org/jira/browse/LUCENE-2236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12985349#action_12985349
 ] 

Doron Cohen commented on LUCENE-2236:
-------------------------------------

Robert, thanks for renaming back to Similarity.
I reviewed the patch - it looks good to me, just technical simple comments here 
(it may seem a long list but these are really just simple changes)
* *Similarity*:
** line 365: should be 
*** {@link SimilarityProvider#coord(int, int) coord(q,d)}
** line 565: should be:  
*** @see 
org.apache.lucene.index.IndexWriterConfig#setSimilarityProvider(SimilarityProvider)
*** @see IndexSearcher#setSimilarityProvider(SimilarityProvider)
* *InstantiatedIndexWriter* & *MemoryIndex* & *DocumentWriter* & *DocState* & 
*BooleanQuery*
** methods and member should be named similar to IndexSearcher:
*** similarityProvider
*** getSimilarityProvider()
*** setSimilarityProvider(SimilarityProvider similarityProvider)
* *MIGRATE.txt* - I think it should read like this:
** DefaultSimilarity can no longer be set statically (and dangerously) for the 
entire JVM. 
  Instead, IndexWriterConfig and IndexSearcher now take a SimilarityProvider. 
  Similarity can now be configured on a per-field basis. 
  Similarity retains only the field-specific relevance methods such as tf() and 
idf(). 
  Methods that apply to the entire query such as coord() and queryNorm() exist 
in SimilarityProvider.
* IndexWriterConfig javadocs lines 240-241 should discuss SimilarityProvider 
(not Similarity)
* Would it be cleaner to have a new class DefaultSimilarityProvider which would 
return DefaultSimilarity? not sure, but thought it's worth mentioning.
* *IndexSearcher*
** javadoc in line 78:
   "In general, this should not be used."
   Is that so? I would like to believe that in general the default is pretty 
good.
* *TestIndexReaderCloneNorms* the "TODO" added there can be fixed (not too 
efficiently, but okay for the test I think) like this:
{code}
private Document newDoc() {
  Document d = new Document();
  for (int i = 0; i < 10; i++) {
    String fname = "f" + i;
    Field f = newField(fname, "v" + i, Store.NO, Index.NOT_ANALYZED);
    float boost = nextNorm(fname);
    f.setBoost(boost);
    d.add(f);
  }
  return d;
}

// return unique norm values that are unchanged by encoding/decoding
private float nextNorm(String fname) {
  float norm = lastNorm + normDelta;
  do {
    Similarity sim = new DefaultSimilarity().get(fname);
{code}
* *TestNorms* - can fix the "bogus" TODO similar to the above code snippet.

> Similarity can only be set per index, but I may want to adjust scoring 
> behaviour at a field level
> -------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-2236
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2236
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Query/Scoring
>    Affects Versions: 3.0
>            Reporter: Paul taylor
>            Assignee: Robert Muir
>             Fix For: 4.0
>
>         Attachments: LUCENE-2236.patch, LUCENE-2236.patch
>
>
> Similarity can only be set per index, but I may want to adjust scoring 
> behaviour at a field level, to faciliate this could we pass make field name 
> available to all score methods.
> Currently it is only passed to some such as lengthNorm() but not others such 
> as tf()

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to