Skip to main content.
home | support | download

Back to List Archive

Re: Using Swish's Query Parser (to pre-filter a collection

From: Peter Karman <karman(at)>
Date: Thu Nov 18 2004 - 23:20:55 GMT
Bill's right here (as always).

I call this 'compound searching' where I want to do a preliminary 
search, then search within that set, winnowing as I get more specific.

In Perl CGI, I did this with an array of queries, AND'd together.

use CGI qw(:standard);
my @q = param('q');
my $swishq = join ' AND ', @q;

where my url was something like:


for example. I then offered users the choice of 'search within these 
results' or 'new search'.

Bill Moseley wrote on 11/18/2004 02:44 PM:
> On Thu, Nov 18, 2004 at 12:35:12PM -0800, Masoud Pirnazar wrote:
>>i think you have the correct picture, but here's another attempt:
>>A:(a bunch of documents, say 500,000 docs)  |  B:(initial pre-filtering,
>>qualifying say 40,000 docs)  | C:(index the 40,000 qualified docs) |
>>D:(allow users to search the 40,000 qualified docs)
>>(using the pipe sign | here to indicate the flow of data/different stages of
>>the end user specifies the criteria in steps B and D.  it would be easier
>>for the end user to use the same query syntax in both steps.  at step B, it
>>filters out a lot of unwanted documents.  at step D, they are searching
>>using other criteria, so the query changes.
>>a typical application:  fromthe 500,000 docs, i want to extract only the
>>40,000 docs that mention some kind of sport activity, then put those in the
>>"sports collection" and allow end users to search the sports collection
>>using whatever (unrelated) queries they want to use.
> Nice old databases did this (BRS was one) where you do a query and you
> get a set of records.  Then you can do queries on that set.
> In swish you would index the entire thing and then do:
>    -w some query AND type=sports

Peter Karman . . karman(at)
"I love deadlines. I love the whooshing sound they make as they go by."
         - Douglas Adams
Received on Thu Nov 18 15:21:06 2004