Differences between revisions 1 and 2
Revision 1 as of 2006-08-23 13:59:44
Size: 1373
Editor: pool-68-160-34-54
Revision 2 as of 2009-09-20 23:09:58
Size: 1373
Editor: localhost
Comment: converted to 1.6 markup
No differences found!


Howto add a category metadata to your index and be able to search for it. For this, you need to write an indexing filter and a query filter.

Indexing your custom metadata

For the indexing filter, copy the index-more plugin, and change names, dirs, and build files appropriately. The main thing to change is the filter method:

     public Document filter(Document doc, Parse parse, FetcherOutput fo)

In it, you can add your own fields. To add a new category with value "puppies", it will look something like this:

     doc.add(new Field("category", "puppies", false, true, false));

See the Document.add API for more info on the booleans.

That's pretty much it for indexing.

Searching your metadata

To search for this, you need to create a query filter. Copy the query-site plugin. Again change file names, directories, and build files as needed. The main java file is very simple, just change the string in the line with "super". Instead of:


You would have


Make sure that you put your new index-category and query-category plugins in your nutch-default.xml file. Don't forget to check that it's in your WEB-INF/classess directory too.

Credits: HowieWang Thread: http://www.nabble.com/index-search-filtering-by-category-tf2136864.html

CreateNewFilter (last edited 2009-09-20 23:09:58 by localhost)