> So I made a custom search component
> which runs right after the query
> component and this custom component will update the score
> of each based on
> some things (and no, I definitely can't use existing
> components).  I didn't
> see any easy way to just update the score so what I
> currently do is
> something like this:
> 
>                
> DocList docList = rb.getResults().docList;
>             float[]
> scores = new float[docList.size()];
>         int[] docs = new
> int[docList.size()];
>         int docCounter = 0;
>         int maxScore = 0;
>         
>         while
> (docList.iterator().hasNext()) {
>            
> int userId = docList.iterator().nextDoc();
>            
> int score = userIdsToScore.get(userId);
>             
>            
> scores[docCounter] = score;
>            
> docs[docCounter] = userId;
>            
> docCounter++;
>            
>     
>             if
> (maxScore < score) {
>            
>     maxScore = score;
>             }
>         }
>         docList = new
> DocSlice(0, docCounter, docs, scores, 0, maxScore);
> 
> my userIdsToScore hashtable is how I'm determining the new
> score.  There are
> a few other things I'm doing but this is the gist. 
> I'm also not sure how to
> go about sorting this...but basically my question is, is
> this how I should
> be updating the score of the documents?

This way you are just updating the scores cosmetically. i.e. they are not 
sorted by score anymore. Plus with this approach you can only process start + 
rows many documents at maximum. Obtaining the whole result set is not an option.

If you have some mapping like userIdsToScore, may be you can use 
ExternalFileField combined with FunctionQueries to influence score.

Reply via email to