JSDO and the use of contains (word index)

Posted by peggycole on 02-Aug-2016 02:14

Hi,

We are developing a new website with Kendo UI and JSDO's. We notice a problem when sending a ablfilter to the back end if we want to search with the contains functionality. The progress.all.js we use (https://github.com/CloudDataObject/JSDO/blob/master/lib/progress.all.js) composes the ablfilter with the index-function but in OpenEdge the index function is not the same as the contains function so our queries are not using the available word indexes (instead we would have some bad query performance).

So this is what we receive at the back end: {"ablFilter":"(nad_obj = '31557015,0421' and orgcy_obj = '14490001,0421' and INDEX(search_param, 'WMSAR.WMSAR_Article_Number!colormax') > 0)","tableRef":"tUniqueArticle","viewTables":""}

And this is what we were expecting (and would work with the current back end):

{"ablFilter":"(nad_obj = '31557015,0421' and orgcy_obj = '14490001,0421' and search_param contains 'WMSAR.WMSAR_Article_Number!colormax')","tableRef":"tUniqueArticle","viewTables":""}.

Does somebody know how we can establish this? Is there somewhere another version of progress.all.js available we can use that includes this functionality?

Some other facts (may be not relevant):  OpenEdge 11.6, use of business entities, via appserver (not pasoe)

Kind regards,

Peggy

All Replies

Posted by Mike Fechner on 02-Aug-2016 02:29

You can certainly fork the JSDO and implement it yourself.

Or handle the query string on the backend and perform query optimization there.

Posted by peggycole on 02-Aug-2016 02:33

Modifying the back end is the next idea but I hoped for an already existing solution in the first place :-)... But there isn't?

Posted by Mike Fechner on 02-Aug-2016 02:37

Well there are solutions for this available on the backend ;-) See below ...

Posted by peggycole on 02-Aug-2016 02:39

:-)

Posted by Mike Fechner on 02-Aug-2016 02:43

If I'm not mistaking, you are using "our" fork of the JSDO already.

Posted by egarcia on 02-Aug-2016 06:28

Hello Peggy,

Thank you for your feedback.

The JSDO processes the filter expressions from the Kendo UI DataSource using the JSON Filter Pattern (JFP) if mappingType=JFP has been specified in the Business Entity.

The mapping for the "contains" operator is done using INDEX instead of CONTAINS so that it can be used with any character field, not only those with a Word Index.

The suggestion from Mike is possible.

You could change the code in _convertToABLWhereString() to use CONTAINS instead of INDEX.

This would also allow you to use operators such as ^ and | rather than using them as the literal characters.

Do you expect to be able to use these operators?

Another alternative, would be to use a custom mappingType where you get the raw JSON filter on the server and process it on the Business Entities. Please let me know if you would like to know more about this approach.

I think that in a future version, we could enable the usage of CONTAINS (instead of INDEX) by identifying the fields in the catalog as supporting Word Index (wordIndex=true).

I will add a story to our backlog to look into this for a future version.

Thank you and regards,

Edsel

Posted by peggycole on 02-Aug-2016 06:55

Edsel,

Thank you for your suggestions. For now, we will add a "translation" from index to contains in our back end. I think this we will be the quickest way for us to go on.

If it would be possible to use the 'contains' function in the JSDO (in combination with a wordindex=true setting in the catalog file) that would be a good evolution :-)

Kind regards,

Peggy

Posted by peggycole on 02-Aug-2016 07:00

We are using this: github.com/.../progress.all.js. I didn't know there where variants?

Posted by Mike Fechner on 02-Aug-2016 07:02

Are you sure? Your filter contains the viewTables option - which is an addition in our fork.

Posted by peggycole on 02-Aug-2016 07:10

The back end is not doing anything with the viewtables/tableref options and the guys writing our front ensured me it was that js-file they're using. I will ask them again. Would it be a problem for you if there using yours instead of the standard one?

Posted by Mike Fechner on 02-Aug-2016 07:44

[quote user="peggycole"]

Would it be a problem for you if there using yours instead of the standard one?

[/quote]

Not for me - unless you don't ask for support :-) I'd only support our framework customers. And I'm not sure if Progress would like to support a customized version of the JSDO.

Posted by peggycole on 02-Aug-2016 07:47

Mike,

I sent you an email!

This thread is closed