You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucy.apache.org by Klaus Gruen <kl...@rocketmail.com> on 2011/09/08 21:11:01 UTC

[lucy-dev] help with basic index script - how to index a document ?

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;

Re: [lucy-dev] help with basic index script - how to index a document ?

Posted by Klaus Gruen <kl...@rocketmail.com>.
Thanks, I am a developer..appreciate your reply.. any chance you can help me understand why the script I posted doesnt work  on windows 7 ? Thanks !



________________________________
From: Peter Karman <pe...@peknet.com>
To: lucy-dev@incubator.apache.org
Sent: Thursday, September 8, 2011 7:15 PM
Subject: Re: [lucy-dev] help with basic index script - how to index a document ?

Klaus Gruen wrote on 9/8/11 2:11 PM:
> 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.

Hi Klaus,

If you want something simple with a Perl API, I'd suggest looking at Swish-e:
http://swish-e.org/

It supports Windows, has a Perl API for searching, and should require a lot less
code-writing if all you want to do is start indexing and searching.

Lucy is a library primarily for application developers; it's not intended as a
turn-key solution.

KinoSearch1 (which you got from ActiveState) is no longer actively developed.

-- 
Peter Karman  .  http://peknet.com/  .  peter@peknet.com

Re: [lucy-dev] help with basic index script - how to index a document ?

Posted by Peter Karman <pe...@peknet.com>.
Klaus Gruen wrote on 9/8/11 2:11 PM:
> 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.

Hi Klaus,

If you want something simple with a Perl API, I'd suggest looking at Swish-e:
http://swish-e.org/

It supports Windows, has a Perl API for searching, and should require a lot less
code-writing if all you want to do is start indexing and searching.

Lucy is a library primarily for application developers; it's not intended as a
turn-key solution.

KinoSearch1 (which you got from ActiveState) is no longer actively developed.

-- 
Peter Karman  .  http://peknet.com/  .  peter@peknet.com