Hey

One simplest way is copy BasicQueryFilter class and rename it, then
modify the FIELDS/FIELD_BOOSTS by replacing them with you meta tags
from nutch config. And don't forget the configuration in your query
filter's plugin.xml.

Good luck!
/Jack

On 2/24/06, Vanderdray, Jacob <[EMAIL PROTECTED]> wrote:
>
> Jérôme,
>
>         Thanks for think link you sent earlier.  I've read through that 
> discussion and I think my problem must be related, but I'm still banging my 
> head against it.  I'm pretty sure that there's something I'm missing about 
> how the queries get added together.
>
>         As it stands my query filter seems to modify the ranking, but doesn't 
> affect the results returned.  I've pasted my code bellow and I'd appreciate 
> it if someone could take a look and let me know if they see the problem.
>
> Thanks,
> Jake.
>
> public class MetaQueryFilter implements QueryFilter {
>
>   private static final Logger LOG = LogFormatter
>     .getLogger(MetaQueryFilter.class.getName());
>
>   /**
>    * Need to pull out the list of meta tags from the configuration
>    */
>   private static String [] META_TAGS =
>                   NutchConf.get().getStrings("meta.names");
>
>   /**
>    * We're going to go through and create search filters for each of the 
> meta-tags we were asked to index.
>    */
>   public BooleanQuery filter(Query input, BooleanQuery output) {
>                   // If no meta-tags were specified in the conf file, then 
> don't bother wasting cycles
>                   if ( META_TAGS.equals(null) ) {
>                                   return output;
>                   }
>
>                   addTerms(input, output);
>                   return output;
>   }
>
>   private static void addTerms(Query input, BooleanQuery output) {
>                   Clause[] clauses = input.getClauses();
>                   for (int x = 0; x < clauses.length; x++) {
>                                   Clause c = clauses[x];
>                                   if 
> (!c.getField().equals(Clause.DEFAULT_FIELD))
>                                           continue;             // skip 
> non-default fields
>
>                                   // These are the fields we're interested in 
> indexing
>                                   String [] tagsToIndex = META_TAGS;
>
>                                   for (int i = 0; i < tagsToIndex.length; 
> ++i) {
>                                                   LOG.info("Meta Query 
> Filter: Adding a search for " + tagsToIndex[i]);
>
>                                                   Term term = new 
> Term(tagsToIndex[i], c.getTerm().toString());
>
>                                                   // add a lucene PhraseQuery 
> for this tag
>                                                   PhraseQuery metaQuery = new 
> PhraseQuery();
>                                                   metaQuery.setSlop(0);
>                                                   metaQuery.add(term);
>
>                                                   // set boost
>                                                   metaQuery.setBoost(2.0f);
>
>                                                   // add it as a specified 
> query
>                                                   output.add(metaQuery, 
> false, false);
>                                   }
>                   }
>   }
>
> }
>


--
Keep Discovering ... ...
http://www.jroller.com/page/jmars


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Nutch-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nutch-general

Reply via email to