http://www.perlmonks.org?node_id=1007187

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Dear Perl Monks, I am tring to use the module Search:VectorSpace to search for documents containing my query terms. But I'm not able to implement it. http://www.perl.com/pub/2003/02/19/engine.html

use Search::VectorSpace; my @docs = ...; my $engine = Search::VectorSpace->new( docs =>\@docs, threshol +d => .04); $engine->build_index(); while ( my $query = <> ) { my %results = $engine->search( $query ); print join "\n", keys %results; }
As mentioned in the module description above, I just need to place my document list in the @docs array. But on doing so, the search is happening only on the document names, but not the content. This is how I did it, is it right?
$dr="C:\\Users\\Desktop\\collection2"; opendir(DR, "$dr") || die "$!" ; @docs=<DR>; @docs=readdir DR;
I want it to search inside the document, not the document names.

Replies are listed 'Best First'.
Re: Vector space search
by Anonymous Monk on Dec 05, 2012 at 04:10 UTC

    I want it to search inside the document, not the document names.

    Then you should put the "inside the documents" inside the array instead of the "document names"