On Apr 2, 2005, at 7:01 AM, Sven Duzont wrote:
EH> Could you share that filter with the community?
Of course, the code is in the attachment

Thanks for sharing that!

Would you be interested in donating that to the contrib area for analyzers? The topic of normalizing accented characters has come up often lately. I noticed you already put the Apache license at the top of the code.

    // The first clause is required
    if(bClauses[0].prohibited != true)
      bClauses[0].required = true;
EH> Why do you flip the required flag like this?
On the search interface, near the keyword field, there is a combo
with 4 values :
- KW_MODE_OR      : "Search for at least one of the terms"
- KW_MODE_AND     : "Search for all the terms"
- KW_MODE_PHRASE  : "Search for exact phrase"
- KW_MODE_BOOLEAN : "Search using boolean query" (for advanced users)
  I flip the request field only when boolean expression is selected
  It force the first term to be required so the user will not
  need to specify the "+" or "AND" operator
  Maybe there is a more elegant way to do this ?

When using QueryParser, you can set the default operator, which is normally OR. It will handle setting the first (and every) clause appropriately. You'll need to instantiate an instance of QueryParser to set that flag (see javadocs for details).


        Erik


  // Expression booléenne
  if (cvSearchBean.keywordModeId == KW_MODE_BOOLEAN) {
    final Query query = QueryParser.parse(cvSearchBean.title,
                                        FIELD_RESUME_BODY, analyzer);
    if (query instanceof BooleanQuery) {
      final BooleanClause[] bClauses =
                              ((BooleanQuery) query).getClauses();
      if (bClauses[0].prohibited != true)
        bClauses[0].required = true;
    }
    bQuery.add(CreateCustomQuery(query), true, false);
  }


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to