简体   繁体   English

从 DRUPAL 的搜索结果中排除一些文本

[英]Exclude some text from search result in DRUPAL

Is it possible to exclude some words from the key words which the drupal search form uses?是否可以从 drupal 搜索表单使用的关键词中排除一些词?

For example I don't need results to be indexed with "search" word.例如,我不需要用“搜索”词索引结果。

First check out http://drupal.org/project/custom_search首先查看http://drupal.org/project/custom_search

It has a filter feature maybe that will do the trick.它具有过滤功能,也许可以解决问题。

If that does not work then Try this:如果这不起作用,那么试试这个:

Create your own search form and don't use the drupal default search.创建您自己的搜索表单,不要使用 drupal 默认搜索。

You can make your own search using the below api and the forms api.您可以使用以下 api 和表单 api 进行自己的搜索。

http://api.drupal.org/api/drupal/modules--search--search.module/function/search_form/7 http://api.drupal.org/api/drupal/modules--search--search.module/function/search_form/7

If you read the api you will notice variable $keys is the variable which will hold the search string so before you call the search function use regex and remove your keyword you wont' want .如果您阅读 api,您会注意到变量 $keys 是保存搜索字符串的变量,因此在调用搜索函数之前,请使用正则表达式并删除您不想要的关键字。

All the best !一切顺利 !

Cheers, Visahl干杯,维沙尔

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM