incubator-lucy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Klaus Gruen <klausgr...@rocketmail.com>
Subject [lucy-dev] help with basic index script - how to index a document ?
Date Thu, 08 Sep 2011 19:11:01 GMT
Hi all !! Appreciate help here, I installed Kinosearch1 (using activestate 5.12 PPM, Lucy is
not available...), and this code 
below doesnt seem to index my file.  Also, if I wanted to only index 
certain fields, how is this done ?  What is wrong with the below code 
taken from the kino webpages. Notice I commented 'boost' out since 
activestate 5.12 reports a syntax error back when running it.  Last, I just want a simple
Perl API for an indexer,  
should I be using something else or Lucy ?  Confused on that as well.


here is some sample data:
BILLING_DATE_KEY|DEPLOY_TO_CONTACT_KEY|DEPLOY_TO_ADDRESS_KEY|DEPLOY_TO_CUSTOMER_KEY|END_USER_CUSTOMER_KEY|PRODUCT_KEY|SALES_ORDER_NUMBER_LIC
0|0||12466340|12466340|0|8000166737


thanks!


use KinoSearch1::InvIndexer;
    use KinoSearch1::Analysis:: PolyAnalyzer;

    my $analyzer
        = KinoSearch1::Analysis:: PolyAnalyzer->new( language => 'en' );

    my $invindexer = KinoSearch1::InvIndexer->new(
        invindex => 'c:\tmp5',
        create   => 1,
        analyzer => $analyzer,
    );

    $invindexer->spec_field(
        name  => 'title'
      #  boost => 3,
    );
    $invindexer->spec_field( name => 'bodytext' );

     %source_docs = ("c:\tmp5\lic_mv_fact_billing_ slim.txt",0);

    while ( my ( $title, $bodytext ) = each %source_documents ) {
        my $doc = $invindexer->new_doc($title);
        $doc->set_value( title    => $title );
        $doc->set_value( bodytext => $bodytext );

        $invindexer->add_doc($doc);
    }

    $invindexer->finish;
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message