You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@nutch.apache.org by frgrfg gfsdgffsd <ki...@yahoo.fr> on 2006/10/10 16:57:44 UTC
Re : Searching terms saved in a file
Thanks a lot Dennis!
But it is still not that clear to me...
Have you got any example of how constructing a Query object using the addRequired and addProhibited methods? (I am also beginner in Java...)
And what doo you mean by "Then pass that into the appropriate NutchBean search method"??
Any code example?
Actually my problem is that the Nutch javadoc is not really clear to me, any better documented docs somewhere?
Thank you very much again!!
Mat
----- Message d'origine ----
De : Dennis Kubes <nu...@dragonflymc.com>
À : nutch-user@lucene.apache.org
Envoyé le : Mardi, 10 Octobre 2006, 19h57mn 17s
Objet : Re: Searching terms saved in a file
You would have to write something that would loop through the file and
then construct a Query object using the addRequired and addProhibited
methods to add your terms and phrases. Then pass that into the
appropriate NutchBean search method to get your results.
Dennis
frgrfg gfsdgffsd wrote:
> Hi all,
>
> As a new nutch's user, I am quite stuck regarding this:
> How can I launch a search using a file containing my terms/keywords instead of typing them in search.jsp??
> Do I have to use the Query.term class? If yes, How and where do I use this class?
> Thanks a lot!
>
>
> Mat
>
>
>
>
>
>
>
>
> ___________________________________________________________________________
> Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
> Demandez à ceux qui savent sur Yahoo! Questions/Réponses
> http://fr.answers.yahoo.com
>
___________________________________________________________________________
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
Demandez à ceux qui savent sur Yahoo! Questions/Réponses
http://fr.answers.yahoo.com
Re: Re : Searching terms saved in a file
Posted by Dennis Kubes <nu...@dragonflymc.com>.
Try something like this. The conf folder holding the nutch-site.xml and
hadoop-site.xml file must be in the classpath here. I have the file
system set to local and I have an index on the local filesystem.
Dennis
try {
Scanner scanner = new Scanner(new File("C:\\d01\\searchterms.txt"));
Query query = new Query();
while (scanner.hasNext()) {
query.addRequiredTerm(scanner.nextLine().trim());
}
Configuration conf = NutchConfiguration.create();
IndexSearcher searcher = new IndexSearcher(new
Path("C:\\d01\\crawl3\\index"), conf);
NutchBean bean = new NutchBean(conf);
Hits hits = bean.search(query, 10);
HitDetails[] details = searcher.getDetails(hits.getHits(0,
hits.getLength()));
for (int i = 0; i < details.length; i++) {
HitDetails curDetail = details[i];
System.out.println(curDetail);
}
}
catch (IOException e) {
e.printStackTrace();
}
frgrfg gfsdgffsd wrote:
> Thanks a lot Dennis!
> But it is still not that clear to me...
> Have you got any example of how constructing a Query object using the addRequired and addProhibited methods? (I am also beginner in Java...)
> And what doo you mean by "Then pass that into the appropriate NutchBean search method"??
> Any code example?
> Actually my problem is that the Nutch javadoc is not really clear to me, any better documented docs somewhere?
> Thank you very much again!!
> Mat
>
> ----- Message d'origine ----
> De : Dennis Kubes <nu...@dragonflymc.com>
> À : nutch-user@lucene.apache.org
> Envoyé le : Mardi, 10 Octobre 2006, 19h57mn 17s
> Objet : Re: Searching terms saved in a file
>
> You would have to write something that would loop through the file and
> then construct a Query object using the addRequired and addProhibited
> methods to add your terms and phrases. Then pass that into the
> appropriate NutchBean search method to get your results.
>
> Dennis
>
> frgrfg gfsdgffsd wrote:
>
>> Hi all,
>>
>> As a new nutch's user, I am quite stuck regarding this:
>> How can I launch a search using a file containing my terms/keywords instead of typing them in search.jsp??
>> Do I have to use the Query.term class? If yes, How and where do I use this class?
>> Thanks a lot!
>>
>>
>> Mat
>>
>>
>>
>>
>>
>>
>>
>>
>> ___________________________________________________________________________
>> Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
>> Demandez à ceux qui savent sur Yahoo! Questions/Réponses
>> http://fr.answers.yahoo.com
>>
>>
>
>
>
>
>
>
>
>
>
>
>
> ___________________________________________________________________________
> Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
> Demandez à ceux qui savent sur Yahoo! Questions/Réponses
> http://fr.answers.yahoo.com
>