Fulltextsearch

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Fulltextsearch

martin.kaiser@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
Reply | Threaded
Open this post in threaded view
|

Re: Fulltextsearch

Jacques Le Roux
Administrator
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" <[hidden email]>
> 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
>
Reply | Threaded
Open this post in threaded view
|

Re: Fulltextsearch

Martin Kaiser
Thank you Jacques! I think this will help.

Martin


On 4 March 2013 23:54, Jacques Le Roux <[hidden email]> 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" <[hidden email]>
> > 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
> >
>