Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: kinosearch: discuss

leaky filters

 

 

kinosearch discuss RSS feed   Index | Next | Previous | View Threaded


john at perryhome

Sep 5, 2007, 9:59 AM

Post #1 of 3 (757 views)
Permalink
leaky filters

Using the development version of KinoSearch (0.20) I'm trying to filter
the query results by a range filter (date) and two optional query
filters (agency and docType). The range filter works great. The query
filters seem to have no effect at all. I'm probably missing something
obvious here, but I just can't see what I'm doing wrong. Any help would
be appreciated

-- JP

Here's the relevant code:

my $general_query = $query_parser->parse( $query_string );

my $agency_filter;
if ( $agency ) {
my $agency_query = KinoSearch::Search::TermQuery->new(
term => KinoSearch::Index::Term->new( 'source', $agency ),
);

$agency_filter = KinoSearch::Search::QueryFilter->new(
query => $agency_query,
);
}

my $docType_filter;
if ( $doctype ) {
my $docType_query = KinoSearch::Search::TermQuery->new(
term => KinoSearch::Index::Term->new( 'docType', 'audit' ),
);

$docType_filter = KinoSearch::Search::QueryFilter->new(
query => $docType_query,
);
}

my $from_date = $from || '2003-05-01';
my $to_date = $to || '2007-09-01';
my $date_filter = KinoSearch::Search::RangeFilter->new(
field => 'date',
lower_term => $from_date,
upper_term => $to_date,
include_lower => 1,
include_upper => 1,
);

my $filters = KinoSearch::Search::PolyFilter->new;
$filters->add( filter => $date_filter );
$filters->add( filter => $agency_filter, logic => 'AND' ) if
$agency_filter;
$filters->add( filter => $docType_filter, logic => 'AND' ) if
$docType_filter;


my $hits = $searcher->search( query => $general_query, filter =>
$filters, );


_______________________________________________
KinoSearch mailing list
KinoSearch [at] rectangular
http://www.rectangular.com/mailman/listinfo/kinosearch


marvin at rectangular

Sep 5, 2007, 10:25 AM

Post #2 of 3 (704 views)
Permalink
Re: leaky filters [In reply to]

On Sep 5, 2007, at 9:59 AM, John Perry wrote:

> Using the development version of KinoSearch (0.20) I'm trying to
> filter the query results by a range filter (date) and two optional
> query filters (agency and docType). The range filter works great.
> The query filters seem to have no effect at all. I'm probably
> missing something obvious here, but I just can't see what I'm doing
> wrong.

What analyzer is being used on the agency and docType fields?
Keyword fields like docType ususally should not be analyzed.
My guess is that you have a stemmed/non-stemmed mismatch...

> my $agency_query = KinoSearch::Search::TermQuery->new(
> term => KinoSearch::Index::Term->new( 'source', $agency ),
> );
> $agency_filter = KinoSearch::Search::QueryFilter->new(
> query => $agency_query,
> );
> }
>
> my $docType_filter;
> if ( $doctype ) {
> my $docType_query = KinoSearch::Search::TermQuery->new(
> term => KinoSearch::Index::Term->new( 'docType', 'audit' ),
> );
> $docType_filter = KinoSearch::Search::QueryFilter->new(
> query => $docType_query,
> );
> }

... at least on the agency field. On the docType field, should that
"'audit'" be hard coded?

Marvin Humphrey
Rectangular Research
http://www.rectangular.com/



_______________________________________________
KinoSearch mailing list
KinoSearch [at] rectangular
http://www.rectangular.com/mailman/listinfo/kinosearch


john at perryhome

Sep 5, 2007, 10:51 AM

Post #3 of 3 (693 views)
Permalink
Re: leaky filters [In reply to]

That was it. I switched the fields to unanalyzed and it worked like a
charm. I knew I was missing something something stupid and obvious. (And
also the hard-coded 'audit' ... d'oh)

Thanks for your help

-- JP

>On Sep 5, 2007, at 9:59 AM, John Perry wrote:
>
>> Using the development version of KinoSearch (0.20) I'm trying to
>> filter the query results by a range filter (date) and two optional
>> query filters (agency and docType). The range filter works great.
>> The query filters seem to have no effect at all. I'm probably
>> missing something obvious here, but I just can't see what I'm doing
>> wrong.
>
>What analyzer is being used on the agency and docType fields?
>Keyword fields like docType ususally should not be analyzed.
> My guess is that you have a stemmed/non-stemmed mismatch...
>
>> my $agency_query = KinoSearch::Search::TermQuery->new(
>> term => KinoSearch::Index::Term->new( 'source', $agency ),
>> );
>> $agency_filter = KinoSearch::Search::QueryFilter->new(
>> query => $agency_query,
>> );
>> }
>>
>> my $docType_filter;
>> if ( $doctype ) {
>> my $docType_query = KinoSearch::Search::TermQuery->new(
>> term => KinoSearch::Index::Term->new( 'docType', 'audit' ),
>> );
>> $docType_filter = KinoSearch::Search::QueryFilter->new(
>> query => $docType_query,
>> );
>> }
>
>... at least on the agency field. On the docType field, should that
>"'audit'" be hard coded?
>
>Marvin Humphrey
>Rectangular Research
>http://www.rectangular.com/



_______________________________________________
KinoSearch mailing list
KinoSearch [at] rectangular
http://www.rectangular.com/mailman/listinfo/kinosearch

kinosearch discuss RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.