1169 |
} else { |
} else { |
1170 |
# Get the field list. |
# Get the field list. |
1171 |
my @fields = @{$object1Structure->{searchFields}}; |
my @fields = @{$object1Structure->{searchFields}}; |
1172 |
|
# Clean the search expression. |
1173 |
|
my $actualKeywords = $self->CleanKeywords($searchExpression); |
1174 |
# We need two match expressions, one for the filter clause and one in the |
# We need two match expressions, one for the filter clause and one in the |
1175 |
# query itself. Both will use a parameter mark, so we need to push the |
# query itself. Both will use a parameter mark, so we need to push the |
1176 |
# search expression onto the front of the parameter list twice. |
# search expression onto the front of the parameter list twice. |
1177 |
unshift @myParams, $searchExpression, $searchExpression; |
unshift @myParams, $actualKeywords, $actualKeywords; |
1178 |
# Build the match expression. |
# Build the match expression. |
1179 |
my @matchFilterFields = map { "$object1Name." . _FixName($_) } @fields; |
my @matchFilterFields = map { "$object1Name." . _FixName($_) } @fields; |
1180 |
my $matchClause = "MATCH (" . join(", ", @matchFilterFields) . ") AGAINST (? IN BOOLEAN MODE)"; |
my $matchClause = "MATCH (" . join(", ", @matchFilterFields) . ") AGAINST (? IN BOOLEAN MODE)"; |
2605 |
return @retVal; |
return @retVal; |
2606 |
} |
} |
2607 |
|
|
2608 |
|
=head2 Virtual Methods |
2609 |
|
|
2610 |
|
=head3 CleanKeywords |
2611 |
|
|
2612 |
|
C<< my $cleanedString = $erdb->CleanKeywords($searchExpression); >> |
2613 |
|
|
2614 |
|
Clean up a search expression or keyword list. This is a virtual method that may |
2615 |
|
be overridden by the subclass. The base-class method removes extra spaces |
2616 |
|
and converts everything to lower case. |
2617 |
|
|
2618 |
|
=over 4 |
2619 |
|
|
2620 |
|
=item searchExpression |
2621 |
|
|
2622 |
|
Search expression or keyword list to clean. Note that a search expression may |
2623 |
|
contain boolean operators which need to be preserved. This includes leading |
2624 |
|
minus signs. |
2625 |
|
|
2626 |
|
=item RETURN |
2627 |
|
|
2628 |
|
Cleaned expression or keyword list. |
2629 |
|
|
2630 |
|
=back |
2631 |
|
|
2632 |
|
=cut |
2633 |
|
|
2634 |
|
sub CleanKeywords { |
2635 |
|
# Get the parameters. |
2636 |
|
my ($self, $searchExpression) = @_; |
2637 |
|
# Lower-case the expression and copy it into the return variable. Note that we insure we |
2638 |
|
# don't accidentally end up with an undefined value. |
2639 |
|
my $retVal = lc($searchExpression || ""); |
2640 |
|
# Remove extra spaces. |
2641 |
|
$retVal =~ s/\s+/ /g; |
2642 |
|
$retVal =~ s/(^\s+)|(\s+$)//g; |
2643 |
|
# Return the result. |
2644 |
|
return $retVal; |
2645 |
|
} |
2646 |
|
|
2647 |
=head2 Internal Utility Methods |
=head2 Internal Utility Methods |
2648 |
|
|
2649 |
=head3 _RelationMap |
=head3 _RelationMap |