这是indexloc提供的服务,不要输入任何密码
Skip to content

Added new demo project, CachedPathSuggestBoxDemo. #2

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

Merged
merged 6 commits into from
May 5, 2020
Merged

Added new demo project, CachedPathSuggestBoxDemo. #2

merged 6 commits into from
May 5, 2020

Conversation

dtwk2
Copy link

@dtwk2 dtwk2 commented May 1, 2020

Hi
I was interested in the SuggestBox control but wanted to also cached paths for reuse.
So, i created a new demo where i make use of two suggestion-provider classes, DirectorySuggestionSource and a new one, SuggestionProvider, and combined their results.
Also refactored DirectorySuggestionSource.
Added LiteDb repository, LiteRepository, for storing paths to reuse.

Declan Taylor added 2 commits May 1, 2020 16:41
Refactored DirectorySuggestionSource.
Added LiteDb repository, LiteRepository, for storing paths to reuse.
@Dirkster99
Copy link
Owner

Hi,
that is a pretty cool contribution - thanx for that. I tried saving a few paths and was able to see them again in the SuggestBox when I either:

  1. enter no character (textbox is empty) or
  2. just enter a 'C' character.

The odd thing is that I cannot see a suggestion when I enter a 'F' character (I have a 'F' drive). Is this as designed? Can you describe some test steps to explain how this demo should work please?

Declan Taylor added 2 commits May 4, 2020 11:03
…ches based on FullName.

Cached data is returned in descending order of search time.
Divided classes into separate files.
Centered textblocks
@dtwk2
Copy link
Author

dtwk2 commented May 4, 2020

Yes it was by design, because i wanted to limit the results returned (and provide more relevant results?) i only matched on the name of the path rather than the full-name. However since that's probably not intuitive, i've changed (in my latest commit, today) for it to match on the full-name and only return the latest 5 results. Hopefully the logic is clearer as i broken things into separate files and added an interface, ISuggest.

@Dirkster99
Copy link
Owner

Hi,
I've tried the latest solution but it still seems to be strange when making suggestions :-(

I have saved the following folders:
C:\Windows\Documents
H:\Videos\Comedy

Now I get these suggestion when I type: 'doc' (returns 1st entry) or 'com' returns 2nd entry

So, I understand that you are matching on the last part of the path (name of path). But this matching does not seem to work because when I type 4 letters 'docu' or 'come' I get no results returned :-( I tried to fix this but I am not familiar with LiteDB so I am having a hard time putting together the right LinQ queries here :-(

In my view, the best and most intuitive solution would be if the engine could:

  1. Return the last 5 entries if the user enters an empty string or a string that evaluates to empty when being trimmed (eg Space ' ')

  2. Return the most relevant strings in terms of matching similar to a like clause:
    C:\Windows\Documents
    H:\Videos\Comedy

Query: 'C' returns both entries since they contain the character 'c'
'c:' returns only the 1st
'videos' returns only the 2nd entry
'come' returns only the 2nd entry
'documents' or 'windows' returns only the 1st entry
...and so forth

Would you please be able to adjust it for query/response patterns outlined in 1) and 2)?
[I tried 1) but failed with 2 empty lines… :-( ]

I would also do some more work like putting a horizontal line between the suggestions from previous entries and the suggestions from the file system, and maybe writting some textbox text into the demo client so users know what to enter here. But I can do this after accepting the PR and its just some eye candy to make things interesting for users running the demo ...

…cating functionality. Fixes issue with PathInformation returning an empty string if the path ended with \\.

Combined two ISuggest classes into CombinedSuggest.
@dtwk2
Copy link
Author

dtwk2 commented May 5, 2020

Hi,
Sorry - wasn't particularly rigorous with my testing last time. I've update the code. And this is time i've made screenshots of my testing results:

White space
image
No space
image
Match on middle name
image
Match on file name
image

It should now? conform to expectations.
Agree with the 'eye-candy' ideas. Actually i also already had the idea of a separator to differentiate the query results.

@Dirkster99 Dirkster99 merged commit c928a79 into Dirkster99:master May 5, 2020
@Dirkster99
Copy link
Owner

Perfect. Thanks a lot for this great example - I really like it :-) - I'll be trying to improve the visual throughout the next week and will get back to you when I have something worthwhile to show…

Thanx Drk

@dtwk2
Copy link
Author

dtwk2 commented May 6, 2020

Hi,
Cool. I see another repo, https://github.com/Dirkster99/bm, has another version of this control. I plan to take a look at that too.

@Dirkster99
Copy link
Owner

Dirkster99 commented May 6, 2020

Yes, please go ahead and feel free to improve the architecture were you see room for improvement.

I got this from another hot shot developer @lycj who lives (coding-wise) on a level that I normally can't dare to enter or am not that interested to find out about all the details - but since I refactored it I can answer a few questions about it and should you find bugs or have any questions feel free to ask :-)

I guess you've seen this and want to improve it with a search capability?

Untitled

Untitled1

I'm learning a bit from your code too. Never used these static methods in .Net as an equivalent to using methods within methods in C++. Thats a nice way to chope it down without producing spagetti code.

One question: How did you get the Data folder to be present but not being part of the commit?

@Dirkster99
Copy link
Owner

I've refactored your sample into an MVVM approach and inserted a separator between bookmarked suggestions and the suggestions from the file system (and added in code documentation).

There is only one thing I cannot get resolved :-( The Upsert for inserting entries creates dublicates if the user bookmarks the same entry twice. I tried to check if an entry exists and use col.Delete(key); (where key is the path) but this does not work.

Do you know the correct delete statement for the case of inserting the same string twice?

I also added a Remove (button see below) but cannot make it functional because I cannot delete anything :-(

Untitled

@dtwk2 dtwk2 deleted the development_demo branch July 17, 2020 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants