Re: qualifierWithQualifierFormat
Re: qualifierWithQualifierFormat
- Subject: Re: qualifierWithQualifierFormat
- From: Arturo PĂ©rez <email@hidden>
- Date: Thu, 22 Sep 2005 19:57:04 -0400
Just to elaborate on what Chuck said as I believe the EOQualifier
subclasses are underutilized.
NSMutableArray ors = new NSMutableArray();
java.util.Enumeration e = targetWordList.objectEnumerator();
while (e.hasMoreElements()) {
String aProdDescription = (String)e.nextElement();
EOKeyValueQualifier keyQual = new
EOKeyValueQualifier("prodDescription",
EOQualifier.CaseInsensitiveLike,
"*"+ aProdDescription + "*");
ors.addObject(keyQual);
}
EOOrQualifier orQual = new EOOrQualifier(ors);
Also, for good performance you should look into whether your DB has a
natural language search engine built-in. Not a MySQL fan so I don't
know what it has but PostgreSQL has tsearch and Oracle has Context (or
do they just call it Text now?). I like Lucene but it can be a chore
to integrate. I personally favor Convera's Retrievalware. It's real
spyware after all (i.e. U.S. intelligence depts use it).
-arturo
On Sep 22, 2005, at 6:19 PM, Chuck Hill wrote:
I think you pretty much have it.
NSSet stopWords = new NSSet(new String[] {"at", "the", "a", "it"});
String searchString; // assume this exists
NSSet targetWords = new
NSSet(NSArray.componentsSeperatedByString(searchString, "
").setBySubtractingSet(stopWords);
NSArray targetWordList = targetWords.allObjects();
Now just run a loop over targetWordList making a qualifier as below.
Add them to an array. Use and EOAndQualifier or EOOrQualifier to get
the final qualifier.
Or, if you want good performance, Google on 'Lucene'.
Chuck
On Sep 22, 2005, at 3:06 PM, Gino Pacitti wrote:
Hi All
I have a qualifier statement like this:
qualifier = EOQualifier.qualifierWithQualifierFormat(
"prodDescription like %@", qualifierBindings );
and the qualifierBindings
NSArray qualifierBindings = new NSArray ( new String [] {
"*"+"hats"+"*" } );
But this only allows me to search the prodDescription with a single
word.
How would I create a statement that would allow me to return objects.
I want to create something like:
prodDescription like 'word' OR prodDescription like 'otherword' OR
prodDescription like 'someotherword' etc..
I need to take a string and filter out words like 'at', 'the', 'it'
etc and then search for prodDescriptions that contain any of the
words remaining.
I hope this is clear...
Any help appreciated!!
Gino
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
village.net
This email sent to email@hidden
--
Coming in 2006 - an introduction to web applications using WebObjects
and Xcode http://www.global-village.net/wointro
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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