-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix searching number fields #624
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice.
Just one minor change-request to be more clear about the attributeDetails.
src/Field/WfsSearch/WfsSearch.jsx
Outdated
* An object mapping feature types to an array of attribute details. | ||
* @type {Object} | ||
*/ | ||
attributeDetails: PropTypes.object, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make use of PropTypes.shape
.
This way you can define the existing detail keys and their types.
e.g.:
// An object taking on a particular shape
attributeDetails: PropTypes.shape({
exactSearch: PropTypes.bool,
type: PropTypes.oneOf(['int', 'string', 'number', …]),
…
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, added in 3dec246.
Nice. Didn't expect teh attribtueDetails as this complex but it looks quite strict now. 👍 So i guess the structure is something like this?: {
layer1: [{
attribute1: {
matchCase: true,
type: 'number',
exactSearch: false
},
attribute2: {
matchCase: false,
type: 'string',
exactSearch: true
},
…
}],
layer2: […],
…
} |
Yes, exactly. It looks quite complex, but at least it matches the structure of the |
chore: enable typescript to emit declarations
FEATURE
Description:
This PR fixes searching number fields via WFS. This is still far from perfect. You can configure the WFS search now with attribute details, which allows you to control how filters are created.
matchCase
can be used to control the corresponding filter attribute,exactSearch
will make the code check for attributes of typenumber
andint
and skip the filter completely if the search term contains non numeric characters.We should really think about doing a solr or elastic search backend in order to get better results.
@terrestris/devs Please review.