I've begun work on a number of enhancements to the trip_search module, including:

  • advanced operators
    • "" (search for specific phrase)
    • OR (find one or another word)
    • - (exclude a term)
    • filter search by catetory (term)
    • filter search by user
  • advanced search page
  • optional use of regular expression matching (to detect whole words)
  • ranking of results based on multiple parameters

The rough draft is in my sandbox. I'm not generating a patch yet because the code isn't nearly ready! That said, if anyone wants to look it over and offer some tips and suggestions, please do.

When these enahncements are complete, some of them may be applicable to the (new, improved) core search module (e.g., filtering by category, advanced operators).

Comments

moshe weitzman’s picture

i don't have any test posts at the moment, so i have minor feedack at this point. i hope to give real feedback soon.

- links in search results are busted
- the settings page looks nice. same for help.
- advanced search, don't assume taxonomy.module is active. use module_exist before calling into taxo moddule. also, the 'user' dropdown really has to be textfield, unfortunately. many sites are too big for a dropdown. this is consistent with node admin.
- when printing out node types, use the node name hook, or whatever its called. when you have a list of links (like node types), print it out with theme($links).
- print out search results in a table or in theme('item_list')

at the top of search_parse.module, it looks like you accidentally mangled together the help and block hooks.

eventually, we could really use filtering by date created and maybe date updated.

nedjo’s picture

Thanks for suggestions. I've updated the draft in my sandbox and fixed a number of problems (including some you identified). I've also added filtering by date created, introducing a popup calendar (using existing open source javascript calendar) to specify dates. See readme.txt in my sandbox for brief install instructions.

Notes:

  • Searching for specific node types. Follow links above search box for search for specific node type. I'm thinking of adding optional display here--e.g., when searching for a story, display a list of recently posted and top all time stories. When you click "advanced story search", category filtering is limited to vocabularies that have story as registered node type.
  • For now, SELECT statements are printed out (just to see what sql is being generated). Of course, in a final version this would be removed.
nedjo’s picture

StatusFileSize
new29.62 KB

Here is a beta of the work in progress. It's still a bit rough in places, but is generally functional. Outstanding issues include:

  • Need to improve date fields in advanced search page
  • Display of search results could be improved
  • Not tested on pgsql. What form of regular expression would be needed for pgsql support?

I'd appreciate it if anyone interested could install and test this and report any issues (better yet, post fixes!). I'd like to finish this off but I'm busy for the present with other commitments--so anyone wanting to take on the refining of this would be most welcome!

nedjo’s picture

StatusFileSize
new10.5 KB

Screenshot of top of advanced search page.

nedjo’s picture

StatusFileSize
new8.77 KB

Screenshot of bottom of advanced search page.

onno’s picture

Looks like a very useful addition to Drupal. If I may suggest something: I think it would be great if there were an opprtunity to restrict your search to a single book instead of the node type book, because you might know the book the answer is in but not where. Same goes ofcourse for the personal blog. And perhaps an extra option so you can kind of make a querie.

This looks very cool!

code rader’s picture

StatusFileSize
new40.88 KB

I am testing and using your cvs version. I squashed a couple of bugs and I will attach the fixed trip_search.module.

  1. removed SQL messages by having the default for debug be 0 instead of 1 (I need this in production NOW)
  2. bug: trip_search_excerpt returned the entire node.
    • It was passing the empty variable $keys instead of $parsed_keys
    • count($keys == 0) changed to count($keys) == 0.
    • for the condition of no keys return a truncated string instead of the entire string
    • added HTML comments to the output to help with debugging
code rader’s picture

Even though I have unchecked to search by user in the settings, it still show up on the advanced page at the bottom with the date.

nedjo’s picture

Version: » master

Thanks for your comments and bug fixes.

nedjo’s picture

Version: master »

I've upgraded the changes to work with 4.6 and, after discussions with Moshe, applied the patch and branched for 4.6. The code is likely to have some rough edges. Please post issues and fixes!

Anonymous’s picture