Trying to understand the limitations of CQL::Parser in the context of passing the SRU query through to my swish indexes:

The code currently runs:
  my $parser = CQL::Parser->new();
  my $root = $parser->parse( $query );
  my $swishquery = $root->toSwish();
which is brilliantly simple, and worked within seconds.

On the other hand, for most of the CQL query types I get the line:
  croak( "Swish does not support relational modifiers" )

OK, so maybe swish is flawed and I need to think Lucene (been doing that in any event)
But the TermNode.pm has the line:
  croak( "Lucene doesn't support relations other than '='" );
So, are the limitations roughly the same?

Roughly the extent of what I'm thinking: take a search for dogs and/or cats

Fails: CQL: dc:title any "dogs cats" Succeeds: Swish: dc:title = (dogs or cats)

Could we change the toSwish() method in TermNode.pm  (around line 105) to
[if $relation is "any"]
$term =~ s/\s/ and /g;
$swish = join( ' ', $qualifier, '=', '(', $term, ')' );

similarly

Fails: CQL: dc:title all "dogs cats" Succeeds: Swish: dc:title = (dogs and cats)

so:
  [$relation is "all"]
  $term =~ s/\s/ and /g;
  $swish = join( ' ', $qualifier, '=', '(', $term, ')' );

I'm having a brain stoppage as to the logic to test the $relation but this is more or less right. Somewhere else we have to grab the toSwish test and let the "all" and "any" relations pass.

I could live without "exact" to searches targeted at swish-e (and without the modifiers) if we could get the CQL any/or and all/and to parse correctly.

Does this make sense?

Walter

Reply via email to