Various functions in the search API use $type and $module interchangeably, and refer to "search types" and "search modules" interchangeably.

Since hook_search_info()/hook_search_execute() for Drupal 7 still only supports one search type per module, pwolanin and I agree that we should standardize on $module.

This is just an API doc fix, and changing the names of function args, so it shouldn't affect functionality, strings, etc. But it would be good to do before the D7 release.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pwolanin’s picture

yes, yes, yes

Damien Tournoud’s picture

Sounds like a good idea to me.

jhodgdon’s picture

Just as a note, we'd like to wait for #567100: Search module is assuming node is default search even when it's disabled to land before attacking this one.

jhodgdon’s picture

Assigned: Unassigned » jhodgdon

Working on a patch...

jhodgdon’s picture

Title: Search API is inconsistent in $type/$module » Search API is inconsistent in $type/$module, and generally needs doc cleanup
Status: Active » Needs review
FileSize
19.29 KB

Uh oh. Never let jhodgdon get into a clean-up issue... This patch got a bit large, but the doc headers for the search module were in rather a mess. This patch fixes them up considerably.

Note that I left the search_expression_insert/extract functions alone, as they are being addressed in another issue.

pwolanin’s picture

Assigned: jhodgdon » Unassigned
Status: Needs review » Active

I'm tempted to suggest we should postpone this until we get any actual bug/functional fixes in.

pwolanin’s picture

Status: Active » Needs review

argh - damn Firefox form handling

jhodgdon’s picture

The actual fixes could take weeks/months to get in. I'm tired of postponing everything...

marvil07’s picture

As some strings got in in other patches, patch in #5 do not apply cleanly anymore, so I just removed the stuff that already got it.

jhodgdon’s picture

jhodgdon’s picture

Just as a note, I actually wrote the original to the patch in #9, so if someone else could review it, that would be helpful. It's all documentation though (no code changes except changing names of local variables), so it can wait until a less frantic time.

pwolanin’s picture

Basically looks good, though this line suggests there might be some more cleanup to do inside the test class:

+    $this->type = $module;
jhodgdon’s picture

I don't think we can do anything about that line. Here's the context:

  /**
-   * Search items for the given search query string and type.
+   * Sets up the search query expression.
    *
    * @param $query
-   *   A search query string, that can contain options.
-   * @param $type
-   *   The type of search, this maps to {search_index}.type.
+   *   A search query string, which can contain options.
+   * @param $module
+   *   The search module. This maps to {search_index}.type in the database.
+   *
    * @return
    *   The SearchQuery object.
    */
-  public function searchExpression($expression, $type) {
+  public function searchExpression($expression, $module) {
     $this->searchExpression = $expression;
-    $this->type = $type;
+    $this->type = $module;
 
     return $this;
   }

I really don't want to change the APIs at this point (except for local variable and param names, which have no real effect on the API or code). This is inside the search query extender class, and the variable was called $type a long time ago, and I don't think we should go back and change it now.

pwolanin’s picture

Status: Needs review » Reviewed & tested by the community

Ok, well otherwise as you says this is low-risk renaming.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.