Searching through big DataList from API - react-native

I have an app in which I want to show a list of around 19000 products. You can search this list and you can filter it by categories. I added paging for my API where the data comes from and I plan on using LoadMore for React FlatList. Now, when I type a search-query inside the search-bar, I want to search within all the data, not the filtered data. Where should I perform the search then? Should i either load all 19000 Items from the API, store them locally and search it? Then the paging would be kind of unnecessary.. Or should I send the search-term to the API and handle the search there? The latter also seems kind of inperformant, because It would send an API-Request every moment I type a letter to the search-bar. Or is there a third approach? What would be the proper way for this?
Thanks in Advance.

Related

Implement Search functionality with large data in react native

I have 50K+ records in my db,I want to add search filter without affecting performance of the application .Please suggest me what approach I should adopt to search the large data.
I am calling api to fetch data from server. And used react native search functionality. But due to large data i have implemented pagination at server side so each time new api being called and new data fetched from server. Now issue is it will search only from fetched page records and i want to search from all 50K+ records. And i want to search for each character typed. So I think it is not fissible to call api at each character typed.
So what is the best approch?
I have a quote finder app which holds 400k quotes on mongodb and I am using Node JS as backend. In my point of view if you are going to search more than 100 items in your front end lets say you are going to use flatlist you can create your searching algoritms in front-end side, than you can dynamically render your list according to search results. 100 items are not a specific limit it is just my idea. Because in lists more data than that would look ugly.
For 50k search you definitely have to come up with search algorithms on server-side. After you get your search data you can use
https://github.com/UnPourTous/react-native-search-list
And if your specific aim is to search on server-side I would recommend elastic-search.
But for 50k data it is better you implement your own algoritms. When you send fetch request let your server run the search and in response get the data you want.
You can use redux for this situation. When you start your application get all records(50+K) from server it will take time(You can get records in splashscreen) based on your server and store all records in redux store. Now you can search data from your redux store so don't need to call API on every search.
Make sure your server send only those data in response which you required to show in mobile application. So for getting records it will reduce response time.
You can use redux-search for this.

Can the List component be used in an edit form?

I want to be able to bring a dataset into an edit/create form because I need the respective resource in order to associate it to the main model.
Say, a store has many employees. I want , from an ui perspective, to be able to add employees to the store.
I am able to to this via a custom component, however I want to know if I am able to use the List component to fetch a certain resource, ,because I have a feeling that I'm not doing this properly now. Adminonrest has the tools to render a paginated list of resources, so how can I make better use of these tools ? Then make a custom iterator to represent the model anyway I want to (maybe even use the datagrid component). I can then attach custom actions.
What would the best pattern for this situation be ? Thanks.
No, this feature is not supported. You can display employees, using the ReferenceManyField but we don't support creating them from the Edit page.

Instagram: sort photos with a specific tag with most likes

I'm running a contest on the web where the image with the most likes wins. It's tiresom having to go through 900 images manually so what I want to do is, sort all images with the tag lets say #computer after the amount of likes, with the most liked pics on top. I have searched the net like crazy for some program or site that does this (ExtraGram, gramhoot, statigram, webstagram) but none offer to sort by amount of likes and it drives me INSANE! It's a really relevant request.
I've tried istafeed.js but it doesn't include all images, actually it leaves out the ones with the moest likes which defies the purpose.
There's nothing I know of in the Instagram API that sends back media sorted by likes in advance. I don't think there's a tool to do this either, but writing one is relatively simple IMO and I've done it before for a contest specifically.
The simplest thing to do is to do the following:
Use the Instagram API (via a library or pure REST) to query by tag. For instance, if you only care about the most recently tagged media or you want to process by date, you can use the [/tag/tag-name/media/recent][1] enpoint.
Page through each result page by processing the next_max_id/next_max_tag_id.
Collect the results locally into a database. You will receive the "like" count for each media item. You will have to update the data if you want to track the likes over time.
Sort the results using your database or if it's a small result set, you could skip #3 and just sort in memory.
If you need to refresh the results, you need to subscribe to the Tag via the API. You can give Instagram a URL to then push updates, and then you'll have to retrieve 1 or media items and update them in your database accordingly.
You will of course need to register your application with Instagram to get an API key if you want to do this. Then you can either send them your client_id or use OAuth.
The best way to achieve this is to pull the photos in and then sort them programmatically based on the likes numeric value. I've designed a plugin that does this automatically for you for anyone interested.
Instagram Journal

Specify items per page

I'm trying to query Picasa Web Albums to pull album/photo data (obviously!) however initially I only need to pull the first 4 photos. Is there any way to limit a particular field or specify the items per page?
I've already accomplished something similar with Facebook's Graph API however I'm unable to find anything similar for Picasa. The only items I can find related to limiting the response is specifying which fields, but nothing related to the number of rows.
Use max-results argument. See doc here.
https://developers.google.com/picasa-web/docs/2.0/reference#Parameters

Google Shopping API - multiple store information

We are developing an app for mobile, Mainly using Google Shopping API.
In the response we are getting one store info for one particular product.
Is there any other way to get multiple store info for one product in the response for Google Shopping API
Regards,
Bhat
if you figure out the GTIN for a product, then search by that GTIN as the query, then each result should come back as a different store
it just means usually you have to do a search on the query, grab the top most relevant GTIN, then make another request to get the store info. Thats how I have done it anyways, would be interested to know if you solved it any other way :)