The luceneapi module already has an interface for adding additional search pages.

We should be able to more-or-less port this code directly into apachesolr. Chris suggests that this could be a useful precursor to the Views integration

Comments

slip’s picture

So, after a quick look, it seems like we'll need:

A port of luceneapi_searcher table from luceneapi_schema()
Most of luceneapi_menu()
luceneapi_ui_add_searcher_form() and friends
luceneapi_ui_searcher_list_page() and friends

I'll start playing around with that.

slip’s picture

StatusFileSize
new18.87 KB

Posting some rough code for architectural review. I'm creating my own table apachesolr_search_searcher so we can have multiple search pages link to one server configuration, but I think it might be good to do away with that and merge it into the server table.

Lots of things don't work including edit/delete and the search itself. Still some references to luceneapi in there as well ;)

pwolanin’s picture

Status: Active » Needs work

Looks like a reasonable start.

Initial comments:

drupal_uninstall_schema('apachesolr_search') is automatic in 7

db_query_range() is not needed - since name is the primary key

you don't want to mess with hook_search_page - you want to define a new page callback

slip’s picture

Status: Needs work » Needs review
StatusFileSize
new27.15 KB

OK, fixed those issues and fixed it so edit and delete work.

slip’s picture

StatusFileSize
new23.66 KB

Updating to remove hard dependency on ctools

slip’s picture

StatusFileSize
new24.09 KB

rename apachesolr_search_seacher to apachersolr_search_pages, implemented update hook, moved user defined search pages code to apachesolr_search.pages.inc.

slip’s picture

StatusFileSize
new24.41 KB

Forgot to add:
files[] = apachesolr_search.pages.inc

to .info

pwolanin’s picture

looks pretty good. We should probably use %menu_tail instead of % for the router items though.

We should also consider at least a few simple ways to add default filters.

pwolanin’s picture

I've committed #7 locally and working to simplify it in places plus add default filters.

my hangup now is getting this error when trying to use a non-default server:
"Fatal error: Call to a member function build() on a non-object in modules/facetapi/facetapi.abstract.inc on line 760"

pwolanin’s picture

pwolanin’s picture

So, thinking about other things to resolve:

it's clear we need to make it so that the sever ID cannot be changed once it's established. Letting it change will break facet API blocks and these pages.

However, we still have to handle the case of server deletion - so we probably need to define hooks for that.

I would like to add some support for very simple URL-based filters. The luceneapi code I deleted because it was way too complex.

What I'd want to see is basically allow the user to specify one % in the path. For the 1st pass we could just have a textfield to type in the field name to match. For a better UX, I'd offer a select list at least for common fields - the select list would let us do something like taking the use NAME in the url as part of the path, and then looking up and filtering by the uid. Same for terms. Also, by know which field we have we can do things liek setting the term name as the page title.

For cases like overriding taxonomy pages, I'd like a toggle to switch between having %menu_tail take the keys in and instead using ?keys= I think that would make it less confusing in terms of the term feeds.

Once those things are working, I think we

slip’s picture

Re: server deletion

I started implementing a status flag with a column in the db for pages, but now I'm thinking it might be enough for the menu hook to only create menu items for pages which have existing server ids set. So when a server is deleted, we can just rebuild the menu and ignore the pages that reference the deleted pages. In the pages UI, instead of printing the server information we'd print something like 'This page is disabled because it is not set to us an existing server.' Gtg now, but if that sounds OK, I can put together a patch.

pwolanin’s picture

There are a variety of options here. Setting an empty value for the server ID and maybe having a "<disabled>" option in the server select list might work as part of that? Otherwise there is no way to disable bu not delete a page.

pwolanin’s picture

StatusFileSize
new43.53 KB

Putting in a major rework of the way we handle caching the current query, etc. That was required to avoid having fatal errors when 2 different servers had facetapi facets enabled.

Attached is the net diff to the main branch. Also includes API fixes to the MLT code.

pwolanin’s picture

ok, did a little local rebase and merged and pushed up 2 commits to the main branch. Let's continue work based on that.

slip’s picture

StatusFileSize
new3.21 KB

New stuff is working for me. Will test some more.

Here's a patch with #13 implemented.

pwolanin’s picture

Somehow I missed committing part of that patch. Odd. It should all be there now.

I also committed changes to make the server ID immutable.

pwolanin’s picture

Status: Needs review » Active

back to active for further improvements

jpmckinney’s picture

Status: Active » Fixed

What are these "further improvements"? May as well close the issue if there is nothing specific planned.

pwolanin’s picture

Status: Fixed » Active

Supporting the use of one % placeholder in the path as an argument was the one planned addition feature.

With that we'd also (ideally) support making searches use ?keys= for keyword searches, rather than always using %menu_tail (I thought this would be preferable for e.g. taxonomy pages)

The goal, essentially, is to be able to remove the taxonomy module totally by being able to make a custom search page that takes a tid argument.

jpmckinney’s picture

Title: Port search pages code over from luceneapi » Allow placeholders in search page paths

Renaming issue

nick_vh’s picture

Status: Active » Fixed

marking as fixed since the current search pages functionality allows you to add a placeholder (very basic) and allows you to search from different environments. Please reopen if this is not sufficient

#1294846: Refactoring of the search pages

nick_vh’s picture

Status: Fixed » Closed (duplicate)

Actually it's a duplicate and fixed so marking accordingly