Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
88600018
Commit
88600018
authored
Apr 20, 2008
by
Dries Buytaert
Browse files
Options
Downloads
Patches
Plain Diff
- Patch
#154151
by Robert Douglass: made it possible to do language-aware searches.
parent
3ad38dbb
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.txt
+2
-0
2 additions, 0 deletions
CHANGELOG.txt
modules/node/node.module
+29
-0
29 additions, 0 deletions
modules/node/node.module
with
31 additions
and
0 deletions
CHANGELOG.txt
+
2
−
0
View file @
88600018
...
@@ -12,6 +12,8 @@ Drupal 7.0, xxxx-xx-xx (development version)
...
@@ -12,6 +12,8 @@ Drupal 7.0, xxxx-xx-xx (development version)
- Usability:
- Usability:
* Implemented drag-and-drop positioning for input format listings.
* Implemented drag-and-drop positioning for input format listings.
* Provide descriptions for permissions on the administration page.
* Provide descriptions for permissions on the administration page.
- Search:
* Made it possible to language-aware searches.
- Removed ping module:
- Removed ping module:
* This module has been removed from the core download. Contributed
* This module has been removed from the core download. Contributed
alternatives are available.
alternatives are available.
...
...
This diff is collapsed.
Click to expand it.
modules/node/node.module
+
29
−
0
View file @
88600018
...
@@ -1215,6 +1215,16 @@ function node_search($op = 'search', $keys = NULL) {
...
@@ -1215,6 +1215,16 @@ function node_search($op = 'search', $keys = NULL) {
$keys
=
search_query_insert
(
$keys
,
'category'
);
$keys
=
search_query_insert
(
$keys
,
'category'
);
}
}
if
(
$languages
=
search_query_extract
(
$keys
,
'language'
))
{
$categories
=
array
();
foreach
(
explode
(
','
,
$languages
)
as
$l
)
{
$categories
[]
=
"n.language = '%s'"
;
$arguments1
[]
=
$l
;
}
$conditions1
.
=
' AND ('
.
implode
(
' OR '
,
$categories
)
.
')'
;
$keys
=
search_query_insert
(
$keys
,
'language'
);
}
// Build ranking expression (we try to map each parameter to a
// Build ranking expression (we try to map each parameter to a
// uniform distribution in the range 0..1).
// uniform distribution in the range 0..1).
$ranking
=
array
();
$ranking
=
array
();
...
@@ -1871,6 +1881,22 @@ function node_form_alter(&$form, $form_state, $form_id) {
...
@@ -1871,6 +1881,22 @@ function node_form_alter(&$form, $form_state, $form_id) {
'#suffix'
=>
'</div>'
,
'#suffix'
=>
'</div>'
,
);
);
// Languages:
$language_options
=
array
();
foreach
(
language_list
(
'language'
)
as
$key
=>
$object
)
{
$language_options
[
$key
]
=
$object
->
name
;
}
if
(
count
(
$language_options
)
>
1
)
{
$form
[
'advanced'
][
'language'
]
=
array
(
'#type'
=>
'checkboxes'
,
'#title'
=>
t
(
'Languages'
),
'#prefix'
=>
'<div class="criterion">'
,
'#suffix'
=>
'</div>'
,
'#options'
=>
$language_options
,
);
}
$form
[
'#validate'
][]
=
'node_search_validate'
;
$form
[
'#validate'
][]
=
'node_search_validate'
;
}
}
}
}
...
@@ -1894,6 +1920,9 @@ function node_search_validate($form, &$form_state) {
...
@@ -1894,6 +1920,9 @@ function node_search_validate($form, &$form_state) {
if
(
isset
(
$form_state
[
'values'
][
'category'
])
&&
is_array
(
$form_state
[
'values'
][
'category'
]))
{
if
(
isset
(
$form_state
[
'values'
][
'category'
])
&&
is_array
(
$form_state
[
'values'
][
'category'
]))
{
$keys
=
search_query_insert
(
$keys
,
'category'
,
implode
(
','
,
$form_state
[
'values'
][
'category'
]));
$keys
=
search_query_insert
(
$keys
,
'category'
,
implode
(
','
,
$form_state
[
'values'
][
'category'
]));
}
}
if
(
isset
(
$form_state
[
'values'
][
'language'
])
&&
is_array
(
$form_state
[
'values'
][
'language'
]))
{
$keys
=
search_query_insert
(
$keys
,
'language'
,
implode
(
','
,
array_filter
(
$form_state
[
'values'
][
'language'
])));
}
if
(
$form_state
[
'values'
][
'or'
]
!=
''
)
{
if
(
$form_state
[
'values'
][
'or'
]
!=
''
)
{
if
(
preg_match_all
(
'/ ("[^"]+"|[^" ]+)/i'
,
' '
.
$form_state
[
'values'
][
'or'
],
$matches
))
{
if
(
preg_match_all
(
'/ ("[^"]+"|[^" ]+)/i'
,
' '
.
$form_state
[
'values'
][
'or'
],
$matches
))
{
$keys
.
=
' '
.
implode
(
' OR '
,
$matches
[
1
]);
$keys
.
=
' '
.
implode
(
' OR '
,
$matches
[
1
]);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment