Hello,
I'm wondering what the best way to accomplish this is.
When a user enters text to search on it customarily searches 3 fields, 
resume_text, profile_text, and summary_text, so a standard query would be 
something like:
(resume_text:(query) OR profile_text:(query) OR summary_text:(query))
For each hit (up to 50) I'd like to find out which part of the query matched 
with the document.  Right now I use the Explanation object, here's the code:
int len = hits.length();
if(len > 50) len = 50;
for(int i=0; i<len; i++){
Explanation ex = searcher.explain(Query.parse("resume_text:(query)"), 
hits.id(i));
if(ex.isMatch()) ...
ex = searcher.explain(Query.parse("profile_text:(query)"), hits.id(i));
if(ex.isMatch()) ...
ex = searcher.explain(Query.parse("summary_text:(query)"), hits.id(i));
if(ex.isMatch()) ...
}
This works fine with regular queries, but if someone does a query with a 
wildcard search times increase to more than 30 seconds.  Is there a better way 
to do this?
Thanks
Sincerely,
Chris Salem 

Reply via email to