I'm not sure, whether I made myself very clear. I don't
think that it is difficult to evaluate the query. Here's a
(very inefficient) algorithm in pseudocode that would do,
what I have in mind:
query = ...
foreach (term in query)
foreach (field in SOLR.config.fields)
result = SOLR.query(field:term)
if result.size> 0
filters.addFilter(field=term)
break
end
end
end
return SOLR.filter(filters)
Okey if you have already something, I think simplest place to put this is a
custom search handler. http://wiki.apache.org/solr/SolrPlugins
Other option can be QParserPlugin.
public final class CustomSearchHandler extends SearchHandler {
@Override
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp)
throws IOException, ParseException, InstantiationException,
IllegalAccessException {
ModifiableSolrParams solrParams = new
ModifiableSolrParams(req.getParams());
String query = req.getParams().get(CommonParams.Q, "*:*");
foreach (term in query)
foreach (field in SOLR.config.fields) =>
http://wiki.apache.org/solr/LukeRequestHandler
result = SOLR.query(field:term)
if result.size> 0
filters.addFilter(field=term) => solrParams.add(CommonParams.FQ,
"field:term");
break
end
end
end
req.setParams(solrParams);
super.handleRequestBody(req, rsp);
}
Ok. Thank you very much for your help and the starting points. I'll give
it a try. Maybe I come up with a smarter way than my "brute force"
algorithm.