You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Martin Kaiser <ma...@gmail.com> on 2013/03/04 22:28:23 UTC

Fulltextsearch

Hi all,

I have a short question: Is it possible to do a full text search on
multiple fields, e.g. firstName and lastName on Person entity? How can this
be done?

Thanks & best regards,
Martin

Re: Fulltextsearch

Posted by Martin Kaiser <ma...@martin-kaiser.info>.
Thank you Jacques! I think this will help.

Martin


On 4 March 2013 23:54, Jacques Le Roux <ja...@les7arts.com> wrote:

> delegator.findByAnd("Person", using like  on both Person fields
>
> Have a look at PartyServices.findParty(), notably those lines
>
> // filter on firstName
> if (UtilValidate.isNotEmpty(firstName)) {
>     paramList = paramList + "&firstName=" + firstName;
>
> andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("firstName"),
> EntityOperator.LIKE, EntityFunction.UPPER("%"+firstName+"%")));
> }
>
> // filter on lastName
> if (UtilValidate.isNotEmpty(lastName)) {
>     paramList = paramList + "&lastName=" + lastName;
>
> andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("lastName"),
> EntityOperator.LIKE, EntityFunction.UPPER("%"+lastName+"%")));
> }
>
>
> It'a bit out of context, but if you want more, you might be interested by
> https://issues.apache.org/jira/browse/OFBIZ-5042
>
> Jacques
>
> From: "Martin Kaiser" <ma...@gmail.com>
> > Hi all,
> >
> > I have a short question: Is it possible to do a full text search on
> > multiple fields, e.g. firstName and lastName on Person entity? How can
> this
> > be done?
> >
> > Thanks & best regards,
> > Martin
> >
>

Re: Fulltextsearch

Posted by Jacques Le Roux <ja...@les7arts.com>.
delegator.findByAnd("Person", using like  on both Person fields

Have a look at PartyServices.findParty(), notably those lines

// filter on firstName
if (UtilValidate.isNotEmpty(firstName)) {
    paramList = paramList + "&firstName=" + firstName;
    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("firstName"), EntityOperator.LIKE, EntityFunction.UPPER("%"+firstName+"%")));
}

// filter on lastName
if (UtilValidate.isNotEmpty(lastName)) {
    paramList = paramList + "&lastName=" + lastName;
    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("lastName"), EntityOperator.LIKE, EntityFunction.UPPER("%"+lastName+"%")));
}


It'a bit out of context, but if you want more, you might be interested by 
https://issues.apache.org/jira/browse/OFBIZ-5042

Jacques

From: "Martin Kaiser" <ma...@gmail.com>
> Hi all,
> 
> I have a short question: Is it possible to do a full text search on
> multiple fields, e.g. firstName and lastName on Person entity? How can this
> be done?
> 
> Thanks & best regards,
> Martin
>