Subject: | [PATCH] more flexible search options |
The other day I wanted to sort the results from SVN::Log::Index->search
by providing a KinoSearch::Search::SortSpec object. Currently
SVN::Log::Index has no hooks for that.
Attached patch adds an option to pass a hash reference to the search
method, thus allowing arbitrary searches for those who want to use the
full power of KinoSearch.
It would be nice if you could include that feature in the next version
of SVN::Log::Index.
Cheers,
Moritz
Subject: | pass_option.patch |
--- lib/SVN/Log/Index.pm.orig 2008-06-19 15:43:16.000000000 +0200
+++ lib/SVN/Log/Index.pm 2008-06-19 15:46:29.000000000 +0200
@@ -432,6 +432,9 @@
Search for $query and returns a KinoSearch::Search::Hits object which
contains the result.
+If C<$query> is a hash reference, it is passed directly to the C<search>
+method of the underlying L<KinoSearch> object.
+
=cut
sub search {
@@ -445,7 +448,11 @@
analyzer => $self->{analyzer},
);
- return $searcher->search(query => $query);
+ if (ref $query){
+ return $searcher->search(%$query);
+ } else {
+ return $searcher->search(query => $query);
+ }
}
=head1 QUERY SYNTAX