neodash icon indicating copy to clipboard operation
neodash copied to clipboard

Parameter-Select autocomplete doesn't find correct value; expected value is substring of autofill-results

Open jsuesse opened this issue 2 years ago • 1 comments

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 image

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!

jsuesse avatar Jul 11 '22 10:07 jsuesse

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.

jsuesse avatar Jul 13 '22 10:07 jsuesse

Closing due to merge on Aug 4.

BennuFire avatar Dec 05 '22 19:12 BennuFire