• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Spotlight Query: can't get relevant relevance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Spotlight Query: can't get relevant relevance


  • Subject: Spotlight Query: can't get relevant relevance
  • From: Nicolas Seriot <email@hidden>
  • Date: Sat, 8 Dec 2007 18:26:48 +0100

Hello,

I need to get the relevance of a query item.

I think the values I get are wrong.

Here is the code:

NSPredicate *p = [NSPredicate predicateWithFormat:@"kMDItemTextContent LIKE[c] \"apple\" AND kMDItemContentTypeTree == \"com.adobe.pdf\""];
[query setPredicate:p];
[query setValueListAttributes:[NSArray arrayWithObjects:(NSString *)kMDQueryResultContentRelevance, nil]];
[query startQuery];


	// ...

NSNumber *relevance = [query valueOfAttribute:NSMetadataQueryResultContentRelevanceAttribute forResultAtIndex:i];

Problem 1:

According to NSMetadataQuery Class Reference: "An NSNumber object with a floating point value between 0.0 and 1.0 inclusive."

The relevance I get is always between 0.10000 and 0.10002, for every predicate I run.

So, it is not wrong according to the API, but these values let me think I do not write what I should.

Problem 2:

In the arguments of [query setValueListAttributes:] I wonder why I have to use kMDQueryResultContentRelevance.

If I use NSMetadataQueryResultContentRelevanceAttribute the relevance is null.

If I ask the query for its attribute kMDQueryResultContentRelevance, the relevance is the same, between 0.10000 and 0.10002.

How can I get relevant relevance? :-)

--
Nicolas Seriot
http://seriot.ch
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: detecting no internet connection
  • Next by Date: Re: detecting no internet connection
  • Previous by thread: Re: detecting no internet connection
  • Next by thread: Transformable Attributes
  • Index(es):
    • Date
    • Thread