sajari / sdk-react Goto Github PK
View Code? Open in Web Editor NEWOfficial repository of the Search.io SDK for React
Home Page: https://react.docs.search.io
License: MIT License
Official repository of the Search.io SDK for React
Home Page: https://react.docs.search.io
License: MIT License
You don't need to set things that you want to keep, this will happen automatically because it is merging the dictionaries, not overwriting this.state.
i.e. you don't need things like
this.setState({
namespace: this.state.namespace,
// ...
})
SDK should only search once per react render. This could be achieved by only searching on the first componentDidUpdate
after a render.
Not sure what this is still doing in here?
Not sure why you have these constants in here:
https://github.com/sajari/sajari-sdk-react/blob/master/src/stores/ResultStore.js#L231
Seems to imply that these are the only actions that trigger a re-search?
The current docs refer to some components that have been removed/replaced: i.e. ResultsPerPage
and ResultsInjector
.
We need to make sure that everything is defined using the same terminology (i.e. so that a central set of documentation which describes meta boosts, index boosts, sorts etc applies to everything).
In particular, the use of constants is preferred to many helper functions which won't necessarily be defined in other variants of the SDKs. The constants will always be defined due to the protobuf.
Currently some components have class names and ids that don't make a lot of sense, eg sj-search-modal-input-holder-outer
.
Go through and make sure all of them make sense, are consistent, and won't clash with commonly used names on users sites, eg disabled
.
Also check that all overlay specific styles are only applied to overlay interfaces.
Initially we want to define events for:
There also needs to be functions in the library that can be used to register/deregister event listeners.
Allow users to set the label for a searches created from a namespace.
Although the majority of the ui-components are included because they will avoid people from repeating the same boilerplate. However, they also serve as perfect examples of how to bind api-components
to UI equivalents.
We need to make sure that the code for all ui-components
is as simple as possible.
Would be nice for people to be able to import api from etc
, but not to have to import the UI components if they don't want them, and base api similarly.
Need "main" files for
Sajari has had API changes which are reflected in the new sajari-sdk-js. This library needs to upgrade to use the newest sajari-sdk-js to stay api compatible.
Esc key should close the currently opened overlay.
This was intended for the overlay, but the in-page also gets the behaviour. This means that any pages that has the search box will have it's focus taken.
There needs to be an option in the config to disable this behaviour.
Examples include stuff like FILTER_OP_LT
, but there is nothing to explain all the options and what they mean.
Rename this to QueryConstants or something similar.
The Fetch API will (in the near future) replace XHR as a clean way to make requests from the browser. Using an isomorphic polyfill allows this SDK to be future proof and be used for Server Side Rendering as well.
Other advantages :
Looks like this was left over from when it had the JS api in there too?
Should be added to a default webBody component.
<IntervalFieldBoost field='boost' points={[
pointValue(0, 0.0),
pointValue(100, 1.0),
]} />
The way requests are built now is a mix of helpers in the utils folder and builder function in SearchActions
.
Fix it so that they are in one place, and obvious to use.
Getting
invariant.js:39 Uncaught Error: Invariant Violation: Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.
When a request is aborted.
The examples need to be updated. We should also build and host the examples on sajari.com so that people can play with them before cloning the repo etc.
ref
is a reserved prop, change prop name to reference
.
Should by default be designed for web collections. Core base features to include:
And:
The instance score boost threshold must be between 0-1, but the example uses 1.5
The ResultStore check to see if the searchQuery
value taken from the first body text in the request matches the current first body text. This was there to make sure stale results coming in slow didn't override fresh results.
I'm currently trying to use this in a simple React app, and I absolutely love Immutables. However, because the <ResultInjector>
component unwraps immutables via the expensive .toJS()
operation, I end up rewrapping it again with the even more expensive .fromJS()
.
Could we have an alternative <ImmutableResultInjector>
that injects Immutable props to its children?
Make sure that they are all rendered in the same context, i.e. within a single <div>
. Decide whether you do this if there is only one child.
Remove any non-specific items that can be added around the component when rendered by the caller (i.e. unnecessary labels etc).
Cancelled requests cause errors in the ResultStore when it tried to interpret a cancelled request as a successful request.
Proptypes specifies min count as min_count
while the component itself looks for minCount
.
You have another definition of the query Request, along with another set of default values for MaxResults and Page. You want to remove this and rely on the structure in the JS SDK instead.
https://github.com/sajari/sajari-sdk-react/blob/master/src/stores/RequestStore.js#L11
Pagination component was changed to work in boostrap, and now doesn't work without it.
Refactor so that it works standalone and is simple.
Default behaviour of react should reset the query ID for known reseting events. Currently it does not
When a search is being autocompleted, the user can hit enter to override the autocomplete and run the exact text in the input box. This is ok, but can confuse the user if they aren't aware they can hit enter.
So:
Changing the namespace of a component is not properly handled by Base component. It doesn't remove the old entry from the previous namespace and add the new entry to the new namespace.
state.js currently performs actions without exposing ways for other code to hook in to all of it's actions nicely.
There is currently beforeMergingValues
which performs some actions related to tracking. Since this point in time (received new values, not merged yet) is useful to query tracking, it might also be useful to code outside of state.js, for example analytics.
Currently adding analytics would require baking it into the NamespaceState
class or keeping state in the analytics implementation to gauge how the values are changing in order to fire analytics events.
Having a beforeMergingValues
action to listen on could look like this:
callback(oldValues, newValues)
It wouldn't be able to modify the values, only read them. This would remove the need to keep track of things like the q
param externally to trigger analytics events when the qid has changed.
Alternatively, we could expose the query id reseting as an action and also pass along the old and new q
values.
The issue with listening for qid reset on q
change is that it is pipeline specific. Once pipelines other than website and raw are used it might not function properly.
Should be "minCount", but uses "min_count" and consequently the boost does not work.
Ui components into ui-components
, API components into api-components
.
Where single HTML elements are bound to single API components, can we construct a sensible naming scheme?
<Body ... />
+ <input type="text" ... />
=> <BodyInputText />
or <BodyTextInput />
?
This comes into play more when you have things like:
<FieldFilter ... />
+ <input type="check" ... />
=> <FieldFilterInputCheck ... />
or <FieldFilterCheckInput ... />
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.