[FIXED] Search results are different when searching in code and in Flickr.com

Topics: Developer Forum, Project Management Forum, User Forum
May 14, 2012 at 5:33 AM
Edited May 17, 2012 at 8:43 AM

FIXED

Using .Text and .SortOrder=PhotoSearchSortOrder.Relevance did the job

 


 

I'll be posting pictures why it was different and please tell me if I did something wrong. 

The pictures I'll be showing: starting from Left

  • Flickr.com search result
  • .NET search result
  • actual code
  • the sample UI

 

click on the images for larger version

searching for windowsphone7

Photobucket

searching for windows phone

Photobucket

searching for htc

Photobucket

searching for microsoft

Photobucket

why are they different??

May 14, 2012 at 7:23 AM

I just want to update this. I found out that PhotoSearchOptions.Tags is used to look for specific tags.

 

how do I search by not using Tags. I mean the regular Flickr query.

Coordinator
May 15, 2012 at 9:31 PM

To search by text rather than tag use PhotosSearchOptions.Text parameter.

Also, to get a proper match for the same search on the Flickr web site you would have to authenticate your call to the Flickr API, otherwise private, moderated and restricted photos are not returned.

Sam

May 16, 2012 at 4:51 AM

Thanks Sam. 

But am not sure why it gives the same results as Tags.

 

Any ideas?

Coordinator
May 16, 2012 at 12:46 PM

If you don't authenticate the call you won't see moderated, restricted or private photos. If you search by Text or Tags the results will be different, just as they are on the Flickr web site if you search by text or tags:

Tags: http://www.flickr.com/search/?q=windowsphone7&ss=2&m=tags

Text: http://www.flickr.com/search/?q=windowsphone7

Sam

May 16, 2012 at 11:09 PM

am not sure what you mean by authenticate. Is that using the API key an authentication?

 

I have here the code

string apikey = ApiKey.Text; // the api key
Flickr flickr = new Flickr(apikey);

PhotoSearchOptions searchOptions = new PhotoSearchOptions();
searchOptions.Text = txSearch.Text;
searchOptions.PerPage = 20;

PhotoCollection photocoll = flickr.PhotosSearch(searchOptions);

but still shows a .Tags result even if I use the .Text property. 

Coordinator
May 17, 2012 at 8:34 AM

The issue I think is the default sort order. The default when using the Flickr API is date-posted-desc. This matches exactly what is used on the Flickr web site for a tag based search. However the Flickr web site uses relevance when doing a full text search.

Try setting searchOptions.SortOrder = PhotoSearchSortOrder.Relevance to match the results from the Flickr web site.

Sam

May 17, 2012 at 8:40 AM

Thanks Sam. That worked!

May 17, 2012 at 10:56 AM

I'd like to add if it's possible to search an image with a min or max Width and Height option?

Coordinator
May 17, 2012 at 11:07 AM

No, there is not way in Flickr to do that kind of search I'm afraid. If Flickr ever supports it I will add it to the FlickrNet library.

Sam

May 17, 2012 at 11:30 AM

Understood. Thanks again!