Filtering custom columns on a folderish document with custom page provider

We have a section in Nuxeo for employee photos. These files are their own doctype contained in a custom, folderish doctype called “Library.” For this Library, I have created a custom page provider with predicates and aggregates of schema fields relevant to these types of documents. I am having an issue with the filters for some of the fields though.

For example, every employee has an employee ID, so I have a schema/field for it called employee:employee_id (set as a string since IDs can contain letters or numbers). In the view of the parent container (Library) there is code to add a search filter in table view:

<nuxeo-data-table-column 
    name="Employee ID" 
    field="employee:employee_id"
    sort-by="[[_displaySort(document, 'employee:employee_id')]]" 
    filter-by="employee_employee_id" 
    filter-expression="$term*"
    flex="25">
    <template>[[item.properties.employee:employee_id]]</template>
</nuxeo-data-table-column>

That field is a predicate in my custom page provider, with a full text operator. Here is the setup: predicate-editor

The issue I have is that for some IDs that all all numbers the filter works as expected and filters correctly as a user types in characters. However, for any of the IDs that start with letters the filter doesn't find anything at all. What could be causing this issue? I've tried different config settings, but I'm missing something (likely simple). Any guidance would be appreciated. Thanks.

I've attached a video demo of the search not working for an ID that starts with letters.

demo

FILES:   demo.gif   config.png
0 votes

2 answers

246 views

ANSWER

Hello, have you observed the same behavior with the STARTSWITH search operator?
04/09/2021

If I use STARTSWITH then filtering doesn't work at all—it doesn't even work for the numbers that were working before. Also, it seems STARTSWITH should only be used for a path-type value?
04/09/2021

The fulltext analyser behaviour can very between the backend database: what are you using? What is your Nuxeo distribution version?
04/09/2021

We are on LTS 2019-HF42 (date 201901211253). Looks like Database is default of H2/Derby embedded databases, and I don't know much more since we are NCO—so whatever is the default for all of that.
04/09/2021

Please do not open questions on answers.nuxeo.com if the question is related to a client: create a support ticket (jira.nuxeo.com). Thx
04/21/2021

I thought that more general questions would be better served in this forum as others may have the same issues (I also didn't want to inundate support with tickets). However, I will do that from now on instead of using answers.nuxeo.com if that is the preferred option.
04/21/2021



Here is the final config that we are running with that works (at least mostly).

Screen Shot 2021-05-06 at 2.43.50 PM.png

0 votes



Phil Ludlow I know the thread stopped a while ago, has your issue been resolved? My 2 cents: you may need to update ES mappings, title “Making STARTSWITH work” sounds promising ;-) https://doc.nuxeo.com/nxdoc/configuring-the-elasticsearch-mapping/#making-startswith-work-with-a-custom-field

0 votes



I should have posted back with the solution we went with. Thanks for the reference, we didn't go with STARTSWITH since it seemed to be specifically for path-like data, but we probably could make a custom ES mapping based on what you linked.

The "fix" for us was adding the operator of "wildcard" on the predicate editor. This helped so that we could put characters or numbers in the search filter and it would work as expected. The only deficiency we have right now is that it is case-sensitive. This likely could all be a bit more improved, but for the time-being it works well enough.

05/06/2021