This is a simple module that helps to instant search any content in the drupal site as in Google Instant search. Search page can be access by /search_instant url.

Courtesy: This module is created by the help of this post , by Luiz Eduardo,

Sandbox Page: http://drupal.org/sandbox/jaisenan/1681202
Version : Drupal 6

CommentFileSizeAuthor
instant_content_search.zip3.49 KBjaisenan

Comments

parwan005’s picture

Hello
Please put your code in git repository. And add git repo path below your project description. Make sure to remove your master branch and set code in other branch. Refer this :- http://drupal.org/node/1015226

About manual review:-
1) All of your functions must prefix your module name. It can cause problems.
2) You should use drupal functions over php functions, so avoid mysql_real_escape_string and use db_escape_sting.

Thanks

parwan005’s picture

Status: Needs review » Needs work
jaisenan’s picture

Hello,
I have created a new branch 6.x-1.x. As I am least experienced in using GIT, not sure about how to put my code into the git repository. Can you please guide me on this?

Thanks in advance
Jai

parwan005’s picture

You need to install git on your system first. Configure git and then you can push your code to git repository.
Follow this link for detailed documentation : - http://drupal.org/documentation/git

drupwash’s picture

Manual Review:

function instant_content_search_menu() {
  $items = array();
  $items['search_instant'] = array(
    'title'             => 'Instant search',
    'description'       => 'Search a website content instantly',
    'page callback'     => 'drupal_get_form',
        'access arguments' => array('access instant content search'),
    'page arguments'    => array('instant_content_search_page'),
    'type'              => MENU_NORMAL_ITEM,
  );
  $items['activate/search'] = array(
        'title'            => t('Instant Search'),
    'page callback'    => 'instant_content_search_preview',
    'access arguments' => array('access instant content search'),
        'type' => MENU_NORMAL_ITEM,
  );
  return $items;
}
Code looks very ugly. Take your time to clean your code first then read this http://drupal.org/coding-standards/. When you satisfied with your code then make your own review by installing http://drupal.org/project/pareviewsh. When everything is fine change your status to "needs_review"

You should create a repository and push all the code into that instead off .zip file.

Electronics review:
I have found lots of coding standard. Fix this.
--------------------------------------------------------------------------------
FOUND 70 ERROR(S) AND 5 WARNING(S) AFFECTING 37 LINE(S)
--------------------------------------------------------------------------------
1 | ERROR | End of line character is invalid; expected "\n" but found
| | "\r\n"
2 | ERROR | You must use "/**" style comments for a file comment
3 | ERROR | There must be no blank line following an inline comment
6 | WARNING | Format should be "* Implements hook_foo()." or "Implements
| | hook_foo_BAR_ID_bar() for xyz_bar()."
17 | ERROR | Spaces must be used to indent lines; tabs are not allowed
17 | ERROR | Line indented incorrectly; expected 2 spaces, found 1
17 | ERROR | Array indentation error, expected 4 spaces but found 1
22 | ERROR | Spaces must be used to indent lines; tabs are not allowed
22 | ERROR | Array indentation error, expected 4 spaces but found 3
22 | ERROR | Do not use t() in hook_menu()
25 | ERROR | Spaces must be used to indent lines; tabs are not allowed
25 | ERROR | Line indented incorrectly; expected 2 spaces, found 1
25 | ERROR | Array indentation error, expected 4 spaces but found 1
31 | WARNING | Format should be "* Implements hook_foo()." or "Implements
| | hook_foo_BAR_ID_bar() for xyz_bar()."
33 | ERROR | Additional blank line found at the end of doc comment
33 | ERROR | Whitespace found at end of line
36 | ERROR | Line indented incorrectly; expected 2 spaces, found 1
36 | ERROR | Expected "if (...) {\n"; found "if(...){\n"
36 | ERROR | An operator statement must be followed by a single space
36 | ERROR | There must be a single space before an operator statement
37 | ERROR | Spaces must be used to indent lines; tabs are not allowed
37 | ERROR | Line indented incorrectly; expected 4 spaces, found 2
37 | ERROR | Concat operator must be surrounded by spaces
38 | ERROR | Spaces must be used to indent lines; tabs are not allowed
38 | ERROR | Line indented incorrectly; expected 4 spaces, found 2
38 | ERROR | Concat operator must be surrounded by spaces
43 | WARNING | Format should be "* Implements hook_foo()." or "Implements
| | hook_foo_BAR_ID_bar() for xyz_bar()."
45 | WARNING | Line exceeds 80 characters; contains 83 characters
54 | ERROR | Function comment short description must end with a full stop
60 | ERROR | Spaces must be used to indent lines; tabs are not allowed
60 | ERROR | Line indented incorrectly; expected 2 spaces, found 1
60 | ERROR | Array indentation error, expected 4 spaces but found 1
60 | ERROR | Whitespace found at end of line
61 | ERROR | Spaces must be used to indent lines; tabs are not allowed
61 | ERROR | Array indentation error, expected 4 spaces but found 3
61 | ERROR | Whitespace found at end of line
62 | ERROR | Spaces must be used to indent lines; tabs are not allowed
62 | ERROR | Array indentation error, expected 4 spaces but found 3
62 | ERROR | Whitespace found at end of line
63 | ERROR | Spaces must be used to indent lines; tabs are not allowed
63 | ERROR | Array indentation error, expected 4 spaces but found 3
69 | ERROR | Spaces must be used to indent lines; tabs are not allowed
69 | ERROR | Line indented incorrectly; expected 2 spaces, found 1
69 | ERROR | Array indentation error, expected 4 spaces but found 1
75 | ERROR | Function comment short description must end with a full stop
77 | ERROR | Expected 1 space after closing parenthesis; found 0
78 | ERROR | Spaces must be used to indent lines; tabs are not allowed
78 | ERROR | Line indented incorrectly; expected 2 spaces, found 1
78 | ERROR | Expected "if (...) {\n"; found "if(...) {\n"
79 | ERROR | Spaces must be used to indent lines; tabs are not allowed
79 | ERROR | Line indented incorrectly; expected 4 spaces, found 5
80 | ERROR | Spaces must be used to indent lines; tabs are not allowed
80 | ERROR | Line indented incorrectly; expected 4 spaces, found 2
81 | ERROR | Spaces must be used to indent lines; tabs are not allowed
85 | ERROR | Missing function doc comment
86 | ERROR | Line indented incorrectly; expected 2 spaces, found 4
87 | ERROR | Line indented incorrectly; expected 2 spaces, found 4
95 | ERROR | Line indented incorrectly; expected 2 spaces, found 4
95 | ERROR | No space before comment text; expected "// Create an array
| | with the results" but found "//Create an array with the
| | results"
95 | ERROR | Inline comments must end in full-stops, exclamation marks, or
| | question marks
96 | ERROR | Line indented incorrectly; expected 2 spaces, found 4
96 | ERROR | An operator statement must be followed by a single space
96 | ERROR | There must be a single space before an operator statement
97 | ERROR | Line indented incorrectly; expected 2 spaces, found 4
97 | ERROR | Expected "while (...) {\n"; found "while(...){\n"
98 | ERROR | Line indented incorrectly; expected 4 spaces, found 8
101 | ERROR | Spaces must be used to indent lines; tabs are not allowed
101 | ERROR | Concat operator must be surrounded by spaces
101 | WARNING | A comma should follow the last multiline array item. Found: )
105 | ERROR | Line indented incorrectly; expected 2 spaces, found 4
105 | ERROR | No space before comment text; expected "// using JSON to
| | encode the array" but found "//using JSON to encode the array"
105 | ERROR | Inline comments must start with a capital letter
105 | ERROR | Inline comments must end in full-stops, exclamation marks, or
| | question marks
106 | ERROR | Line indented incorrectly; expected 2 spaces, found 4
107 | ERROR | Files must end in a single new line character
--------------------------------------------------------------------------------
Cheers jaisenan;

patrickd’s picture

@drupwash PLEASE do not paste this ugly automated review output into issues, use a link or attachment instead - as you can still edit your comment - please remove it

jaisenan’s picture

Status: Needs work » Needs review

Hello,
I have created the git repo and pushed all files to it.
Removed 'master' branch. Current branch is 6.x-1.x.
Also rectified the code standard. Please check.
Thanks for all the support!

Jai

jaisenan’s picture

Hi,
Please review my repository and help me to move forward.
Thanks!

Milena’s picture

Status: Needs review » Needs work

Hi,

.install file

You have core placed two times in your .info file. Remove one istance.

.module file

hook_menu()

You have two entries added to Navigation with the same name. What's more I have empty page on activate/search. Please, fix this because it is very confusing!

instant_content_search_page()

Consider adding your .js and .css file here instead of hook_init().

instant_content_search()

You are not using proper database query handling!
I cannot search through your module because of the db prefix I use on my Drupal 6 installation.
Please, read carefully instructions on the http://api.drupal.org/api/drupal/includes!database.inc/group/database/6 page.
What's more you are not checking access to the specific nodes. When user will use some content access module everyone who searches through your module will see all nodes (even nodes he or she shouldn't).

Do not use mysql_real_escape_string. Drupal can run on several database systems (postgresql is one of them). If you use placeholders properly it will be secure enough.
Check also http://drupal.org/writing-secure-code.

Instead of echo json_encode($results); use drupal_json().

.js file

Consider using Drupal.behavior instead of document.ready
http://drupal.org/node/304258#drupal-behaviors

You should also place all text available through .js file in Drupal.t function otherwise they will not be available to translate.
http://drupal.org/node/304258#drupal-locale

Other

Remove empty instant_content_search directory.

Automatic review

You also should fix some coding standards according to http://ventral.org/pareview/httpgitdrupalorgsandboxjaisenan1681202git

Module duplication

It seems that Drupal Instant search provides very similar functionality. Could you describe how your module differs?
We prefer collaboration over competition, therefore we want to prevent having duplicating modules on drupal.org. If the differences between these modules are not too fundamental for patching the existing one, we would love to see you joining forces and concentrate all power on enhancing one module. (If the existing module is abandoned, please think about taking it over).

klausi’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. Feel free to reopen if you are still working on this application.

klausi’s picture

Issue summary: View changes

Sandbox box link included