in reply to Google-like query of ASCII text with Text::Query or other modules

Check out SWISH::API::Common. It's being used to index and search the locally installed perl documentation via Perldoc::Search.
  • Comment on Re: Google-like query of ASCII text with Text::Query or other modules

Replies are listed 'Best First'.
Re^2: Google-like query of ASCII text with Text::Query or other modules
by jbullock35 (Hermit) on Aug 24, 2005 at 06:16 UTC

    This looks like a module I'd love to use. But it indexes files, and my problem is that the text passages against which I want to run queries don't exist in files. They're created on the fly—thousands of short passages. In my script, they exist as scalars. Is there any way to run a Google-like (or SWISH-like) query against them, given that they don't exist as files?

    Thanks,
    --John

      Swish supports indexing arbitrary items, not just files. If you disect the innerts of SWISH::API::Common, you'll see that it puts a 'streamer' into swish's config file.

      The 'streamer' is a program that prints out the text data that's supposed to be indexed, plus some meta data. Check out the file_stream method in SWISH::API::Common:

      print "Path-Name: $file\n", "Document-Type: TXT*\n", "Content-Length: $size\n\n"; print $data;

      So, unless you want to put your text snippets into files, there'll be some additional work involved, but it should be easy.