[ http://issues.apache.org/jira/browse/LUCENE-304?page=all ] Otis Gospodnetic resolved LUCENE-304: -------------------------------------
Resolution: Duplicate Assign To: (was: Lucene Developers) I think this is a "duplicate" of LUCENE-544 . > [PATCH] add boost feature to MultiFieldQueryParser > -------------------------------------------------- > > Key: LUCENE-304 > URL: http://issues.apache.org/jira/browse/LUCENE-304 > Project: Lucene - Java > Type: Improvement > Components: QueryParser > Versions: 1.4 > Environment: Operating System: other > Platform: Other > Reporter: Nicolas Maisonneuve > Priority: Minor > Attachments: MultiFieldQueryParser.java > > add this feature > (field1:query)^bfield1 (field2:query)^bfield12 (field3:query)^bfield3 ... > (fieldx:query)^bfieldx > Google Example: a user search "coco" , my defaults search fields are title > and > description. But i would like boost title field more than description field to > have results more relevant. > Change in the MultiFieldQueryParser : add this method > public static Query parse(String query, String[] fields, int[] flags, float > [] > boost, Analyzer analyzer) throws ParseException { > { > BooleanQuery bQuery = new BooleanQuery(); > for (int i = 0; i < fields.length; i++) > { > Query q = parse(query, fields[i], analyzer); > ==> q.setBoost(boost[i]); > int flag = flags[i]; > switch (flag) > { > case REQUIRED_FIELD: > bQuery.add(q, BooleanClause.Occur.MUST); > break; > case PROHIBITED_FIELD: > bQuery.add(q, BooleanClause.Occur.MUST_NOT); > break; > default: > bQuery.add(q, BooleanClause.Occur.SHOULD); > break; > } > } > return bQuery; > } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]