poovarasanvasudevan / javaboss

Automatically exported from code.google.com/p/javaboss
Apache License 2.0
0 stars 0 forks source link

How to add filetype filter? #3

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi, I would like to add a filetype filter to my search. I have seen that class 
com.jellymold.boss.WebSearch has a method 
"setFilters(Set<com.jellymold.boss.WebSearch.WebSearchFilter> filters)".  
Unfortunately I cannot 
figure out how to create such a set with a file type filter. For any help I 
woul be very greatful.
Cheers,
Toby

Original issue reported on code.google.com by tobias.w...@gmail.com on 28 Jan 2010 at 11:43

GoogleCodeExporter commented 8 years ago
this is not currently supported, although it looks easy enough to add.  From 
the 
Yahoo! documentation : 
http://developer.yahoo.com/search/boss/boss_guide/Web_Search.html

Optional: This argument specifies what document types to return. The argument 
value consists of a comma-separated list specifying the document types or type 
groups to include. A format group is a logical collection of several document 
formats 
for simplification. Format currently supports the following document types:
html
text
pdf (Adobe Portable Document Format)
xl (Microsoft Excel: xls, xla, xl)
msword (Microsoft Word)
ppt (Microsoft Power Point)
Format currently supports the following type groups:
msoffice: xl, msword, ppt
nonhtml: text, pdf, xl, msword, ppt
You can also specify a format group then exclude an item:
type=msoffice,-ppt
This example searches for the same query term in the nonhtml type group (text, 
pdf, 
xl, msword, ppt):
type=nonhtml
You can combine inclusion, exclusion, document types, and type groups like this:
type=html,msoffice,-pdf
Example:
http://boss.yahooapis.com/asearch/web/v1/moon?
format=xml&count=2&type=msoffice

Effectively, the library would need modifying to be able to append the 'type' 
parameter to the request url and give API users some way to specify this.  I'll 
leave 
this open as a possible enhancement, if anyone wants to chip in and submit a 
patch 
or be added to the project let me know.  Otherwise I'll try and add it when I 
get time.

Original comment by wiredupa...@gmail.com on 28 Feb 2010 at 4:19