lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arian487 <akarb...@tagged.com>
Subject After the query component has the results, can I do more filtering on them?
Date Mon, 27 Jun 2011 18:34:59 GMT
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?

--
View this message in context: http://lucene.472066.n3.nabble.com/After-the-query-component-has-the-results-can-I-do-more-filtering-on-them-tp3114775p3114775.html
Sent from the Solr - User mailing list archive at Nabble.com.

Mime
View raw message