That will work. Thank you very much Ravinder.

On Jul 2, 7:49 am, 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.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to