searchWords is list of strings. On Wed, Jul 7, 2010 at 4:38 AM, Julian! <julia...@gmail.com> wrote:
> Hi There > > searchWords is a List of User entity that contains All tokens? > > the filter in de JDOQL WHERE searchWords == \""+tag.toUpperCase()+. > find some token in all elements on the List property ??? > > > Thanks !! > > > On 2 jul, 06:49, RAVINDER MAAN <rsmaan...@gmail.com> wrote: > > we can set it in following way > > > > public class User { > > > > @Persistent(defaultFetchGroup="true") > > private Set<String> searchWords; > > > > public static void getCombination(String word,Set searchWords){ > > word = word.trim().toUpperCase(); > > if(word == null || "".equals(word)) > > return ; > > int wordLength = word.length(); > > while(true){ > > for(int i=0;i<wordLength - 2;i++){ > > searchWords.add(word.substring(i, wordLength));} > > > > for(int i=wordLength-1;i > 1;i--){ > > searchWords.add(word.substring(0, i));} > > > > word = word.substring(1,wordLength-1); > > wordLength = word.length(); > > if(wordLength <= 2) > > break; > > else > > searchWords.add(word);} > > return ; > > } > > > > public List<User> search(String tag){ > > PersistenceManager pm = PMF.getPM(); > > Transaction tx=pm.currentTransaction(); > > try > > { > > tx.begin(); > > > > Query q = pm.newQuery("javax.jdo.query.JDOQL","SELECT FROM > > "+User.class.getName()+" WHERE searchWords == > \""+tag.toUpperCase()+"\""); > > q.setRange(0,10); > > List<User> c = (List<User>)q.execute(); > > tx.commit(); > > return c;} > > > > finally > > { > > if (tx.isActive()) > > { > > tx.rollback(); > > } > > > > pm.close();} > > > > } > > > > } > > > > You can modify getCombination the way you want. > > > > -- > > > > Regards, > > Ravinder Singh Maan > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > google-appengine-j...@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > -- Regards, Ravinder Singh Maan -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.