AnsweredAssumed Answered

Wildcards in Lucene Searches

Question asked by dbevacqua on Nov 7, 2006
Latest reply on Jan 10, 2007 by andy
Hi

This follows on from an earlier thread which wasn't resolved.

I'm having difficulty getting wildcard searches to work. For example:

@cm\:name:heal*

I've traced through the relevant code and the problem seems to be in org.alfresco.repo.search.impl.lucene.QueryParser, around line 720:


  final public Query Term(String field) throws ParseException {
  Token term, boost=null, fuzzySlop=null, goop1, goop2;
  boolean prefix = false;
  boolean wildcard = false;
  boolean fuzzy = false;
  boolean rangein = false;
  Query q;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case TERM:
    case PREFIXTERM:
    case WILDTERM:
    case NUMBER:
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case TERM:
        term = jj_consume_token(TERM);
        break;
      case PREFIXTERM:
        term = jj_consume_token(PREFIXTERM);
                             prefix=true;
        break;
      case WILDTERM:
        term = jj_consume_token(WILDTERM);
                           wildcard=true;

in jj_ntk() when the token is 'heal*', the kind is (incorrectly) identified as 19 (PREFIXTERM), not WILDTERM.

Or am I missing something?

This is a real problem for us. I am prepared to admit it is something I am doing but I'd appreciate some guidance on the matter if anyone has any ideas.

Thanks

Dominic

Outcomes