You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Chris Hostetter <ho...@fucit.org> on 2011/07/05 01:50:23 UTC

Re: After the query component has the results, can I do more filtering on them?

: Sorry for the double post but in this case, is it possible for me to access
: the queryResultCache in my component and play with it?  Ideally what I want
: is this:

it could be possible to do what you're describing, but it would probabl be 
fairly brittle.

i know you said earlier thta you can't use any eisting components, but i 
strongly urge you to post the details on *what* you wnat to do (ie: where 
are these scores coming from, how are the determined, how often do they 
change, do all of them change or just some of them, etc..) instead of 
*how* you want to do it (ie: modify the scores after the search)

Even if an existing tool (like ExternalFileField) can't be used directly 
in your case, providing the full information about your use case may help 
people suggest a completley differnet approach then the one you're 
considering...

http://people.apache.org/~hossman/#xyproblem
XY Problem

Your question appears to be an "XY Problem" ... that is: you are dealing
with "X", you are assuming "Y" will help you, and you are asking about "Y"
without giving more details about the "X" so that we can understand the
full issue.  Perhaps the best solution doesn't involve "Y" at all?
See Also: http://www.perlmonks.org/index.pl?node_id=542341


-Hoss

Re: After the query component has the results, can I do more filtering on them?

Posted by arian487 <ak...@tagged.com>.
Sorry for being vague.  Okay so these scores exist on an external server and
they change often enough.  The score for each returned user is actually
dependent on the user doing the searching (if I'm making the request, and
you make the same request, the scores are different).  So what I'm doing is
getting a bunch of scores from the external and aggregating that with the
current scores solr gave in my component.  So heres the flow (all numbers
are arbitrary):

1) Get 10,000 results from solr from the query component
2) return a list of scores and ids from the external server (it'll return a
lot of them)
3) Out of this 10000, I take the top 3500 docs after aggregating the
external servers scores and netcons scores.  

The problem is, the score for each doc is specific to the user making the
request.  The algorithm in doing these scores is quite complex.  I cannot
simply re-index with new scores, hence I've written this component which
runs after querycomponent and does the magic of filtering.  

I've come up with a solution but it involved me changing a lot of solr code. 
First and foremost, I've maed the queryResultCache public and developed a
small API in accessing and changing it.  I've also changed the
QueryResultKey to include a Long userId in its hashCode and equals
functions.  When a search is made, the QueryComponent caches its results,
and then in my custom component I go into that cache, get my superset,
filter it out from the scores in my external server, and throw it back into
cache.  Of course none of this happens if my custom scored stuff is already
cached, so its actually decent.  

If you have any suggestions and improvements I'd greatly appreciate it. 
Sorry for the long response...I didn't want to be an XY problem again :D

--
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-tp3114775p3141652.html
Sent from the Solr - User mailing list archive at Nabble.com.