Hey,
Pl see the answers to the questions below.
Gautham Pai wrote:
I have seen this question being asked multiple times in this forum. However
this has confused me more because each has its own approach to solving the
issue and no one has outlined the steps in one place. The tutorials seem to
be a bit outdated too.
The version of Nutch I am using is 0.9.
I have 3 custom fields that I have added via an IndexingFilter. The fields
are: author, title and description. I now intend to provide support for
querying these fields as:
author:Gautham
title:Nutch
etc.
I added an Author class as follows:
public class Author extends RawFieldQueryFilter {
private Configuration conf;
public Author() {
super("author", 5f);
}
public void setConf(Configuration conf) {
this.conf = conf;
}
public Configuration getConf() {
return this.conf;
}
}
and made an entry in plugin.xml as:
<extension id="query.Author"
name="Author"
point="org.apache.nutch.searcher.QueryFilter">
<implementation id="Author"
class="query.Author">
<parameter name="fields" value="author"/>
</implementation>
</extension>
When I use NutchBean to perform the query, I see no results. I also tried
changing the RawFieldQueryFilter to QueryFilter and following the approach
used in the query-more plugin. It does not seem to work either.
The questions I have specifically are:
* Do I need to create one class per custom field that I intend to provide
support for query?
Generally, one class for all the custom fields is sufficient. In your
case too, u should be able to do with one class
* Should I use RawFieldQueryFilter or QueryFilter?
RawFieldQueryFilter implements QueryFilter , So I would use
RawfieldQueryFilter.
* Should I make an entry as: <parameter name="fields" value="author"/> or
<parameter name="fields" value="DEFAULT"/> in plugin.xml?
In your case,
<parameter name="fields" value="author, title, description"/> should solve the
problem.
Check "out org.apache.nutch.searcher.QueryFilters" class's Ctor.
Any help or pointers is greatly appreciated.
Thanks,
Gautham.
--
This message has been scanned for viruses and
dangerous content and is believed to be clean.