Re: searching for a word
Re: searching for a word
- Subject: Re: searching for a word
- From: Florijan Stamenkovic <email@hidden>
- Date: Sun, 8 May 2005 13:49:55 +0200
On May 08, 2005, at 13:19, Graham Cruse wrote:
Hi,
What you are looking for I think is a compound qualifier, in this case
an
EOOrQualifier which you would takes as a parameter to the constructor
an
array of qualifiers. You require a seperate qualifier for each of the
cases
you list, place these qualifiers into an array and pass them to the
EOOrQualifier when you create it.
e.g.
args.addObject("* dog");
EOQualifier qual1 = EOQualifier.qualifierWithQualifierFormat
("resourceKeywords caseInsensitiveLike %@args);
("resourceKeywords caseInsensitiveLike %@", args);
args.removeAllObjects();
args.addObject("* dog *");
EOQualifier qual2 = EOQualifier.qualifierWithQualifierFormat
("resourceKeywords caseInsensitiveLike %@args);
("resourceKeywords caseInsensitiveLike %@", args);
NSMutableArray quals = new NSMutableArray();
quals.addObject(qual1);
quals.addObject(qual2);
EOOrQualifier orQualifier = new EOOrQualifier(quals);
Or at least it's an alternative method, hope it's useful.
I think it will result in the same results, only through more code....
I still can't find that page where I saw the code for an arbitrary
number of search strings in only one qual construction. As I remember,
the example went like this:
EOQualifier.qualifierWithFormat("resourceKeywords caseInsensitiveLike
%@", new Array(Object[] {"* dog *", "* dog"}));
and should get the same results as the way described above...
Cheers
F
Graham
----- Original Message -----
From: "Florijan Stamenkovic" <email@hidden>
To: "WebObjects Development" <email@hidden>
Sent: Sunday, May 08, 2005 10:15 AM
Subject: Re: searching for a word
Hi...
On May 07, 2005, at 19:34, Michael Warner wrote:
I have a keyword field that for example has the word 'dog' in it as
one, of say, 20 words.
I want to fetch records that contain the separate word 'dog' in this
keyword field. At the same time,
records that contain words where the string 'dog' is anywhere
embedded in the word, yet do not
contain dog as a separate word, should not be returned.
I tried the following, but got records back where 'dog' was embedded
in other words:
args.addObject("dog *"); //if dog is the first word in a set of
words
args.addObject("* dog *"); //if dog is a separate word, but not
first or last
args.addObject("* dog"); //if dog is the last word
This is ok I think.... I use the wildcard the same way and it works
fine.
EOQualifier qual = EOQualifier.qualifierWithQualifierFormat
("resourceKeywords caseInsensitiveLike %@
OR resourceKeywords caseInsensitiveLike %@
OR resourceKeywords caseInsensitiveLike %@",args);
I don't think you need all those qualifications. I think you can pass
an array of a couple arguments and make it work like
EOQual.qualWithQualFormat("ResourceKeywords caseInsensitiveLike %@",
args);
and that eof will create a qualification including all the arguments
in
args. I saw this in one part of the documentation, but couldn't point
you anymore... Not in the JavaDocs. I found that part (argument
handling) not so in-depth explained. Try it out!
Question 1: Am I using the wildcard * correctly? If no, what is the
correct syntax?
Yup. Think so.
Question 2: Am I using an efficient approach for this type of search?
If no, what is
a better approach, assuming that I don't want to use
qualifyDataSource in DisplayGroups?
Thanks,
Mike W.
Florijan
Michael M. Warner, Ph.D.
Department of Educational Specialties/299
University of Nevada, Reno
Reno, NV 89557-0251
Phone: (775) 784-4383 x2039
Fax: (775) 784-4384
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden