Comments (16)
Just for clarification, you want to have the search results be cleared after navigating away to another page where the search is not displayed anymore, right?
I'll be sure to add this functionality through the API
from meteor-easy-search.
Yes that is correct. Thanks
from meteor-easy-search.
You can now clear the search like following:
// index and id (is not required) are both blaze parameters:
// for example https://github.com/matteodem/meteor-easy-search#eseach
EasySearch.Components.clear(index, id);
Remember that the input might still have its value, this is not taken care of since you don't have to use the esInput (in theory). Feel free to re-open if there's anything missing regarding this ticket
from meteor-easy-search.
Also I have not documented this since I'll be re-working most of the Components to make a proper faceted search possible, see #21
from meteor-easy-search.
@matteodem you mentioned not documenting this yet, I am kind of confused on how or where exactly I should be calling clear
. Is there a handler that would be appropriate for this ?
from meteor-easy-search.
yeah, it's with the components API:
https://github.com/matteodem/meteor-easy-search/wiki/Component-API
It would be instead of "on" or "get" just "clear" without any parameters on the instance. I forgot to document that, I'll add that soonish.
from meteor-easy-search.
I can't get this working, EasySearch.Components doesn't seem to exist and I don't know what "index" or "id" should be? It's really important to automatically close the results list and clear the box when the user selects a result. I can't find any reference to 'clear' in the docs.
from meteor-easy-search.
I'm also wondering how to do this. Looking at the EasySearch object there is a EasySearch.Cursor.emptyCursor object but that is the closest thing i can find. How do you 'clear' the results with the new version?? thanks.
from meteor-easy-search.
I think this got forgotten with v2, it might make most sense to always reset "search results" as soon as the user navigates away. I'll implement it that way for now.
from meteor-easy-search.
Should have that behaviour now in latest version, please check it out.
from meteor-easy-search.
How do you do it?
like
EasySearch.Components.clear(index, id);
or
EasySearch.Cursor.emptyCursor
?
from meteor-easy-search.
Do you want an explicit clear method? I did not add it but one way would be to use component methods to search for an empty string.
from meteor-easy-search.
Oh thats kind of genius haha, a dedicated method would be nice, but the empty string does the trick for now.
from meteor-easy-search.
I tried this:
patternsIndex.search("");
but the search results stayed on screen. What am I doing wrong?
Edit: I got it, I think. This works:
patternsIndex.getComponentMethods().search("")
from meteor-easy-search.
Note: I want to hide the list if the user presses 'Esc' or clicks outside the list, so they don't have to go into the input and delete the search term to hide the search list. So that's a use case for manually clearing the list. I haven't tried it yet but I expect that your suggestion of searching for empty string will work for this.
from meteor-easy-search.
I can't get this to work.
I tried:
ContentSearchIndex.getComponentMethods().reset();
and
ContentSearchIndex.getComponentMethods().search("");
when I clear the search this way I just get all results, even though my search input component has noDocumentsOnEmpty=true:
{{> EasySearch.Input indexes=searchIndexes charLimit=2 noDocumentsOnEmpty=true attributes=searchBoxAttributes}}
from meteor-easy-search.
Related Issues (20)
- Collation feature of MongoDB HOT 4
- Top-level dependency conflict when moving to Meteor 1.6.1 HOT 5
- "Match error: Expected Collection", path: "" HOT 2
- Compatibilty with Elasticsearch 6.3 HOT 1
- Does this still work with collection-helpers for composite fields? HOT 6
- "namespace is too long" HOT 2
- Documentation missing for elastic search HOT 5
- ifSearching doesn't seem to work HOT 2
- limiting the number of returned values HOT 3
- multiple index search with ElasticSearch? HOT 1
- Error in documentation for selectors HOT 1
- Is it possible to get ifSearching directly from the index? HOT 1
- facets that only show results that valid values HOT 1
- populating easy search input and getting search results on page render HOT 1
- Easy-search nested fields as props HOT 1
- Trying to access 'resultsHandle' variable before initialization. HOT 13
- After upgrade to [email protected] new Index fails with "Match error: Expected particular constructor" when using Meteor.users HOT 5
- Exclude html from search
- How to search from the start of the searchString? HOT 2
- Support for Meteor 3.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meteor-easy-search.