django-search-lucene

Is there a way to search for multiple terms in admin search? django

落爺英雄遲暮 提交于 2020-12-05 05:28:31
问题 In the django admin search bar if i had a model with a column = fruit_name and I wanted to search that column for all instances with either the fruit_name = banana or apple which would show all of the bananas and apples, how could I do that? 回答1: Override the ModelAdmin.get_search_results` method: from operator import or_ from django.db.models import Q class MyAdmin(admin.ModelAdmin): ... def get_search_results(self, request, queryset, search_term): queryset, use_distinct = super(MyAdmin,

Apache solr search part of the word

被刻印的时光 ゝ 提交于 2019-11-28 04:24:00
I'm using apache solr search engine for indexing my website database.. I'm using django+ http://haystacksearch.org/ So let's say I have document that have word "Chicken" When I search for "chicken" - solr can find this document But When I search "chick" - it does not find anything.. Is there a way to fix this ? Brian Note: The following solution is Solr 1.4 (and above) specific! For more flexibility, I would recommend indexing your data with the NGramTokenizerFactory to do complete front and back wildcard searches. If you just want to search for substrings at the beginning or end of the string

Apache solr search part of the word

时光总嘲笑我的痴心妄想 提交于 2019-11-27 05:20:13
问题 I'm using apache solr search engine for indexing my website database.. I'm using django+http://haystacksearch.org/ So let's say I have document that have word "Chicken" When I search for "chicken" - solr can find this document But When I search "chick" - it does not find anything.. Is there a way to fix this ? 回答1: Note: The following solution is Solr 1.4 (and above) specific! For more flexibility, I would recommend indexing your data with the NGramTokenizerFactory to do complete front and