I maintain the plugin manager module. I am working on a script that needs to be able to access the results of various project searches. Attempting this required an almost complete copy/paste of the project_solr_browse_page function.

The included patch takes most of the internals of project_solr_browse_page and moves them to a helper function. project_solr_browse_page then uses the helper function. This should allow others of us to use solr integration into project without having to duplicate the all of the code.

CommentFileSizeAuthor
#11 453718_11_modularize_solr_search.patch4.73 KBAnonymous (not verified)
project_solr.patch4.71 KBAnonymous (not verified)

Comments

Anonymous’s picture

Title: Modularize Solr search » Provide easier access to raw Solr results
Anonymous’s picture

If the patch is not sufficient, what can I do to help fix it? I certainly don't mind doing whatever it is. I must either patch this or needlessly copy almost an entire function into another project.

Anonymous’s picture

I suppose it would help out if I were to actually describe the purpose of the patch! :P

The script that I am writing needs access to the results of various user selected project searches. In fact, it needs the results the raw data which is transformed into http://drupal.org/project/modules. Unfortunately these results are not available from any function. Within one function a connection is made to the solr server, the query is computed, the results are gathered, the data is themed and finally returned as html. To make matters worse, not all of the data is themed. Thus, no parser (dirty hack) would be able to regain all of the desired information.

This leaves the option of exactly copy/pasting roughly one hundred lines of a function verbatim. Unfortunately, if a bug is discovered in that hundred lines, it is quite possible that no one will think to update the lines that I copy.

This leaves one logical option: refactor. The patch breaks that one function in two. The first function returns the object representing the data itself. The second function themes it. This makes the search data available to others (like me) who need it, without requiring duplication of code.

philbar’s picture

+1

jabapyth’s picture

Status: Needs review » Reviewed & tested by the community

This looks like a great, straightforward patch, and I look forward to seeing it implemented.

dww’s picture

Status: Reviewed & tested by the community » Needs review

Not to be a pain in the ass, but no one has either reviewed nor tested this patch, so that status isn't valid. This code is critical to the functionality on drupal.org, and needs *careful* review and testing before it's going to be committed. "+1" doesn't help anything, and neither does "this looks great... I look forward to seeing it implemented".

A careful review would be helpful. Someone actually taking the time to test this would be helpful. Pretending it's RTBC when it's not is only going to make me frustrated and less interested in spending my own time to get this in.

jabapyth’s picture

@dww when I changed the status to "reviewed and tested by the community", it meant that I, a member of the community, had both reviewed and tested it.

dww’s picture

@jabapyth: Then please at least mention you tested it. ;) And details about your review help establish your credibility. Thanks.

jabapyth’s picture

Status: Needs review » Reviewed & tested by the community

sorry, i guess my description wasn't sufficient. As I said earlier, it's a pretty straightforward patch -- it doesn't change any of the functionality, or really much of the code -- it just modularizes the function for easier access.
so: I looked at it, tested it, and didn't see any changes in operation or bugs.

philbar’s picture

"+1" doesn't help anything, and neither does "this looks great... I look forward to seeing it implemented".

Writing "+1" is much easier to write than "subscribing". To me, they serve the same purpose.

Also, what's wrong with adding some encouraging words for the developers? I didn't know developers were so cold-hearted.

FYI, you came across like a real dick in that post. I'm sure you just had some frustration built up, but next try to use some composure. It will help YOU get your point received better. Can I recommend a book?

Anonymous’s picture

StatusFileSize
new4.73 KB

This patch simply rerolls the previous patch.

The point of this patch is to refactor one function so that other web services can use solr search for projects without having to rewrite large portions of code. Currently the searching and theming are done in one function. This breaks it down more naturally into a searching function and a theming function.

dww’s picture

Status: Reviewed & tested by the community » Closed (won't fix)

@philbar: Yes, it can be very frustrating working here on Drupal.org, sorry that sometimes my frustration comes out in how I write. But after the insult about being a "dick", your offer for help sort of falls on deaf ears. ;) But whatever, I'm taking it all less personally now, and trying not to get too wrapped up in these things.

Anyway, this patch no longer applies, and it seems everyone's lost interest/hope in this approach. The current effort for something similar is now at #1243332: Deploy Project Browser Server and drupalorg_pbs on d.o.