Just wondering if what I want to do is possible with Solr:
I have a Solr index of 'Users' [id, name, join_date] and on my site and I have a page /users which has a Solr query that lists all of the users in the index in alphabetical order.
On my site users can 'follow' other users. I have added another page /followers which first gets all the user_ids which are 'following' the logged in user from MySQL - then uses these IDs to query Solr to only return users which the current user is following.
This all works fine.
But the problem is, I'd like to be able to order the users returned on /followers in order of when they first started following the logged in user - I keep this information in a join table in MySQL. But my Solr documents don't contain this date - as obviously one user can have many followers and vise versa. Also I can't just use MySQL to server this page as I need to keep it Solr query-able.
Would love some insight into this - it's been bugging me for a while now.
you can do that with ExternalField but you need to export your info from the db to a text file (and keep it updated etc).
This guy here discusses a way to do it without ExternalField, but requires customizing Sorl code.
Related
I am working on an e-commerce application on which we are predicting around 2 millions products.
We are using Solr for searching, suggestions and filtering.
But for showing the product card data(which has detail like name, image, price, discount and rating) on the Product Listing page(PLP), we are going to Database after fetching the product ids from the Solr.
For E.g:
User went on the our e-commerce application and there on the search box typed "I phone 13 pro".
While user was typing we are showing suggestions to him/her after fetching it from the solr, no db involved yet.
After that user either click or hit enter then we are showing the Product listing page where we first reaching to the solr and fetching the product ids(say 24 per page we are showing) matching the entered text and then we are going to the DB with these ids and fetching the product objects and passing it to the UI with the necessary detail(using DTO object).
Now my question here is:
As I mentioned above we are hitting DB for the Product Listing Page(PLP) for fetching 24 product per page, here I am thinking it may slow down the page when our catalog and user started increasing?
Note:- we are also using Hibernate h2 level caching to stop hitting DB again and again for the same product but cache has limit up to 0.5 million.
Why we are hitting to DB instead of fetching everything from the Solr as we have all product data info which we wanted to show above on the PLP page?
Ans- As we are now keeping important fields of the product object in the Solr not all fields, So we are thinking may be in future we wanted to show something which we don't have in the Solr then we have to Re-index the full catalog to add new field into it and it may be very time-consuming.
I am in a favour of using Solr for showing PLP page instead of going to DB.Of course keeping Re-indexing in mind but not sure it is the best approach or not?
Please provide your suggestion or thoughts on this.
Thanks in advance.
I have a search database of car models: "Nissan Gtr", "Huynday Elantra", "Honda Accord", etc...
Now I also have a user list and the types of cars they like
user1 likes: carId:1234, carId:5678 etc...
Given user 1 I would like to return all the cars he likes, it can be 0 to even hundreads.
What the best way to model this in Solr or potentially another "nosql" system that can help with this problem.
I'm using Solr but I have the opportunity to use another system if I can and if it makes sense.
EDIT:
Solr solution is to slow for Join (Maybe we can try nested). And the current MySQL solution which uses join tables has over 2 billion rows.
so, you just want to store a mapping between User->Cars, and retrieve the cars based on the user...sounds very simple:
Your docs are Users: contain id (indexed), etc fields
one of the field is 'carsliked', multivalued, which contains the set of car ids he likes
you have details about each care in a different collection for example.
given a user id, you retrieve the 'carsliked' field, and get the car details with a cross collection join
You could also use nested object to store each liked car (with all the info about it) inside each user, but is a bit more complex. As a plus, you don't need the join on the query.
Solr would allow you many more things, for example, given a car, which users do like it? Elasticsearch will work exactly the same way (and probably many other tools, given how simple your use case seems).
I am working in oracle hcm fusion application. Writing a extract rule for a batch loader fast formula. in one of the extract rule formula i am using a DBI PER_HIST_ASG_ASSIGNMENT_NUMBER but it returning 0, that is no values in DBI. The problem is the DBI internally refer a secured view PER_ASSIGNMENT_SECURED_LIST_V. If I query this table from BI publisher I am not getting any rows. Some one suggest that Data role is missing. Can anyone tell me what is the exact datarole that I should add to acces the values from that DBI.
This View is based on security profile added in the Employment like BU,Department,Location etc.
So you try to retrieve the records from a Super User or Implementation user which is not attached any security profile, You will get the results.
Data roles are configured differently for each organization that is using the Cloud.
So you have to check with your application security consultant for the exact data role you need for this table.
I am creating an ldapjs server to provide an LDAP interface to users stored in a ReactiveDB. When a 3rd-party app performs an LDAP search for users, I want to iterate over all rows in a RethinkDB users table and send them in LDAP form.
According to the RethinkDB docs, r.table('users').getAll() will return nothing.
It seems like I might be able to do r.table('users').filter(() => true) but that would be a hack.
Is RethinkDB trying to discourage getting all rows? Unfortunately that's just what I need so that OwnCloud can sync in all of the available users via its LDAP Auth Backend.
I figured it out, simply using r.table('users') returns all documents in the table according to https://www.rethinkdb.com/api/javascript/table/. Filtering options chained after table() are not required.
I have little problem with permissions in my future social application.
Platform will nonrel db (Google's BigTable).
In my application each user has groups (for example: friends, collaborators, family...). In group has some friends (like in Facebook). And can publish some content (news, short text, ...) only for this group.
If I have user in my group it is my friend. Like in Facebook, but more groups.
My idea is, that each user can see (on himself "feed") all last content of all friends in one page (like as Facebook's Top news).
But I have problems with creating simple query.
For example:
SELECT * FROM News WHERE group_key IN [list_of_groups_where_i_am]
This works good, but there are sub-queries and limit of list is 30 items.
Other way is strong caching of content.
Does anybody have some idea? Or any study material, example...
With a requirement like this you can optimize for either read or write, but usually not both. You have the write optimized version - just write a record with the right group key but have a complex query to get content for all the groups.
The read optimized version would be to write the content (or just its id) to a feed for each user, which makes the read query very simple.