neodash
neodash copied to clipboard
Parameter-Select autocomplete doesn't find correct value; expected value is substring of autofill-results
Setup
- NeoDash version: 2.1.2
- Neo4j Database version: 4.4.8 (Community.
Somewhat related issues:
#50 was fixed by allowing manual editing of property-name This could be solved by allowing manual entering of property-value
Steps to reproduce
- use a parameter-select card
- set label and property
- Want to select a string e.g.
zoo
- a node with exact match where node.property="zoo" exists!
Expected behavior
results show exact match first, it can be selected.
Actual behavior
- results that contain that substring, but come before it in the alphabet are shown first.
-
zoo
can't be selected results:
alabama_zoo
best_zoo
example_zoo
fantastic_zoo
great_zoo
See image: Blue-Boxes are the same string
It seems that the results are determined by checking if string contains substring, then sorting these results. Instead, exact matches should appear first in list.
Workaround
Use Free-Text-Select. Selection of any value is possible there.
Thanks for considering. Have a great day!
Propose fix:
In /src/card/settings/custom/CardSettingsContentPropertySelect.tsx
insert ORDER BY size(value) ASC
into line 95
and line 98
.
example for line 95: change from
const newQuery = "MATCH (n:`" + entityType + "`) \nWHERE toLower(toString(n.`" + propertyType + "`)) CONTAINS toLower($input) \nRETURN DISTINCT n.`" + propertyType + "` as value LIMIT 5";
to
const newQuery = "MATCH (n:`" + entityType + "`) \nWHERE toLower(toString(n.`" + propertyType + "`)) CONTAINS toLower($input) \nRETURN DISTINCT n.`" + propertyType + "` as value ORDER BY size(value) ASC LIMIT 5";
Might create a proper PR when I find time.
Closing due to merge on Aug 4.