Use another apps search index with Laravel Scout? - laravel

I have two different apps with two separate Laravel installs. The 1st one has some models, and its data is indexed with Scout (using the TNT search driver, which created index files on disk, if it's relevant).
Now I would like to use the 1st's models and data (that part is done, I use the same model with a different connexion to the 1st app's database), but I would also like to use the 1st's index when using the search() method.
Is it at all possible? If so, what would be the required configuration to do?
At the moment, I need to re-index all of my data in the 2nd app, and it's a bit of a waste because if I make any change in App nb. 1, the index won't update on app nb. 2.
The only idea I had at the moment (and I don't like it at all) would be to rsync the index files between the two apps, but there has to be some better way!
tl;dr: I have two apps, and I want to use the model/data/search index of one from the other app. Is it at all possible?

Related

Repeatable Data in Laravel

I'm creating a Laravel app but come from a WordPress background. In WordPress, it's reasonably straight forward to create custom fields that are repeatable e.g. I have a field called "Task" that can be repeated X number of times and it will be stored on the database.
Is there a best practice way of doing this in Laravel?
I understand that Javascript can be used to create repeatable form fields, and I could store that data as JSON in a MySQL database (using the latest versions of MySQL), but I'd also like this repeatable data to hold relationships e.g. relate a task to a day of the week (stored in another table).
Any advice or thoughts are much appreciated.

Removal of metadata added by feed

I have a GSA that fulfils a number of roles within my organisation. Honestly it's a bit of a frankenmess but it's what I have to work with.
One of the things we have it doing is indexing a number of sites based on a feed we pass it. Each of the items we pass in the feed gets tagged with a metadata that allows me to setup a frontend that only queries those items. This is working fine for the most part except that now I want to remove some metadata from items that are in the index (thereby stopping them from being in that particular frontend) and I can't figure out how.
I use a metadata-and-url type feed to push in these urls I want the system to be aware of. But it also finds a number of them through standard indexing patterns.
Heres the issue. The items that are in the index that have been found as a part of the standard crawling I can't remove. I just need the GSA to forget that I ever attached metadata to them.
Is this possible?
You can push a new feed that either updates the metadata or deletes the individual records that you want to remove from your frontend.
You can also block specific results from appearing in a specific frontend as a temporary measure while you work it out. See this doco.
It sounds like you would be better off using collections to group the subsets of the index that you want to present in a specific frontend.

Windows Forms: Best way to store table lookups

Developing new C# .net4.5 Windows Forms application. I want to code it "right". I'm developing a couple User Controls. The controls are shared via several tabs. On the controls are some common drop down boxes that are populated with the same SQL Server table data. (one or two columns) I want to read the DB once and have the lookup data available during the entire user experience. The app will be used by many users. Whats the best way to store this data in my new code? example code appreciated. cache? static list ? Help! Thanks!
Simply a global DataTable (Dataset) would do. Or if you want control over the contents of the list using SortedDictionary containing your own custom class for each row would suffice.
The Custom Class is a tidy way of holding a cache (for the data you want from each row), as you can override the ToString function and populate the user controls easily.
To share this cache amongst many users is not easy, and could prove more trouble than its worth. Each user with a separate copy of the program would have their own copy of the cache (in the 2 methods above). (But the user controls will also contains subsets of this cache too). And each program would need to load the user controls, so perhaps this sharing across multiple instances direction is moot.

restkit: lazy loading, deleting objects

I have to implement two different behaviours:
1. Lazy loading: download only required objects from server. Let's say I have a table view like in twitter app, scrolling should bring new objects.
My server takes "start" and "amount" arguments and returns the total amount. It also returns objects with some position ID, if that makes sense.
2. I need to delete some objects that are not returned from server anymore. So if local database have entities with IDs of 1-5 and server doesn't return object with id 3 – it should be deleted. There are two deleting scenarios: out of date (could be determined locally and set in a fetch controller) and deleted – couldn't be determined locally.
So how to downloaded deleted? Do I have to return some special objects from server?
3. One more thing: if user is viewing objects with IDs of 10000 – it's probably a good time to delete the first hundred locally. What's the best way to do it?
You want to manage this yourself. The deletion support offered by RestKit isn't going to be enough to cover all of your requirements.
If you have a strong deletion requirement that can't be worked out locally then you either need to delete everything locally and refresh to be sure or have the server return a 'deleted' token that you can pick up and use.

update app database regularly without needing an app update

I am working on a WP7 app that contains
CategoryGroups
Categories
Products
The rows for each of these entities are populated on first run of the application.
The issues is that when the app gets published, the rows in each of the entities will change (added, deleted, modified). I would like some suggestions on how I should handle this? Any pointers to existing code samples will be great?
I am using an object oriented database to store my entities. The app also allows the user to add their own entities (which get added to the database as personalized (flagged) entities). One solution I was thinking was to read an xml file from the server and then loop through the database entries and make the necessary modifications in the database. So, on the first run, all the entities will just get inserted. On subsequent runs, if the version number attribute in xml is different, then the system populated data is reloaded from xml but the user data is preserved.
Also, maybe only check for the new xml file on the server when internet connection is available and only periodically (like every 2 weeks).
Any other suggestions are welcome. If there is a simpler, cleaner way - please share.
Pratik
I think it's fair to say that this question has nothing to do with WP7 and everything to do with finding an efficient way to to compute and deliver update deltas.
Timestamp your items. When requesting an update, specify the time of last update. You server can trivially query for items newer than this and return a delta. At the client (ie in the phone) it is not necessary to store a last update time because you can simply add one second to the most recent timestamp in the items present on the phone.

Resources