Article View: pl.comp.lang.perl
Article #39885pytanie o plucene
From: pogi
Date: Sun, 31 Oct 2004 09:50
Date: Sun, 31 Oct 2004 09:50
62 lines
1937 bytes
1937 bytes
chiałbym sie wyciagnać zawartosc pola author i title przy wyszukiwaniu.
wyszukiwanie dziala ok, zwracanie sa prawidlowe pola id.
oto kod
tworzenie indeksu:
------------
use Plucene::Simple;
use Plucene::Search::PrefixQuery;
$index_path="index";
my $plucy = Plucene::Simple->open($index_path);
$plucy->add(
id1 => {
author => "autor_pierwszy",
title => "tytul_pierwszy",
},
id2 => {
author => "autor_drugi",
title => "tytul_drugi"
},
id3 => {
author => "autor_trzeci",
title => "tytul_trzeci"
},
id4 => {
author => "autor_pierwszy",
title => "tytul_czwarty"
},
);
wyszukiwanie:
-----------
use Plucene::Simple;
$index_path='index';
$search_string="autor_pierwszy";
$search_string2="tytul_czwarty";
my $plucy = Plucene::Simple->open($index_path);
my @result = $plucy->search($search_string);
print @result;
print "\n";
my @result = $plucy->search("author:$search_string AND title:
$search_string2");
print @result;
z gory dzieki za pomoc
Maciek
Technical Details
Message-ID:
<cm2cim$7od$1@atlantis.news.tpi.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!opal.futuro.pl!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mailShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!opal.futuro.pl!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail From: pogi <pogorzem@o2.pl> Newsgroups: pl.comp.lang.perl Subject: pytanie o plucene Date: Sun, 31 Oct 2004 10:50:46 +0100 Organization: tp.internet - http://www.tpi.pl/ Lines: 62 Message-ID: <cm2cim$7od$1@atlantis.news.tpi.pl> NNTP-Posting-Host: acp74.internetdsl.tpnet.pl Mime-Version: 1.0 X-Trace: atlantis.news.tpi.pl 1099216278 7949 83.16.67.74 (31 Oct 2004 09:51:18 GMT) X-Complaints-To: usenet@tpi.pl NNTP-Posting-Date: Sun, 31 Oct 2004 09:51:18 +0000 (UTC) User-Agent: KNode/0.8.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit