neo4j-devtools / neo4j-bloom

A public repository for informal docs, problem reporting and content sharing related to Neo4j Bloom.
Apache License 2.0
18 stars 0 forks source link

Search suggestions no longer picking individual items out of arrays #63

Open amandamch opened 1 year ago

amandamch commented 1 year ago

I've just updated to neo4j 2.10.0 and in previous versions, when using search suggestions, individual items would be suggested from within the arrays, when using a saved cypher query that searches for nodes that contained a specific item within an array stored in a property. At the moment, the saved cypher search is presenting both individual items from within arrays and also the arrays themselves (in string format), which means that it becomes impossible to type in and search for just one property, since the alphabetically higher arrays containing that item fill out all the search options. Searching with one of these suggested arrays obviously yields no results, as the underlying search is looking for items within an array, and the suggested searches are always strings.

The fix needs to be that when search suggestions are provided for the array property type, only items from within an array are presented, rather than entire arrays.

Another suggestion rather than an issue is to always have the first search option to be what the user has actually typed and then subsequent options are alphabetically sorted, rather than defaulting to an alphabetically sorted list of every option that has the string the user has typed in it

joknelid commented 1 year ago

Hi!

Could you provide this information:

We may not make any changes for this in the current search component but will definitely consider it for the new one (in case you are not familiar with it, it's currently available as an experimental feature and can be enabled by going to settings, enabling experimental features, and then enabling search experiment from the experimental features side bar drawer).

amandamch commented 1 year ago

Hi,

My apologies for not being more specific! The previous version that I was working on was 2.7.1 and the search suggestions were coming up correctly, following the same process and cypher as below.

In terms of an example, the visualisation that we have created is to explore how systems (represented by nodes) transfer data (represented by relationships) between each other. The nodes have a property that says what kind of data they transfer (e.g. employee data, project id, etc.), as do the relationships (since systems carrying the same data do not by necessity talk to each other), and the user is able to search for them by using a query formatted like "data carried=$data". The underlying cypher query for this is as follows:

WITH
"MATCH (m)-[x]->(n) "+
"WHERE '"+ $data +"' IN m.data_sent "+
"AND '"+ $data +"' IN n.data_received "+
"AND '"+ $data +"' IN x.data "+
"RETURN m,x,n"
AS querystr
CALL apoc.cypher.run(querystr, {})
YIELD value AS nodes
RETURN nodes

Previously in 2.7.1, the suggestions that appeared would just be individual items in this array, but now in 2.10.0 it is presenting the whole array as well as the items within, as below:

Screenshot 2023-09-28 161822

(Image showing whole array as a search suggestion- impossible to select just "project id" as the arrays fill up the search suggestions space)

Using this search suggestion forces neo4j into searching for the whole array in string format, meaning it looks for the whole array as a single array item, and obviously yields no results

image

(Image showing individual array item; search succeeds as it is possible to suggest this item)

Even when I remove search suggestions (in the saved cypher, by changing suggestion to "No suggestion"), I still get the same issue and I can't select the correct option, as it seems that search suggestions won't turn off:

Screenshot 2023-09-28 162220 1

(Image showing what happens when I change search suggestions to "No suggestion" - same issue as before)

In 2.7.1, the data type was set to string and that worked, since the individual array items are strings

The nature of the project and the end users has dictated that the search suggestions are necessary, so turning them off completely would be subideal. We had to use cypher queries here as well since the natural language search (which I think is what you might think I mean?) does not work when querying an array. Experimental features here is not turned on.

Hopefully that provides the detail to help clear this up, but let me know if there's anything else you need.

Thanks in advance!

joknelid commented 1 year ago

That is very clear indeed!

This seems to be a regression in the search component, thanks for spotting that. Since the new, experimental one will be made the default soon we will consider adding support for searching in arrays for that component instead. (There are some performance concerns which makes it non completely obvious to add this).