Skip to content

Commit

Permalink
node property parameter-select: order results by size ASC (#173)
Browse files Browse the repository at this point in the history
* sort parameter-select results by size ASC

Related to #163

* Make change more explicit by adding "ASC"

* Casting values to string so that we can always sort by size

Co-authored-by: Niels de Jong <[email protected]>
  • Loading branch information
jsuesse and nielsdejong authored Aug 3, 2022
1 parent 7c7c13c commit 12d1b7a
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ const NeoCardSettingsContentPropertySelect = ({ type, database, settings, onRepo
// Set query based on whether we are selecting a node or relationship property.
onReportSettingUpdate('parameterName', new_parameter_name);
if (settings['type'] == "Node Property") {
const newQuery = "MATCH (n:`" + entityType + "`) \nWHERE toLower(toString(n.`" + propertyType + "`)) CONTAINS toLower($input) \nRETURN DISTINCT n.`" + propertyType + "` as value LIMIT 5";
const newQuery = "MATCH (n:`" + entityType + "`) \nWHERE toLower(toString(n.`" + propertyType + "`)) CONTAINS toLower($input) \nRETURN DISTINCT n.`" + propertyType + "` as value ORDER BY size(toString(value)) ASC LIMIT 5";
onQueryUpdate(newQuery);
} else if (settings['type'] == "Relationship Property"){
const newQuery = "MATCH ()-[n:`" + entityType + "`]->() \nWHERE toLower(toString(n.`" + propertyType + "`)) CONTAINS toLower($input) \nRETURN DISTINCT n.`" + propertyType + "` as value LIMIT 5";
const newQuery = "MATCH ()-[n:`" + entityType + "`]->() \nWHERE toLower(toString(n.`" + propertyType + "`)) CONTAINS toLower($input) \nRETURN DISTINCT n.`" + propertyType + "` as value ORDER BY size(toString(value)) ASC LIMIT 5";
onQueryUpdate(newQuery);
} else {
const newQuery = "RETURN true";
Expand Down Expand Up @@ -194,4 +194,4 @@ const NeoCardSettingsContentPropertySelect = ({ type, database, settings, onRepo
</div>;
}

export default NeoCardSettingsContentPropertySelect;
export default NeoCardSettingsContentPropertySelect;

0 comments on commit 12d1b7a

Please sign in to comment.