We're currently working on a way to add user profiles to the search index.
Right now, the architecture of Solr really only allows one schema per solr instance, which right now is basically only for nodes.
If you aren't using usernode (we're not and can't go back to it), it provides a dill of a pickle on how to add index for users and any profile fields. Ideally we want if a user searches for "John Smith" that the first link (most relevant) would be a returned document for their userprofile (link to it, full name, and any profile fields we add to the schema to be searchable)
Right now, the only (relatively simple way) we can come up with to do this is to add some modification in the index update / retrieval functions that would:
- instead of creating an integer nid field for the solr index, create a string nid field
- the string could be appended like "node_234" and "userprofile_234" to avoid collisions
- the stripping and converting of the node_ and userprofile_ parts and back to integers would be really easy
- depending on whether the result was node_ or userprofile_ could determine how the results are presented (i.e. link to userprofile or standard search result linking to a node)
Anyone's thought's on this approach? Solr is great but its limits in one schema per solr instance is crummy. There are some patches to solr to run multi solr cores but that gets uglier (merging of results, multiple core searches)
If it seems a good approach we'll try it and provide some patches.
Comments
Comment #1
robertdouglass commentedApacheSolr now uses a field "url" as the primary key instead of "nid". It should now be possible to write a module that searches profiles using the existing schema. There's also a hook (detailed on the project page) that lets you add sub queries to any query before searching happens, so you could manipulate the main search module as needed. Check out the latest code from the dev branch... I think your feature request is now possible.
Comment #2
jasonflenniken commentedThanks Robert... we've actually tackled it using the method I mentioned. We've also used the same method to start indexing phpbb3 (which we are using in place of drupal forums) and its working quite well. We've written in updates to the index on user hooks and forum posts/deletes.
Looking forward to seeing what else we'll be able to do. So far its been nice working with Solr.
Jason
Comment #3
robertdouglass commented@jasonflenniken, the profile search in particular will be of interest to a lot of people. Is it something that is compatible with latest development version? Is it generic enough that you could offer a patch?
Comment #4
JacobSingh commentedI think the best solution is to use a user-as-node module like node_profile, etc...
But here is another issue dealing with the same thing which seems to be farther along:
http://drupal.org/node/348668