151 |
my $full_q = "($q)"; |
my $full_q = "($q)"; |
152 |
|
|
153 |
my $uid = Jifty->web->current_user->id; |
my $uid = Jifty->web->current_user->id; |
154 |
$full_q .= ' AND _owner_id:' . $uid if ($uid); |
$full_q .= ' AND _owner_id:' . $uid if (defined $uid); |
155 |
|
|
156 |
$self->log->debug("searching for '$q' using $full_q"); |
$self->log->debug("searching for '$q' using $full_q"); |
157 |
|
|
158 |
|
my $query_parser = KinoSearch::QueryParser->new( |
159 |
|
schema => Grep::Search::Schema->new, |
160 |
|
fields => [ qw/ title link content summary category author / ], |
161 |
|
); |
162 |
|
$query_parser->set_heed_colons(1); # enable field:value AND/OR/NOT syntax |
163 |
|
my $query = $query_parser->parse( $full_q ); |
164 |
my $hits = $searcher->search( |
my $hits = $searcher->search( |
165 |
query => $full_q, |
query => $query, |
166 |
# offset => $offset, |
# offset => $offset, |
167 |
# num_wanted => $hits_per_page, |
# num_wanted => $hits_per_page, |
168 |
); |
); |
244 |
package Grep::Search::KeywordField; |
package Grep::Search::KeywordField; |
245 |
use base qw( KinoSearch::Schema::FieldSpec ); |
use base qw( KinoSearch::Schema::FieldSpec ); |
246 |
sub analyzed { 0 } |
sub analyzed { 0 } |
247 |
|
#sub indexed { 1 } |
248 |
|
#sub stored { 1 } |
249 |
|
sub vectorized { 0 } |
250 |
|
|
251 |
package Grep::Search::Schema; |
package Grep::Search::Schema; |
252 |
|
|