Skip to content

Commit

Permalink
[Update][m]: search functionality updated for misspelled keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
sneha-sharma12 committed Jun 24, 2024
1 parent 4e32f1a commit 7091c66
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
11 changes: 11 additions & 0 deletions ckanext/ubdc/logic/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import datetime
import logging
import ckan.plugins.toolkit as tk
import ckan.plugins as p
from ckan.lib.navl.dictization_functions import validate
import ckan.lib.uploader as uploader
from ckan.lib.mailer import mail_recipient
Expand Down Expand Up @@ -143,3 +144,13 @@ def request_data_access_show(context, data_dict):

data_dict = RequestDataAccess.get_by_id(data_dict["id"])
return data_dict.as_dict()


@p.toolkit.chained_action
@tk.side_effect_free
def package_search(up_func, context, data_dict):
if data_dict.get('q'):
data_dict['q'] = f"{data_dict.get('q')} OR title_ngram: {data_dict.get('q')}~"
log.info(data_dict)
result = up_func(context, data_dict)
return result
1 change: 1 addition & 0 deletions ckanext/ubdc/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def get_actions(self):
"request_data_access_show": action.request_data_access_show,
"request_data_access_update": action.request_data_access_update,
"request_data_access_delete": action.request_data_access_delete,
"package_search": action.package_search
}

# IPackageController
Expand Down
4 changes: 2 additions & 2 deletions ckanext/ubdc/templates/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ <h4>Connect</h4>
</div>
</div>
</div>
<div class="attribution">
<!-- <div class="attribution">
<p>
Developed by
<a href="https://www.datopian.com/" target="_blank">Datopian.</a>
</p>
<p>Powered by <a href="http://ckan.org/" target="_blank">CKAN.</a></p>
</div>
</div> -->
</div>
</div>
{% endblock %}

0 comments on commit 7091c66

Please sign in to comment.