tags:

views:

168

answers:

3

Say,search for results whose Field is 'A' or 'B'?

it seems the default is AND.

A: 

Never worked with Nutch actively, but since it's based on Lucene, shouldn't Lucene's rules apply? That is to say, the Query Parser Syntax should be applicable. See if this helps.

pugmarx
seems not,I've tried that days ago,or you can try it out here:http://file.jobirn.com:8080/ROOT-resume
Shore
probably you're right. do have a look at: http://blog.tcg.com/tcg/2009/03/adding-the-boolean-operator-or-to-nutch.html. seems there's a patch for it.
pugmarx
Thanks,let me try it.BTW,are you familiar with Query.parse(queryString, queryLang, nutchConf)?Do you know which fields are searched by this API call?
Shore
A: 

Hi, i was recently started working with nutch .you need to modify the query.java in nutch to get OR query exicuted. Add the code in Query.java

public void addShouldTerm(String term, String field) { clauses.add(new Clause(new Term(term), field, false, false, this.conf)); }

public void addShouldTerm(String term) { addShouldTerm(term, Clause.DEFAULT_FIELD); }

and form your query like

Query query= new Query(conf); query.addNotRequiredTerm("A"); query.addNotRequiredTerm("B"); you will get the results for A Or B.

Please correct me if any other way of doing or better way.

A: 

Never used nutch for querying (just for indexing), but the schmea.xml should conatin a defaultOperator which can be set to AND or OR.

svenkubiak